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!

In reply to Re^2: Simple (hopefully) shell/system() execution question by scotchfx
in thread Simple (hopefully) shell/system() execution question by scotchfx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.