当前位置: 首页>>代码示例>>Python>>正文


Python DNS.revlookup方法代码示例

本文整理汇总了Python中DNS.revlookup方法的典型用法代码示例。如果您正苦于以下问题:Python DNS.revlookup方法的具体用法?Python DNS.revlookup怎么用?Python DNS.revlookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DNS的用法示例。


在下文中一共展示了DNS.revlookup方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testLazy

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
    def testLazy(self):
        x = DNS.lazy.mxlookup('lathspell.de')
        self.assertEqual([(10, "mail3av.westend.com")], x)

        x = DNS.revlookup("212.117.79.2")
        self.assertEqual("www2.westend.com", x)

        reqobj=DNS.Request(server='dns1.netcologne.de')
        x = reqobj.req("lathspell.de", qtype=DNS.Type.A)
        self.assertEqual("NOERROR", x.header['status'])
        self.assertEqual(1, x.header['aa']) # authoritative answer
        self.assertEqual(1, len(x.answers))
        self.assertEqual('212.117.79.2', x.answers[0]['data'])
开发者ID:lathspell,项目名称:python_test,代码行数:15,代码来源:DNSTest.py

示例2: getDomainPtrEntry

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
 def getDomainPtrEntry(self,ip,timeout = 5,dnsservers = ['8.8.8.8', '8.8.4.4']):
     try:
         if (ip != ""):
             DNS.defaults['server'] = dnsservers
             DNS.defaults['timeout'] = timeout
             resul = DNS.revlookup(ip)
             if (len(resul) > 0):
                 return resul
             else:
                 return -1
         else:
             return -1
     except DNS.ServerError as e:
         if e.rcode == 3:
             return -1
         else:
             return -2
     except Exception as e:
         return -2
开发者ID:ggusoft,项目名称:inforfinder,代码行数:21,代码来源:bingchecker.py

示例3: __call__

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
    def __call__(self, line):
        for pat in (self.pat, self.php_error_pat):
            m = pat.match(line)
            if m: break

        if not m: return line

        gd = m.groupdict()
        gd['x'] = self.x

        # reverse lookup client
        if gd.get('client') == self.last_ip:
            gd['client'] = gd['client-dn'] = ''
        else:
            self.last_ip = gd.get('client')
            try:
                gd['client-dn'] = self.dns_format.format('', DNS.revlookup(gd['client']), **gd)
            except DNS.DNSError, e:
                gd['client-dn'] = self.dns_format.format('', '(%s)' % str(e), **gd)
            except:
开发者ID:tiberiusteng,项目名称:tools,代码行数:22,代码来源:colorlog.py

示例4:

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
# Uses PyDNS.

import DNS

#req = DNS.Request( name="www.google.com", qtype="A", protocol= "udp", server="10.211.55.3" )
#req = DNS.Request( name="www.google.com", qtype="A", protocol= "udp", server="127.0.0.1" )
#req = DNS.Request( name="www.google.com", qtype="A", protocol= "udp", server="localhost" )
#print "www.google.com: ", req.req().show()

tlds = ["com", "net", "org"]  # add more here.

name = DNS.revlookup( "77.46.197.147" )
names = name.split('.')
while names and names[0] not in tlds:
   name = "_bittorrent._tcp." + ".".join(names)
   req = DNS.Request( name=name, qtype="SRV", protocol="udp", server="localhost") 
   response = req.req()
   if response.answers:
      break
   del names[0]

print "response=", response.show()   


开发者ID:Encombe,项目名称:bittorrent.org,代码行数:24,代码来源:bep_0022_query.py

示例5: nameserver

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
#!/opt/python/bin/python1.5

import DNS
# automatically load nameserver(s) from /etc/resolv.conf
# (works on unix - on others, YMMV)
DNS.ParseResolvConf()

r=DNS.Request(qtype='mx')
res = r.req('connect.com.au')
res.show()

r=DNS.Request(qtype='soa')
res = r.req('connect.com.au')
res.show()

print DNS.revlookup('192.189.54.17')

开发者ID:swamp-lan,项目名称:university-staff,代码行数:18,代码来源:test2.py

示例6: range

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
import DNS
DNS.AddNameServer('172.16.0.4')

res = []
res2 = []

for i in range(255):
	for j in range(254):
		yo = '172.16.%s.%s' % (i, j)
		try:
			print "%s - %s" % (yo, DNS.revlookup(yo))
			pizda = DNS.revlookup(yo)
			res.append([yo, pizda])
			res2.append(pizda.lower() + "\n")
		except:
			#print "%s - error" % (yo)
			pass

print len(res)
open("wss_1.txt", "w").writelines(res2)
开发者ID:swamp-lan,项目名称:university-staff,代码行数:22,代码来源:build_wss.py

示例7: nameserver

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
#!/usr/bin/python3

import sys ; sys.path.insert(0, '..')
import DNS
# automatically load nameserver(s) from /etc/resolv.conf
# (works on unix - on others, YMMV)
DNS.ParseResolvConf()

r=DNS.Request(qtype='mx')
res = r.req('connect.com.au')
res.show()

r=DNS.Request(qtype='soa')
res = r.req('connect.com.au')
res.show()

print(DNS.revlookup('192.189.54.17'))
开发者ID:ados1991,项目名称:py3dns,代码行数:19,代码来源:test2.py

示例8: range

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
import DNS
DNS.AddNameServer('172.16.0.4')

res = []
res2 = []

for i in range(255):
	for j in range(254):
		try:
			yo = '172.16.%s.%s' % (i, j)
			print "%s - %s" % (yo, DNS.revlookup(yo))
			res.append([yo, DNS.revlookup(yo)])
			res2.append(DNS.revlookup(yo).lower() + "\n")
		except:
			#print "error"
			pass

print len(res)
open("wss.txt", "w").writelines(res2)
开发者ID:swamp-lan,项目名称:university-staff,代码行数:21,代码来源:2.py

示例9: eat_input

# 需要导入模块: import DNS [as 别名]
# 或者: from DNS import revlookup [as 别名]
        eat_input()
        hostname = m.group('host')
        m = re.match("^(?P<host>.*):(?P<port>[0-9]+)$", hostname)
        if m:
            host = m.group('host')
            port = m.group('port')
        else:
            port = "80"

        if port != "25":
            bad_port(hostname);
            sys.exit()

        if is_ipaddr(host):
            try:
                hostname = DNS.revlookup(host)
            except:
                hostname = ""
        elif re.match("^.*\.(edu|com|org)$", host):
            hostname = host
        else:
            hostname = ""

        good_port();

        arguments = [sys.argv[0]]
        if hostname != "":
            arguments.append("-h")
            arguments.append(hostname)
        for arg in sys.argv[1:]:
            arguments.append(arg)
开发者ID:Herysutrisno,项目名称:honeyd,代码行数:33,代码来源:proxy.py


注:本文中的DNS.revlookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。