#!/usr/bin/perl use strict; use warnings; use Algorithm::Permute; #~ my @array = 'a'..'d'; my @array = ( "ö", "a" .."z" ); # ranges and lists to permute my $perm = ""; my $i = 3; my $p = new Algorithm::Permute([@array], $i); my @res; while (@res = $p->next) { $perm = join("", @res); print "$perm\n"; if ($perm eq "art"){ # If the system command is included below, this test is _never_ true. # So the system command changes $perm is some way!! # WTF? print "found $perm \n"; die; } system("echo $perm | openssl bf -pass stdin -d -in encryptedfile -out out.txt && file -b out.txt | grep -q '^ASCII text'") == 0 && die "Found passphrase \"$perm\""; }