Trying to run the above solution but am running into difficulties - I am testing my script on a .rar file I created myself but for some reason the print(PIPE $pw); command does not pass the input correctly when unrar prompts for a password...
I know the password itself is correct - at least it prints correctly when I examine it in the array:
#use Expect;
my $tocrackrar = $ARGV[0];
my $hint = '1234';
my @wild = ('a'..'z','0'..'9');
my $wild = '{'. join(',',@wild).'}';
my @password = (<$hint$wild$wild>,
<$wild$hint$wild>,
<$wild$wild$hint>);
my $total = 0;
foreach $pw (@password)
{
$total++;
open(PIPE, "|./unrar e $tocrackrar");
print(PIPE $pw);
if(-e "./tocrack.txt")
{
print "$total : $pw";
exit(0);
}
close PIPE;
}
I guess the catch might be that I am running this via the WinXP command prompt using ActivePerl 5.8.7 (have also tried using Cygwin but I get a "Broken Pipe" before the script completes).
any ideas what I could be doing wrong?
am I using the print(PIPE $pw); incorrectly somehow? In the shell it seems as if the script is doing it's job (I see it attempt to unrar the tocrack.rar file and fail with incorrect passwords) but as I set the password for this file to be a password I know the script should hit on it's 5th loop (1234ae) I know that the print(PIPE $pw) command is not passing the password value correctly...
I'd like to try using the Expect.pm however I cannot seem to find it for Cygwin or ActiveState - and unfortunately I haven't the privilege level to install it on the Linux servers at school:)
Thanks!