Skip to content

Instantly share code, notes, and snippets.

@jjsantanna
Created March 27, 2018 07:42
Show Gist options
  • Save jjsantanna/2556d5fb690b7f7d5411de8dd4c2f21c to your computer and use it in GitHub Desktop.
Save jjsantanna/2556d5fb690b7f7d5411de8dd4c2f21c to your computer and use it in GitHub Desktop.
IPv4 to rDNS (or host)
def ipv42rdns(ipv4):
rdns = subprocess.Popen(['dig', '-x', ipv4, '+short'],
stdout=subprocess.PIPE).communicate()[0].decode("utf-8").replace('\n','')
return rdns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment