From b858c2c72c3ff0e3dd54c53324012db7c49c5d51 Mon Sep 17 00:00:00 2001 From: CoderPIRATA Date: Thu, 19 Nov 2015 17:41:09 -0200 Subject: [PATCH] Update to version 0.9 --- xpl search.php | 340 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 238 insertions(+), 102 deletions(-) diff --git a/xpl search.php b/xpl search.php index ba045b8..a3b9201 100644 --- a/xpl search.php +++ b/xpl search.php @@ -1,24 +1,46 @@ #!/bin/env php Light blue +g -> Green +g1 -> Light grey +g2 -> Dark grey +p -> Purple +r -> Red light +*/ $c = array("r" => "\033[1;31m", "g" => "\033[0;32m", "b" => "\033[1;34m", "g2" => "\033[1;30m", "g1" => "\033[0;37m", "p" => "\033[0;35m"); -if(substr(strtolower(PHP_OS), 0, 3) != "win"){ return $c[strtolower($nome)]; } +if(substr(strtolower(PHP_OS), 0, 3) != "win"){ + return $c[strtolower($nome)]; + } } function ccdbs($OPT){ -$ids = array(0,1,2,3,4,5,6); +$ids = array(0,1,2,3,4,5,6,7); foreach($ids as $idz){ foreach($OPT["db"] as $id){ if(!preg_match("/{$idz}/i", $id)){$o=$o+1;} } } -if($o==7){$OPT["db"][] = 0;} +if($o==8){$OPT["db"][] = 0;} return $OPT; } @@ -270,7 +338,7 @@ function infos($OPT){ if(isset($OPT["cve-id"])){ $OPT["find"]=c("g1")."CVE-".c("b").$OPT["cve-id"].c("g2"); } if(isset($OPT["save"]) or isset($OPT["save-log"])){ -if(isset($OPT["save"]) and isset($OPT["save-log"])){ $s = c("b")."XPL's".c("g2")."|".c("b")."LOG"; }else +if(isset($OPT["save"]) and isset($OPT["save-log"])){ $s = c("b")."XPL".c("g2")."|".c("b")."LOG"; }else if(isset($OPT["save"])){ $s = c("b")."EXPLOIT's"; }else if(isset($OPT["save-log"])){ $s = c("b")."LOG"; } @@ -287,7 +355,8 @@ function infos($OPT){ $a=array(1 => c("g2")."[ ".c("b")."EXPLOIT-DB".c("g2")." ] ", 2 => c("g2")."[ ".c("b")."MILW00RM".c("g2")." ] ", 3 => c("g2")."[ ".c("b")."PACKETSTORMSECURITY".c("g2")." ] ", 4 => c("g2")."[ ".c("b")."INTELLIGENTEXPLOIT".c("g2")." ] ", 5 => c("g2")."[ ".c("b")."IEDB".c("g2")." ] ", - 6 => c("g2")."[ ".c("b")."CVE".c("g2")." ] "); + 6 => c("g2")."[ ".c("b")."CVE".c("g2")." ] ", + 7 => c("g2")."[ ".c("b")."SIPH0N".c("g2")." ] "); foreach($OPT["db"] as $id){ foreach($a as $N => $W){ if(preg_match("/{$N}/i", $id) or isset($OPT["no-db"])){ $setdb .= $W; } } } @@ -313,15 +382,30 @@ function infos($OPT){ } function update($OPT){ -echo c("g1")."\nUpdating, wait...\n"; +echo c("g2")."\nStarting...\n"; +echo c("g2")."Looking for a new version..."; $OPT["url"] = "https://raw.githubusercontent.com/CoderPirata/XPL-SEARCH/master/xpl%20search.php"; $update = browser($OPT); -if(!preg_match("/#END/i", $update["file"])){ die(c("r")."\nIt seems that the code has not been fully updated.\n Canceled update, try again...\n"); } +if($update["http_code"]>307 or $update["http_code"]==0){ echo c("g2")."Retrying... "; $update = browser($browser); } +if($update["http_code"]>307 or $update["http_code"]==0){ echo die(c("r")."Error with the connection!\n\n".c("g2")); } + +preg_match_all('#XPL SEARCH (.*?) ]#', $update["file"], $version); + +if($version[1][0] == VS){ die(c("g2")."\n\nThere are no updates available\n"); }else +if($version[1][0] > VS){ +echo c("g2")."\n\nNew version found: ".c("g").$version[1][0]."\n"; +echo c("g1")."Updating the tool..\n"; +echo c("g1")."Warning: the source code of this tool will be ".c("p")."overwritten".c("g1")." with the new version!\n"; + +if(file_put_contents(__FILE__, $update["file"]) == FALSE){ + die(c("r")."\nError in updating tool!\nMake sure you have sufficient permission for this.\n"); +} + +die(c("g")."\nSuccessfuly updated!\n\n"); +} -file_put_contents(__FILE__, $update["file"]); -die(c("g")."\nUpdate DONE!"); } function save($save){ @@ -377,16 +461,27 @@ function save($save){ $save["xpl"] = $save["description"]; }else{ $ok=$ok+1; } +if(preg_match("/siph0n.net/i", $save["url"])){ +$resultado = browser($save); +preg_match_all('/pre>(.+)<\/pre/s', htmlspecialchars_decode($resultado["file"]), $xpl); +$save["xpl"] = $xpl[1]; +if(preg_match("/# siph0n/i", $save["xpl"])){$ok=$ok+1;} +} + if($ok!=6 and !empty($save["xpl"])){ $save["title"] = trim(str_replace("/", "-", $save["title"])); if(isset($save["save-dir"])){ if(!is_dir($save["save-dir"])){ goto pula; } $bmk = $save["save-dir"].$ds."logs".$ds; -mkdir($bmk); mkdir($bmk.$save["find"].$ds); mkdir($bmk.$save["find"].$ds.$save["dbs"].$ds); +mkdir($bmk); +mkdir($bmk.$save["find"].$ds); +mkdir($bmk.$save["find"].$ds.$save["dbs"].$ds); $bmk .= $save["find"].$ds.$save["dbs"].$ds; }else{ pula: $bmk = "logs".$ds; -mkdir($bmk); mkdir($bmk.$save["find"].$ds); mkdir($bmk.$save["find"].$ds.$save["dbs"].$ds); +mkdir($bmk); +mkdir($bmk.$save["find"].$ds); +mkdir($bmk.$save["find"].$ds.$save["dbs"].$ds); $bmk .= $save["find"].$ds.$save["dbs"].$ds; } @@ -432,8 +527,8 @@ function browser($browser){ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); if(!empty($browser["time"])){ - curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $browser["time"]); - curl_setopt( $ch, CURLOPT_TIMEOUT, $browser["time"]); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $browser["time"]); + curl_setopt($ch, CURLOPT_TIMEOUT, $browser["time"]); } curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent); @@ -454,21 +549,20 @@ function browser($browser){ #################################################################################################### ## DATABASES function milw00rm($OPT){ -echo "\n".c("g2")."[ ".c("g1")."MILW00RM.org ".c("g2")."]:: "; +echo "\n".c("g2")."[ ".c("g1")."MILW00RM.com ".c("g2")."]:: "; $resultado=NULL; +$f=0000; $save=array(); $info = array('search' => $OPT["find"], 'Submit' => 'Submit'); if(isset($OPT["author"])){ -$browser = array("url" => "http://milw00rm.org/author.php?name=".urlencode($OPT["author"]), "proxy" => $OPT["proxy"], "time" => $OPT["time"]); +$browser = array("url" => "https://milw00rm.com/author.php?name=".urlencode($OPT["author"]), "proxy" => $OPT["proxy"], "time" => $OPT["time"]); }else{ -$browser = array("url" => "http://milw00rm.org/search.php", "proxy" => $OPT["proxy"], "post" => $info, "time" => $OPT["time"]); +$browser = array("url" => "https://milw00rm.com/search.php", "proxy" => $OPT["proxy"], "post" => $info, "time" => $OPT["time"]); } $resultado = browser($browser); -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("g2")."Retrying... "; $resultado = browser($browser); } -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } if(!preg_match('/-::DATE<\/td>/i', $resultado["file"]) or empty($resultado["file"])){ echo c("r")."NOT FOUND\n".c("g2"); @@ -496,6 +590,7 @@ function milw00rm($OPT){ if($OPT["save-log"]==1){echo save_log($LAIA);} $i++; } + echo c("g2")."'-----------------------------------------------------------------------------'\n"; } $LAIA = array(); @@ -513,10 +608,8 @@ function packetstormsecurity($OPT){ } $resultado = browser($browser); -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("g2")."Retrying... "; $resultado = browser($browser); } -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } if(preg_match('/No Results Found/i', $resultado["file"]) or empty($resultado["file"])){ echo c("r")."NOT FOUND\n".c("g2"); @@ -572,10 +665,8 @@ function iedb($OPT){ } $resultado = browser($browser); -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("g2")."Retrying... "; $resultado = browser($browser); } -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } if(!preg_match('/<td class="style1">-::DATE<\/td>/i', $resultado["file"]) or empty($resultado["file"])){ echo c("r")."NOT FOUND\n".c("g2"); @@ -615,10 +706,8 @@ function intelligentexploit($OPT){ $browser = array("url" => "http://www.intelligentexploit.com/api/search-exploit?name=".urlencode($OPT["find"]), "proxy" => $OPT["proxy"], "time" => $OPT["time"]); $resultado = browser($browser); -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("g2")."Retrying... "; $resultado = browser($browser); } -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } if(empty($resultado["file"])){ echo c("r")."NOT FOUND\n".c("g2"); @@ -641,7 +730,6 @@ function intelligentexploit($OPT){ $LAIA = array_merge($save, $OPT); if($OPT["save"]==1){ echo save($LAIA); }else{ echo "|\n"; } if($OPT["save-log"]==1){echo save_log($LAIA);} - $i++; } echo c("g1")."'-----------------------------------------------------------------------------'\n"; @@ -661,15 +749,13 @@ function exploitdb($OPT){ } $resultado = browser($browser); -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("g2")."Retrying... "; $resultado = browser($browser); } -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } if(preg_match('/No results/i', $resultado["file"]) or empty($resultado["file"])){ echo c("r")."NOT FOUND\n".c("g2"); }else{ -echo c("g")."FOUND\n".c("g2")."+-----------------------------------------------------------------------------.\n|\n"; +echo c("g")."FOUND\n".c("g2").".-----------------------------------------------------------------------------.\n|\n"; while($id_pages < 100){ $id_info=0; preg_match_all('/<td class="date">(.*?)<\/tr>/s', $resultado['file'], $source); @@ -724,16 +810,14 @@ function CVE($OPT){ } $resultado = browser($browser); -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("g2")."Retrying... "; $resultado = browser($browser); } -if($resultado["http_code"]>307 or $resultado["http_code"]==0){ -echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } if(preg_match("/There are <b>0<\/b> CVE entries that match your search/i", $resultado["file"]) or preg_match("ERROR: Couldn't find/i", $resultado["file"]) or empty($resultado["file"])){ echo c("r")."NOT FOUND\n".c("g2"); }else{ -echo c("g")."FOUND\n".c("g2")."+-----------------------------------------------------------------------------.\n|\n"; +echo c("g")."FOUND\n".c("g2").".-----------------------------------------------------------------------------.\n|\n"; if(isset($OPT["find"])){ preg_match_all('/<table cellpadding="0" cellspacing="0" border="0" width="100%">(.*?)<\/table>/s', $resultado["file"], $source); @@ -789,6 +873,59 @@ function CVE($OPT){ } fim_: +echo c("g2")."'-----------------------------------------------------------------------------'\n"; +} +saida: +} + +function siph0n($OPT){ +echo "\n".c("g2")."[ ".c("g1")."SIPH0N.in ".c("g2")."]:: "; +$resultado=NULL; + +if(isset($OPT["author"])){ +echo c("r")."Not available\n"; +goto saida; +}else{ +$info = array('search' => $OPT["find"], 'Submit' => 'Submit'); +$browser = array("url" => "http://siph0n.in/", "proxy" => $OPT["proxy"], "post" => $info, "time" => $OPT["time"]); +} + +$resultado = browser($browser); +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("g2")."Retrying... "; $resultado = browser($browser); } +if($resultado["http_code"]>307 or $resultado["http_code"]==0){ echo c("r")."Error with the connection...\n\n".c("g2"); goto saida; } + +$la=0; +$a = explode("\n", $resultado["file"]); +foreach($a as $line){ if($line == "<br><br><b>[ Search Results ]</b><br>")$la=1; } +if($la!=1){ +echo c("r")."NOT FOUND\n".c("g2"); +}else{ +echo c("g")."FOUND\n".c("g2").".-----------------------------------------------------------------------------.\n|\n"; + +preg_match_all('/<table width="597" align="center" border="0">(.*?)<\/table>/s', $resultado["file"], $data_brute); +$data_brute_2 = explode("</tr>", $data_brute[0][0]); +unset($data_brute_2[0]); +unset($data_brute_2[count($data_brute_2)]); + +foreach($data_brute_2 as $data){ +preg_match_all('#<td class="style1" nowrap="nowrap" width="62">(.*?)</td>#', $data, $date); +preg_match_all('#<td nowrap="nowrap" width="375"><a href="(.*?)" target="_blank" class="style1">(.*?)</a></td>#', $data, $title_link); +preg_match_all('#<a href=".*">(.*?)</a>#', $data, $author); + +echo c("g2")."| ".c("g1")."AUTHOR:: ".$author[1][2]."\n"; +echo c("g2")."| ".c("g1")."DATE:: ".$date[1][0]."\n"; +echo c("g2")."| ".c("g1")."TITLE:: ".c("b").trim(html_entity_decode(htmlspecialchars_decode($title_link[2][0])))."\n"; +echo c("g2")."| ".c("g1")."LINK:: ".c("b")."http://siph0n.in/{$title_link[1][0]}".c("g2")."\n".c("g2"); + +$save["author"] = $author[1][2]; +$save["date"] = $date[1][0]; +$save["title"] = trim(html_entity_decode(htmlspecialchars_decode($title_link[2][0]))); +$save["url"] = "http://siph0n.in/".$title_link[1][0]; +$save["dbs"] = "SIPH0N"; +if($OPT["save"]==1){echo save($save);}else{ echo "|\n"; } +if($OPT["save-log"]==1){echo save_log($save);} +} + echo c("g2")."'-----------------------------------------------------------------------------'\n"; } saida: @@ -856,10 +993,9 @@ function CVE($OPT){ if(preg_match("/3/i", $id) or $id == 0 and !preg_match("/3/i", $OPT["no-db"])){ echo packetstormsecurity($OPT); } if(preg_match("/4/i", $id) or $id == 0 and !preg_match("/4/i", $OPT["no-db"])){ echo intelligentexploit($OPT); } if(preg_match("/5/i", $id) or $id == 0 and !preg_match("/5/i", $OPT["no-db"])){ echo iedb($OPT); } - if(preg_match("/6/i", $id) or $id == 0 and !preg_match("/6/i", $OPT["no-db"])){ echo CVE($OPT); + if(preg_match("/6/i", $id) or $id == 0 and !preg_match("/6/i", $OPT["no-db"])){ echo CVE($OPT); } if(preg_match("/7/i", $id) or $id == 0 and !preg_match("/7/i", $OPT["no-db"])){ echo siph0n($OPT); } } } -} #END