speer0

xsusenet renewal script

Apr 21st, 2015
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.86 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. # autoflush the output by turning buffering off
  4. $|++;
  5.  
  6. use strict;
  7. use warnings;
  8. use WWW::Mechanize;
  9.  
  10. my $uid = 'UUID';
  11. my $pass = 'PASS';
  12. my $url = 'https://my.xsusenet.com/index.php';
  13.  
  14. my $mech = WWW::Mechanize->new( agent => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36' );
  15. $mech->get($url);
  16. my @forms = $mech->forms;
  17. $mech->set_fields (
  18.   'username' => $uid,
  19.   'password' => $pass );
  20. my $resp = $mech->submit();
  21. my $status = $mech->status();
  22. if ($status == 200) {
  23.   my $unpause = $mech->find_link( url_abs_regex => qr{unpause} );
  24.   if (defined $unpause){
  25.     my $renew = 'https://my.xsusenet.com/'.$unpause->url;
  26.     $mech->get($renew);
  27.     $status = $mech->status();
  28.     #print "Account renewed\n";
  29.   }
  30. }else{
  31.   die "Recieved an invalid status response: $status\n";
  32. }
Advertisement
Add Comment
Please, Sign In to add comment