这是一个创建于 4207 天前的主题,其中的信息可能已经有所发展或是发生改变。
def checkIpName(arg):
cmd = 'nslookup %s' % arg.strip()
handle = Popen(cmd, stdout = PIPE, stderr = PIPE, shell = True).stdout
re_handle = handle.read()
handle.close()
# name 关键词
botkey = ['baidu','google','yahoo','msn']
if re.search('Name',re_handle):
for bk in botkey:
checkkey = re.search(bk,re_handle)
if checkkey:
print "%s-%s\n" % (arg.strip(),bk)
break
4 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
amxku 2013-03-22 17:33:25 +08:00
|
|
|
2
amxku 2013-03-22 17:33:46 +08:00
|
|
|
3
phuslu 2013-03-22 17:40:04 +08:00
return any(x in socket.gethostbyaddr(arg.strip())[0] for x in ['baidu','google','yahoo','msn'])
|
|
|
4
sykp241095 2013-03-22 17:52:23 +08:00
不用popen怎么都快。
|