1. <?php
  2. ini_set('display_errors', 0);
  3. ini_set('log_errors', 0);
  4. echo "
  5. ______ _ __ __
  6. | ____| | | \ \ / /
  7. _ __| |__ __| | \ V /
  8. | '__| __| / _` | > <
  9. | | | |___| (_| | / . \
  10. |_| |______\__,_| /_/ \_\
  11.  
  12. [*]-----------------------------------------------------------------------[*]
  13. [+] Script Name : Joomla JCE Server Scanner
  14. [+] Use : php $_SERVER[PHP_SELF]
  15. [*]-----------------------------------------------------------------------[*]
  16. ";
  17. $a = true;
  18. while($a){
  19. echo "[*] Server IP -> ";
  20. $ip = trim(fgets(STDIN,1024));
  21. if(!checkIP($ip)){
  22. echo "\n[~] Error. Please Set A Valid IP.\n\n";
  23. }else{
  24. $a = false;
  25. }
  26. }
  27. echo "\n";
  28. $fp = fopen('jce-results.txt','a+');
  29. fwrite($fp,"[*]-----------------------------------------------------------------------[*]
  30. rEd X
  31. [*]-----------------------------------------------------------------------[*]
  32. [+] Script Name : Joomla JCE Server Scanner
  33. [+] Version : 1.0
  34. [+] Programed By : G-B
  35. [+] Email : g22b@hotmail.com
  36. [+] Result For : $ip
  37. [*]-----------------------------------------------------------------------[*]
  38.  
  39. ");
  40. $dork = urlencode("ip:$ip index.php?option=com_");
  41. $pages = pages($dork);
  42. $scanaed = array();
  43. for($i=1;$i<=$pages;$i=$i+10){
  44. $src = send("http://www.bing.com/search?q=$dork&first=$i");
  45. preg_match_all('/<cite>(.*?)<strong>/',$src,$matches);
  46. $sites = $matches[1];
  47. foreach($sites as $site){
  48. $sitet = trim(str_replace('www.','',str_replace('/','',$site)));
  49. if(eregi('<',$sitet) || eregi('\?',$sitet)) continue;
  50. if(in_array($sitet,$scanaed)) continue;
  51. $scanaed[] = $sitet;
  52. echo "[~] check [ $site ] : ";
  53. $header = get_headers("http://$site/components/com_jce/index.html");
  54. if(eregi('404',$header[0])){
  55. echo "No.\n";
  56. }else{
  57. echo "Yes.\n";
  58. fwrite($fp,"http://$site
  59. ");
  60. }
  61. }
  62. }
  63.  
  64. fclose($fp);
  65.  
  66. function send($url,$post=false,$ref=false,$follow=false){
  67. $cookies = getcwd().'/cookies';
  68. $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
  69. $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
  70. $header[] = "Cache-Control: max-age=0";
  71. $header[] = "Connection: keep-alive";
  72. $header[] = "Keep-Alive: 300";
  73. $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3";
  74. $header[] = "Accept-Language: en-US,en;q=0.8 ";
  75. $header[] = "Pragma: ";
  76. $ch = curl_init();
  77. curl_setopt($ch,CURLOPT_URL,$url);
  78. curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
  79. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
  80. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  81. curl_setopt($ch,CURLOPT_COOKIEFILE,$cookies);
  82. curl_setopt($ch,CURLOPT_COOKIEJAR,$cookies);
  83. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  84. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.2; rv:17.0) Gecko/20100101 Firefox/17.0');
  85. if($post){
  86. curl_setopt($ch,CURLOPT_POST,true);
  87. curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
  88. }
  89. if($follow) curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
  90. if($ref) curl_setopt($ch,CURLOPT_REFERER,$ref);
  91. $return = curl_exec($ch);
  92. curl_close($ch);
  93. unlink($cookies);
  94. return $return;
  95. }
  96. function pages($dork){
  97. $src = send("http://www.bing.com/search?q=$dork&go=&qs=n&sk=&filt=all&first=199&FORM=PERE3");
  98. $ex = explode('<span class="sb_count" id="count">',$src);
  99. $ex = explode('-',$ex['1']);
  100. return $ex[0];
  101. }
  102. function checkIP( $ip )
  103. {
  104. if( !empty( $ip ) && ip2long( $ip ) != 0 - 1 && ip2long( $ip ) != false )
  105. {
  106. $private_ips = array(
  107. array( "0.0.0.0", "2.255.255.255" ),
  108. array( "10.0.0.0", "10.255.255.255" ),
  109. array( "127.0.0.0", "127.255.255.255" ),
  110. array( "169.254.0.0", "169.254.255.255" ),
  111. array( "172.16.0.0", "172.31.255.255" ),
  112. array( "192.0.2.0", "192.0.2.255" ),
  113. array( "192.168.0.0", "192.168.255.255" ),
  114. array( "255.255.255.0", "255.255.255.255" )
  115. );
  116. foreach( $private_ips as $r )
  117. {
  118. $min = ip2long( $r[0] );
  119. $max = ip2long( $r[1] );
  120. if( $min <= ip2long( $ip ) && ip2long( $ip ) <= $max )
  121. {
  122. return false;
  123. }
  124. }
  125. return true;
  126. }
  127. return false;
  128. }
  129. ?>