Advertisement
Guest User

GoAhead Exploit - Zmap Filter [OPEN SOURCE]

a guest
Nov 19th, 2017
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <?php
  2. //no backdoors on this shit
  3. $list = "poop.txt";
  4. $port = "8081";
  5. $output = "GoAhead-Filtered.txt";
  6.  
  7. function in_array_r($item, $array) {
  8. return preg_match('/"' . $item . '"/i', json_encode($array));
  9. }
  10. if (ini_get('safe_mode')) {
  11. die('Please disable PHP SafeMode! Killing script...');
  12. } else {
  13. $file = file($list);
  14. ForEach ($file as $line) {
  15. $ip = $line;
  16. $ip = trim($ip);
  17. $url = 'http://' . $ip . ':' . $port;
  18. $ch = curl_init();
  19. $headers = [];
  20. curl_setopt($ch, CURLOPT_URL, $url);
  21. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  22. curl_setopt($ch, CURLOPT_TIMEOUT, 1);
  23. // this function is called by curl for each header received
  24. curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$headers) {
  25. $len = strlen($header);
  26. $header = explode(':', $header, 2);
  27. if (count($header) < 2) // ignore invalid headers
  28. return $len;
  29. $name = strtolower(trim($header[0]));
  30. if (!array_key_exists($name, $headers)) $headers[$name] = [trim($header[1]) ];
  31. else $headers[$name][] = trim($header[1]);
  32. return $len;
  33. });
  34. $data = curl_exec($ch);
  35. if (in_array_r("GoAhead-Webs", $headers)) {
  36. echo "GoAhead Found";
  37. $data = $ip . ":" . $port . "";
  38. file_put_contents($output, $data, FILE_APPEND | LOCK_EX);
  39. } else {
  40. echo "";
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement