curaga
Group: Members
Posts: 2163
Joined: Feb. 2007 |
|
Posted: Jan. 13 2008,17:52 |
|
Here's my current one, I know nothing of perl, but still edited it :^)Quote | #!/usr/bin/perl # curagacrack.pl
my $n = 30; # max len of passphrase
my @set = ( "ä", "ö", "y", "a" .. "p", "r" .. "v" ); # ranges and lists to permute my $result;
sub create_perm($$){
my($cur,$max)=@_;
if($cur>=$max){ print "$result\n"; setpgrp (0,0); system("echo $result | 2>/dev/null openssl rsa -noout -text -passin stdin -in mykey && echo -n 'Found passphrase: ' && echo $result && kill 0"); return; }
for(@set){ substr($result,$cur,1)=$_; create_perm($cur+1,$max); } }
for ($j=8;$j<=$n;$j++){ create_perm(0,$j); } | If I got this right, the substr function replaces the position where we are going with the next one in the set. I limited the set, but before going to wait a lifetime, I'd like to implement the filtering.
Oh, with the SIGnalling I meant that since it goes faster if it doesn't print every tried option, if I wanted to know where it's going before it has finished, I'd send it a SIGUSR1 and it would print the current $result and continue guessing.
Is perl really this light? Top shows only 1% cpu usage with this, and my system feels faster than using compiled C variants.
Well, back to the filtering. for(@set){ substr($result,$cur,1)=$_; create_perm($cur+1,$max); }
I assume this part should be changed to something like this: for(@set){ substr($result,$cur,1)=$_; if $result=*aaa* then continue .. create_perm($cur+1,$max); }
-------------- There's no such thing as life. Those mean little jocks invented it ;) - Windows is not a virus. A virus does something!
|