wdef2 has asked for the wisdom of the Perl Monks concerning the following question:
My test file encryptedfile is blowfish encrypted with a 3-letter passphrase "art". The ascii text test is to eliminate false positives for which openssl produces binary garbage. I'm not very advanced yet in the Perl liturgy, O Monks. Can you help?#!/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\""; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with Algorithm::Permute and openssl
by ikegami (Patriarch) on Jan 17, 2008 at 23:13 UTC | |
by wdef2 (Acolyte) on Jan 17, 2008 at 23:21 UTC | |
by ikegami (Patriarch) on Jan 17, 2008 at 23:25 UTC | |
by wdef2 (Acolyte) on Jan 18, 2008 at 00:45 UTC | |
by ikegami (Patriarch) on Jan 18, 2008 at 00:47 UTC | |
|