Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse dns lookup with scapy in python

How can I do reverse DNS lookup using scapy in Python? I look for it in Google but I couldn't find related to this topic.

like image 822
Shnkc Avatar asked Dec 03 '22 02:12

Shnkc


1 Answers

Reverse DNS is already written into Python's Socket module. Simply use the following:

 >>> import socket
 >>> socket.gethostbyaddr("69.59.196.211")
 ('stackoverflow.com', ['211.196.59.69.in-addr.arpa'], ['69.59.196.211'])

Which was originally posted here, Python lookup hostname from IP with 1 second timeout, by https://stackoverflow.com/users/81179/christophed

like image 73
rofls Avatar answered Dec 28 '22 03:12

rofls