Guest User

Untitled

a guest
Jan 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <?php
  2. //stream_set_blocking(STDIN, 0);
  3.  
  4. //$f = fgets(STDIN);
  5.  
  6. //var_dump($f);
  7. echo "Domain,A Record,PTR Record of A,WWW Record,Nameservers,MX Records,A Record of MX,PTR Record of A of MX\n";
  8. while (($ind = fgets(STDIN)) !== false) {
  9.  
  10. $ind=trim($ind);
  11. exec("/usr/bin/dig a ".$ind." +short", $inda);
  12. sort($inda);
  13. //echo "<pre>";
  14. //var_dump($inda);
  15. //echo "</pre>";
  16.  
  17. if(count($inda)==0)
  18. {
  19. $indptr[0]="";
  20. }
  21. else
  22. {
  23. exec("/usr/bin/dig -x ".$inda[0]." +short", $indptr);
  24. }
  25.  
  26.  
  27. exec("/usr/bin/dig mx ".$ind." +short", $indmx);
  28. sort($indmx);
  29.  
  30. // $indamatches=explode("\n",$inda);
  31. //print_r($inda);
  32.  
  33. exec("/usr/bin/dig www.".$ind." +short", $indwww);
  34.  
  35. exec("/usr/bin/dig ns ".$ind." +short", $indns);
  36. sort($indns);
  37. //print_r($indns);
  38.  
  39. foreach ($inda as $indaelement)
  40. {
  41. $indapresent= "".$indapresent.$indaelement.";";
  42. $inahtml="".$inahtml.$indaelement."<br/>";
  43. }
  44.  
  45. foreach ($indmx as $indmxelement)
  46. {
  47. $indmxpresent= "".$indmxpresent.$indmxelement.";";
  48. $inmxhtml="".$inmxhtml.$indmxelement."<br/>";
  49. }
  50.  
  51. foreach ($indns as $indnselement)
  52. {
  53. $indnspresent= "".$indnspresent.$indnselement.";";
  54. $innshtml="".$innshtml.$indnselement."<br/>";
  55. }
  56.  
  57. // <td>Domain</td><td>A Record</td><td>PTR Record</td><td>NameServers</td><td>MX Records</td>
  58.  
  59.  
  60. // echo "<tr><td>".$ind."</td><td>".$inahtml."</td><td>".$indptr[0]."</td><td>".$innshtml."</td><td>".$inmxhtml."</td></tr>";
  61. //$csv=$csv.$ind .", ".$indapresent.", ".$indptr[0].", ".$indnspresent.", ".$indmxpresent."\n";
  62. echo $ind .", ".$indapresent.", ".$indptr[0].",".$indwww[0].", ".$indnspresent.", ".$indmxpresent."\n";
  63.  
  64. unset($inda);
  65. unset($indaelement);
  66. unset($indapresent);
  67. unset($indns);
  68. unset($indnselement);
  69. unset($indnspresent);
  70. unset($innshtml);
  71. unset($inahtml);
  72. unset($indptr);
  73. unset($indmx);
  74. unset($indmxelement);
  75. unset($indmxpresent);
  76. unset($inmxhtml);
  77.  
  78. }
  79.  
  80.  
  81.  
  82.  
  83. //echo "<pre>".$csv."</pre>";
  84. //echo $csv;
  85.  
  86.  
  87. // process the line read.
  88. //echo $line;
  89. ?>
Add Comment
Please, Sign In to add comment