How to install cymrudns
- Download and install ActivePython
- Open Command Prompt
- Type
pypm install cymrudns
Lastest release
Perform lookups by ip address and return ASN, Country Code, and Netblock Owner:: forked from the cymruwhois implementation by JustinAzoff http://github.com/JustinAzoff/python-cymruwhois
>>> import socket >>> ip = socket.gethostbyname("www.google.com") >>> from cymrudns import DNSClient >>> c=DNSClient() >>> r=c.lookup(ip) >>> print r.asn, r.date ('15169', '2007-03-13')
Four query types ('IP','IP6','ASN','PEER') are available :
>>> c.lookup(ip,qType='IP') <cymrudns.recordOrigin instance: ASN:15169|PREFIX:74.125.224.0/24|CC:US|LIR:arin|DATE:2007-03-13>>>> c.lookup(r.asn,qType='ASN') <cymrudns.recordASN instance: ASN:15169|CC:US|LIR:arin|OWNER:GOOGLE - Google Inc.|DATE:2000-03-30>>>> ip6 = socket.getaddrinfo("www.nerim.net",80,socket.AF_INET6,0,0)[0][4][0] >>> c.lookup(ip6,qType='IP6') <cymrudns.recordOrigin6 instance: ASN:13193|PREFIX:2001:7a8::/32|CC:FR|LIR:ripencc|DATE:2002-03-13>>>> c.lookupmany(['2001:4860:8010::68','2001:7a8:1:1::76'],qType='IP6') [<cymrudns.recordOrigin6 instance: ASN:15169|PREFIX:2001:4860::/32|CC:US|LIR:arin|DATE:2005-03-14>, <cymrudns.recordOrigin6 instance: ASN:13193|PREFIX:2001:7a8::/32|CC:FR|LIR:ripencc|DATE:2002-03-13>]>>> c.lookupmany(['1515','5005'],qType='ASN') [<cymrudns.recordASN instance: ASN:1515|CC:US|LIR:arin|OWNER:CTNOSC-ASNBLK-1513-1518 - Headquarters, USAISC|DATE:2004-05-12>, <cymrudns.recordASN instance: ASN:5005|CC:VE|LIR:lacnic|OWNER:Asociados Espada C.A.|DATE:1995-03-15>]>>> c.lookup('91.121.224.117',qType='PEER') <cymrudns.recordPeer instance: ASN:1299,3320,3549,4565,5511,6762,10310|PREFIX:91.121.0.0/16|CC:FR|LIR:ripencc|DATE:2006-09-20>
One day, See http://packages.python.org/cymrudns/ for full documentation.