Skip to content

Instantly share code, notes, and snippets.

@amxku
Created March 22, 2013 09:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amxku/5220044 to your computer and use it in GitHub Desktop.
Save amxku/5220044 to your computer and use it in GitHub Desktop.
checkIpNslookup
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment