ip反查
- 作者: 你们的名字有我的吊吗啊
- 来源: 51数据库
- 2022-08-12
#!/usr/bin/python2.7
# -*- coding:utf-8 -*-
import urllib,urllib2
import re
import subprocess
import sys
output=''
def html(html):
#print str
response=urllib2.urlopen(html)
return str(response.readlines())
def getpage(html):
pattern=re.compile("\.\.\.\s(\d+)",re.S)
#print html
p=pattern.findall(html)
#print '页数为:'+p[0]
if len(p)==0:
print '无查询结果'
exit()
else:
return int(p[0])
def getAllDomain(html):
#print html
pattern1=re.compile("t<a\shref=\"http://(.*?)/\"\srel",re.S)
domain=pattern1.findall(html)
result=[]
i=0
#print domain
for pp in domain:
result.append(pp)
i+=1
return result
def nslookup(domain):
ns=subprocess.Popen('nslookup '+domain,shell=True,stdout=subprocess.PIPE)
ns_result=ns.stdout.read()
#print ns_result
#如果nslookup输出不一样需要修改正则,正则不会写,很多疏漏,简单写下能实现就行
re_domain=re.compile("Name:\t([\s\S\w\W]*?)\nAddress:([\s\S\w\W]*?)\n", re.S)
return re_domain.findall(ns_result)
def nslookupThread(allDomain):
for d in allDomain:
r=nslookup(d)
#跳过未查询到的
if len(r)==0:
continue
for i in range(len(r)):
x=r[i][0].strip()
y=r[i][1].strip()
#print '%s:%s' % (x,y)
#提取解析到此ip的域名
if cmp(y,ip)==0:
print x
推荐阅读
热点文章
Discord.py(重写)on_member_update 无法正常工作
0
Discord.py 在 vc 中获取用户分钟数
0
discord.py 重写 |为我的命令出错
0
Discord.py rewrite 如何 DM 命令?
0
播放音频时,最后一部分被切断.如何解决这个问题?(discord.py)
0
在消息删除消息 Discord.py
0
如何使 discord.py 机器人私人/直接消息不是作者的人?
0
(Discord.py) 如何获取整个嵌入内容?
0
Discord bot 尽管获得了许可,但不能提及所有人
0
Discord.py discord.NotFound 异常
0
