Black-ID

Newcamd Server Grabber

Feb 26th, 2013
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.27 KB | None | 0 0
  1. use LWP::UserAgent;
  2. use XML::Simple;
  3. use HTTP::Request;
  4. my $ua = LWP::UserAgent->new(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1) Gecko/20090624 Firefox/3.5');
  5. $url = "http://feeds.feedburner.com/NewcamdServer";
  6. my $req=HTTP::Request->new(GET=>$url);
  7. my $response=$ua->request($req);
  8. $con = str_replace('Host :','HOST :',$response->content);
  9.  
  10. my @posts = split('<img src=', $con);
  11. foreach my $post (@posts) {
  12.  
  13. if ( $post =~ m#(HOST :) (.*)# ) {
  14. $host = $2 ;
  15. }
  16. if ( $post =~ m#(PORT :) (.*)# ) {
  17. $port = str_replace('>','',$2);
  18. }
  19. if ( $post =~ m#(USER :) (.*)# ) {
  20. $user = str_replace('>','>',$2);
  21. }
  22. if ( $post =~ m#(PASS :) (.*)# ) {
  23. $pass = $2;
  24. }
  25.  
  26. open(a, ">>servers.txt");
  27. print a "\nHost:$host\nPort:$port\nUser:$user\nPass:$pass\n--------------------------------------";
  28. close(a);
  29. }
  30.  
  31. sub str_replace {
  32.     my $replace_this = shift;
  33.     my $with_this  = shift;
  34.     my $string   = shift;
  35.    
  36.     my $length = length($string);
  37.     my $target = length($replace_this);
  38.    
  39.     for(my $i=0; $i<$length - $target + 1; $i++) {
  40.         if(substr($string,$i,$target) eq $replace_this) {
  41.             $string = substr($string,0,$i) . $with_this . substr($string,$i+$target);
  42.             return $string; #Comment this if you what a global replace
  43.         }
  44.     }
  45.     return $string;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment