Follow us on Twitter!
One mans freedom fighter, another's terrorist.
Monday, April 21, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 31
Guests Online: 28
Members Online: 3

Registered Members: 82858
Newest Member: alexxkim
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Code

n3w7yp3
Member

Your avatar

Posts: 358
Location: USA
Joined: 19.03.05
Rank:
Moderate
Posted on 16-04-05 02:13
Jut saw that there were no programming forums, so I though that I'd start a thread where people could post their code....

anyways here is something that I made.

Code

#!/usr/bin/perl

#DNS scanner v 2.0
#changes: added a timeout option
#eliminated (well, most of) the annoying system() calls
#read prefixes from a file

#written by: n3w7yp3

$timeout = shift;
if($timeout !~ /[0-9]{1,}/)
{#quit if there is no time out value
   die "Usage: $0 <timeout> <domain>\nTimeout is the delay between DNS requests.\nDomain is the domain to scan\n";
}
$host = shift;
if($host !~ /[a-z]{1,}\.[a-z]{1,}/i)
{#quit if there is no host
   die "Usage: $0 <timeout> <domain>\nTimeout is the delay between DNS requests.\nDomain is the domain to scan.\n";
}
$lookups = 0; #this will be used later to track the total number of lookups made
if(-e "prefix")
{
   if($timeout == 0)
   {#a few warnings/informative messsages that will be diplsayed to the user based on what the time out value is
      warn "WARNING: you have specified a scan with _NO_ timeout! this \*will\* be \*loud\* and \*detectable\* ! I _strongly_ recommend that you have the scan with a timeout between 5 and 10.\n";
      sleep(2);
   }
   elsif($timeout < 5)
   {
      warn "You have specified a scan with a timeout value of \*less\* than 5. I recommend a scan with a timeout between 5 and 10. that way it is less detectable.\n";
      sleep(2);
   }
   elsif($timeout >= 30)
   {
      warn "You have specified a scan with a timeout value greater than or equal to 30. This will be hard to detect, but will be slower. Please be patient.\n";
      sleep(2);
   }
   print "Doing multiple DNS lookups on $host...\n";
   $total = `wc -l prefix`; #get the number of lines in the prefix file
   open(PRE, "prefix") || die "Unable to open the prefix file (prefix)!\nQUITTING!\n";
   {#open it up
      system("touch host_file"); #create a file that we will stroe the DNS info in
      $file = host_file;
      system("host $host >> $file"); #do a DNS lookup on the host with no prefix
      until($total == $lookups)
      {#keep going until the lookups are equal to the total number of lines in the prefix file
         $line = <PRE>; #grab the prefixes from the file
         chomp($line); #remove the newline
         system("host $line\.$host >> $file"); #do the DNS lookup
         sleep($timeout); #sleep for the timout value that was entered earlier
         $lookups++; #increase the lookups by 1 each time
      }
      print "SUMMARY: a total of $lookups lookups were made.\n";
      print "Assembling the lists of hosts...\n";
      print "Based on the info recived, the following hosts exist:\n\n";
      sleep(2);
      system("grep -v \"NXDOMAIN\" host_file"); #print all he resualts to the screen that dont contain the term \"NXDOMAIN\"
      print "\n\n";
      system("rm host_file"); #delete the host_file
      close PRE;
      exit; #close up and exit cleanly
   }
}
die "The prefix file, (prefix) was not found. please be sure that it is in the same dir as $0.\nQUITTING!\n";



Author

RE: Code


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 16-04-05 02:56
there's a programming forum actually.. look more closely Grin


Author

RE: Code

n3w7yp3
Member

Your avatar

Posts: 358
Location: USA
Joined: 19.03.05
Rank:
Moderate
Posted on 16-04-05 15:55
lol, I feel like an idiot. i guess thats what you get when you post at 0300......


"Root is a state of mind" -- K0resh