Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use autodie;
- use LWP::UserAgent;
- use Text::Autoformat;
- use Digest::MD5 qw(md5_hex);
- my $PASS_FILE = undef;
- # Uncomment to read passwords from file
- # (C:\Users\ArmAUser\arma3arg_passwords.txt).
- # Put there passwords one by line.
- #
- #$PASS_FILE = "$ENV{HOME}/arma3arg_passwords.txt";
- # Tried ones are stored here.
- my $TRIED_PWS_FILE = "$ENV{HOME}/arma3arg_tried_pws.txt";
- my @USERS = qw(jerryhopper melteme);
- my %tried;
- if (-e $TRIED_PWS_FILE) {
- open(my $fh, $TRIED_PWS_FILE);
- while (<$fh>) {
- chomp;
- $tried{$_} = 1;
- }
- close($fh);
- }
- my $ifh;
- unless (defined $PASS_FILE) {
- $ifh = *STDIN;
- } else {
- open($ifh, $PASS_FILE);
- }
- while (defined (my $pw = <$ifh>)) {
- chomp($pw);
- # try verbatim
- try_pass($pw);
- # sentence 'limnos times' -> 'Limnos times'
- # title 'limnos times' -> 'Limnos Times'
- # highlight 'Martin And Ivan' -> 'Martin and Ivan'
- # upper 'Hi Bro' -> 'HI BRO'
- # lower 'Hi Bro' -> 'hi bro'
- # uc ~ upper
- # lc ~ lower
- for my $style (qw(sentence title highlight upper lower)) {
- my $new_pw = autoformat($pw, { case => 'sentence' });
- $pw =~ s/\s*$//m;
- try_pass($pw);
- }
- # remove all spaces
- my $nonws_pw = $pw;
- $nonws_pw =~ s/\s//g;
- try_pass($nonws_pw);
- try_pass(lc($nonws_pw));
- try_pass(uc($nonws_pw));
- # replace all spaces with '_'
- my $uc_pw = $pw;
- $uc_pw =~ s/\s/_/g;
- try_pass($uc_pw);
- try_pass(lc($uc_pw));
- try_pass(uc($uc_pw));
- }
- sub try_pass($) {
- my $pw = shift;
- if (exists $tried{$pw}) {
- return;
- }
- my $ua = LWP::UserAgent->new;
- for my $u (@USERS) {
- my $creds = "$u:$pw";
- my $md5 = md5_hex($creds);
- print "Trying '$creds'...\n";
- my $req = HTTP::Request->new('POST', 'http://m26.node-42.rv4a3.org/json-rpc-service-demo.php');
- $req->content_type('application/json');
- $req->header(Accept => 'application/json, text/javascript, */*; q=0.01');
- $req->header(Origin => 'http://m26.node-42.rv4a3.org');
- $req->header('X-Requested-With' => 'XMLHttpRequest');
- $req->header(Referer => 'http://m26.node-42.rv4a3.org/');
- $req->header('User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22');
- $req->content(<<EOF);
- {
- "jsonrpc":"2.0",
- "method":"ls",
- "params":["$md5","\/var\/spool\/mail\/jerryhopper"],
- "id":1
- }
- EOF
- my $res = $ua->request($req);
- if ($res->content !~ /Access Denied/) {
- print "*** SUCCESS ***\n";
- print "Login: $u\n";
- print "Password: $pw\n";
- exit 0;
- }
- }
- $tried{$pw} = 1;
- open(my $fh, '>'.$TRIED_PWS_FILE);
- print $fh $pw, "\n";
- close($fh);
- }
- 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement