Advertisement
BhieNEka

Remote PHP in PERL

Apr 1st, 2013
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.98 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use IO::Socket;
  3. use IO::Select;
  4. use Socket;
  5.  
  6.  
  7. my $url1 = ("http://URL_DOMAIN_KAMU/php1.php");
  8. my $status1 = query($url1);
  9.  
  10. my $url2 = ("http://URL_DOMAIN_KAMU/php2.php");
  11. my $status2 = query($url2);
  12.  
  13. my $url3 = ("http://URL_DOMAIN_KAMU/php3.php");
  14. my $status3 = query($url3);
  15.  
  16. my $url4 = ("http://URL_DOMAIN_KAMU/php4.php");
  17. my $status4 = query($url4);
  18.  
  19. sub query($) {
  20.     my $url = $_[0];
  21.     $url =~ s/http:\/\///;
  22.     my $host  = $url;
  23.     my $query = $url;
  24.     my $page  = "";
  25.     $host  =~ s/href=\"?http:\/\///;
  26.     $host  =~ s/([-a-zA-Z0-9\.]+)\/.*/$1/;
  27.     $query =~ s/$host//;
  28.     if ( $query eq "" ) { $query = "/"; }
  29.     eval {
  30.         my $sock = IO::Socket::INET->new(PeerAddr => "$host", PeerPort => "80", Proto => "tcp") or return;
  31.         print $sock "GET $query HTTP/1.0\r\nHost: $host\r\nAccept: */*\r\nUser-Agent: Mozilla/5.0\r\n\r\n";
  32.         my @r = <$sock>;
  33.         $page = "@r";
  34.         close($sock);
  35.     };
  36.     return $page;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement