KekSec

PHP DNS AMP SCANNER BY SYNTHMESC

Jan 31st, 2017
1,669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <html>
  2. <style>
  3. body {
  4.     background-color: #000000;
  5.     color: #00ff00;
  6. }
  7. h1 {
  8.     color: #ff0000;
  9. }
  10. </style>
  11. <h1>Welcome to SynthMesc's open recursive DNS scanner!</h1>
  12. <body>
  13. <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET">
  14. DNS Server list URL: <input name="url">
  15. <input type ="submit" value="Scan">
  16. </form>
  17. <?php
  18. error_reporting(0);
  19. set_time_limit(0);
  20. if (isset($_GET['url'])) {
  21.     $servers = explode("\n", file_get_contents($_GET['url']));
  22.     foreach($servers as &$server) {
  23.         checkForRecursion($server);
  24.     }
  25. }
  26.  
  27. function checkForRecursion($target) {
  28.     $request = "\xde\xad"; // Transaction-ID 0xdead
  29.     $request .= "\x01\x00"; // flags (recursion desired)
  30.     $request .= "\x00\x01"; // 1 question
  31.     $request .= "\x00\x00"; // 0 answers
  32.     $request .= "\x00\x00"; // 0 authority
  33.     $request .= "\x00\x00"; // 0 additional
  34.     $request .= "\x03www\x09wikipedia\x03org\x00"; // www.wikipedia.org
  35.     $request .= "\x00\x01"; // type A
  36.     $request .= "\x00\x01"; // class IN
  37.  
  38.     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
  39.  
  40.     socket_set_option($sock,SOL_SOCKET,SO_RCVTIMEO,array("sec"=>0,"usec"=>500000));
  41.  
  42.     $len = strlen($request);
  43.     $port = 53;
  44.     socket_sendto($sock, $request, $len, 0, $target, $port);
  45.     $r = socket_recvfrom($sock, $response, 1024, 0, $target, $port);
  46.  
  47.     if ($response[3] == "\x80") {
  48.         echo "<font color='#00ff00'><b>[+]</b></font> Recursion appears to be enabled on $target!<br>\n";
  49.         $logfile="recursive.txt";
  50.         $fp = fopen($logfile, "a") or die("Unable to open file!");  fwrite($fp, $target . "\n") or die("Unable to write to file!");
  51.         fflush($fp);
  52.         fclose($fp);
  53.         return true;
  54.     } else if ($response == "") {
  55.         echo "<font color='#ff0000'><b>[-]</b></font> No response from $target<br>\n";
  56.         return false;
  57.     } else {
  58.         echo "<font color='#ff0000'><b>[-]</b></font> Recursion appears to be disabled on $target<br>\n";
  59.         return false;
  60.     }
  61.     ob_flush();
  62.     socket_close($sock);
  63. }
  64. ?>
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment