Advertisement
Guest User

rotmg mass mule password changer

a guest
May 3rd, 2013
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.95 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. #
  3. # mass mule password changer (c) supahacka@gmail.com
  4. # v0.2
  5. #
  6.  
  7. use strict;
  8. use warnings;
  9. use threads;
  10. use Thread::Queue;
  11. my $q = Thread::Queue->new(); # A new empty queue
  12.  
  13. die 'Please specify the new password as a command line argument.' if !defined $ARGV[0];
  14. my $newPassword=$ARGV[0];
  15.  
  16. open(INPUT,'mules.txt') or die 'Can not open input file "mules.txt": ' . $! . "\n";
  17. while(<INPUT>){
  18.  chomp();
  19.  my($guid,$password)=split(/\s+/,$_);
  20.  $q->enqueue([$guid, $password, $newPassword]);
  21. }
  22. print $q->pending() . ' mules queued for processing.' . "\n";
  23. sleep 2;
  24.  
  25. sub start_thread {
  26.  while(my $mule=$q->dequeue_nb()){
  27.   # Format:
  28.   # POST https://realmofthemadgod.appspot.com/account/changePassword
  29.   # URLEncoded form
  30.   # guid:         foo@foo.org
  31.   # ignore:       79341
  32.   # newPassword:  futloch2
  33.   # password:     futloch
  34.  
  35.   my $content = [
  36.     'guid' => $mule->[0],
  37.     'ignore' => int(rand(1000)+1000),
  38.     'newPassword' => $mule->[2],
  39.     'password' => $mule->[1],
  40.   ];
  41.  
  42.   use LWP::UserAgent;
  43.   use HTTP::Request::Common qw(POST);
  44.   my $ua = LWP::UserAgent->new;
  45.  
  46.   my $retry=1;
  47.   my $timesTried=0;
  48.   my $result=undef;
  49.   while($retry==1){
  50.    my $req = POST 'http://realmofthemadgod.appspot.com/account/changePassword', $content;
  51.    my $res = $ua->request($req);
  52.    $result=$res->decoded_content;
  53.    $timesTried++;
  54.    $retry=0 if ($result eq '<Success/>' || $timesTried>=2);
  55.    print 'Change password for mule ' . $mule->[0] . '/' . $mule->[1] . ' to ' . $mule->[2] . ' - result: ' . $result . ($timesTried>1 ? ' (retry #' . $timesTried .' )' : '') . "\n";
  56.   }
  57.  }
  58. }
  59.  
  60. for(0..2){
  61.  my $thr = threads->create('start_thread');
  62. }
  63.  
  64. while(threads->list(threads::running)){
  65.  print scalar(localtime(time())) . ' # of threads running: ' . scalar(threads->list(threads::running)) . "\n";
  66.  print $q->pending() . ' mules queued for processing.' . "\n";
  67.  sleep 5;
  68. }
  69.  
  70. foreach (threads->list(threads::joinable)){
  71.  $_->join();
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement