搜索
查看: 401|回复: 0

PHP旁站C段查询工具

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11913
发表于 2014-3-14 18:25:26 | 显示全部楼层 |阅读模式
  1. <?php

  2. print_r(
  3. "
  4. +------------------------------------+


  5. 旁站 and C段查询
  6. By :Sunshie
  7. Blog:http://phpinfo.me/

  8. Example:
  9. php.exe $argv[0] -p ip地址(查询旁站)
  10. php.exe $argv[0] -c ip地址(查询C段)


  11. 结果保存在ok.txt里面!
  12. +------------------------------------+
  13. \r\n\r\n\r\n"
  14. );
  15. if(empty($argv[2])) exit("ip地址呢");
  16. $ip=gethostbyname($argv[2]);
  17. switch($argv[1]){
  18. case "-p":
  19.      bing($ip);
  20.          break;
  21. case "-c":
  22.      c($ip);
  23.         break;
  24.   default:
  25.     echo "错误:[ -p ip]地址为查询旁站,[-c ip]地址为查询C段";


  26. }
  27. function c($sb){


  28. $str=(explode(".",$sb));



  29. for($vip=1;$vip<=255;$vip++){

  30. $newip=$str[0].".".$str[1].".".$str[2].".".$vip;
  31. echo "正在查询$newip-------------\r\n";
  32. bing($newip);


  33. }


  34. }
  35. $file=file("ok.txt");
  36.         echo "\r\nok.txt查询到".count($file)."个";

  37. function bing($ip){

  38. $first=1;

  39.         do {
  40.    ini_set('user_agent', 'Baiduspider');
  41.    $a=file_get_contents("http://www.bing.com/search?count=50&q=ip%3a$ip&qs=n&pq=ip%3a$ip&sc=0-0&sp=-1&sk=&first=".$first."&FORM=PQRE");
  42.    $a=mb_convert_encoding($a, "GBK", "UTF-8");
  43.    $first+=50;
  44.    preg_match_all("/<h3><a href="(.*)<\/a><\/h3>/isU",$a,$arr);
  45.   preg_match_all("/<h3><a href="(.*)" target="_blank/isU",$a,$urlarr);
  46.    $arr[1] = preg_replace('/" target="_blank"(.*).1">/isU','-----------',$arr[1]);
  47.    unset($arr[0]);
  48.    foreach ($arr as $key=>$r){
  49.      foreach ($r as $k=>$rc){
  50.         //$ab=mb_convert_encoding($rc, "GBK", "UTF-8");
  51.          
  52.          //echo "$rc\r\n";
  53.          //file_put_contents("ok.txt", $rc."\r\n",FILE_APPEND);
  54.           //echo $first."\n";
  55.            $arrs = parse_url($rc);
  56.          
  57.          echo $arrs['host']."\r\n";
  58.          file_put_contents("ok.txt", $arrs['host']."\r\n",FILE_APPEND);
  59.         
  60.          }
  61.     }
  62.         


  63.   
  64. } while (strpos($a,">下一页</a></li></ul></div>"));

  65. }


  66. ?>
复制代码
过段时间可能会取消签到功能了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表