Skip to content

Instantly share code, notes, and snippets.

@gmic
Last active September 11, 2018 01:05
Show Gist options
  • Save gmic/97f991899a6d2544f084 to your computer and use it in GitHub Desktop.
Save gmic/97f991899a6d2544f084 to your computer and use it in GitHub Desktop.
Python nslookup
import subprocess
process = subprocess.Popen(["nslookup", "www.google.com"], stdout=subprocess.PIPE)
output = process.communicate()[0].split('\n')
ip_arr = []
for data in output:
if 'Address' in data:
ip_arr.append(data.replace('Address: ',''))
ip_arr.pop(0)
print ip_arr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment