Skip to content

Instantly share code, notes, and snippets.

@GarnetSunset
Created February 27, 2018 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GarnetSunset/34b78d398a91931f52bf7c724d6f1679 to your computer and use it in GitHub Desktop.
Save GarnetSunset/34b78d398a91931f52bf7c724d6f1679 to your computer and use it in GitHub Desktop.
import subprocess
goUp = 0
range = raw_input("What range would you like to test for \"xxx.xxx.xxx\"\n>")
text_file = open(range + ".XXX.txt", "w")
while(goUp < 255):
goUp = goUp + 1
excuseMePrincess = range + "." + str(goUp)
excuseMePrincess.strip()
print(range + "." + str(goUp))
try:
proc = subprocess.Popen(["nslookup", excuseMePrincess], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
text_file.write(excuseMePrincess + "\n" + out)
except:
text_file.write(excuseMePrincess + ": Does not exist according to nslookup\n")
text_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment