利用撒旦搜索引擎查询ip个数,批量下载ip,使用语言python3.x
批量测试时,为了方便直接撸下ip,所以用python写了个GUI撒旦利用工具,写的不是很好,但能用,最下面有下载。
from tkinter import *
import threading
import shodan
root=Tk()
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
size = '%dx%d+%d+%d' % (300, 400, (screenwidth-300)/ 2, (screenheight-400) / 2)
root.geometry(size)
root.title('撒旦GUI')
root.resizable(width=False, height=False)
title=Label(root,text='python3 撒旦利用GUI',font="16")
title.pack()
api=Label(root,text='输入API',width=12)
api_input=Entry(root,width=20)
api.place(x=30,y=40)
api_input.place(x=140,y=40)
search=Label(root,text='请输入查询语句',width=12)
search_input=Entry(root,width=20)
search.place(x=30,y=80)
search_input.place(x=140,y=80)
#文件名输入
txt_name_input=Entry(root)
txt_name_input.place(x=180,y=120,width=60,height = 30)
txt_txt = Label(root,text='.txt',font="10")
txt_txt.place(x=240,y=125)
#输出框
show_1 = Entry(root)
show_1.place(x=20, y=160, width=250, height=200)
def false():
show_1.insert("1","请检查API、网络状态、关键字")
def ip_number():
show_1.delete(0, END)
show_1.insert("1", "正在查询")
try:
api_s = shodan.Shodan(api_input.get())
results = api_s.search(search_input.get()) #如果修改搜索的内容请注意符号
ips = results['total'] #ip个数
ips_str = "ip个数为 "+str(ips)
show_1.delete(0, END)
show_1.insert(1,ips_str)
except shodan.APIError as e:
false()
def ip_download():
show_1.delete(0,END)
show_1.insert("1", "正在下载")
txt\_name =txt\_name\_input.get()+".txt"
f = open(txt\_name, 'a+')
try:
api\_s = shodan.Shodan(api\_input.get())
results = api\_s.search(search\_input.get())
show\_1.insert(1, "正在下载ip:端口. . . . . . ")
for result in results\['matches'\]:
url = result\['ip\_str'\] + ":" + str(result\['port'\])
f.write(url) #f.write("http://" + url)
f.write("\\n")
f.close()
show\_1.delete(0, END)
show\_1.insert(1,"ip收集完毕 T0.0T")
except shodan.APIError as e:
false()
def T_ip_number():
T = threading.Thread(target=ip_number)
T.start()
def T_ip_download():
T = threading.Thread(target=ip_download)
T.start()
B_ip=Button(root,text="获取ip个数",width=10,relief=GROOVE,command=T_ip_number)
B_ip.place(x=20,y=120)
B_txt=Button(root,text="下载到txt",width=10,relief=GROOVE,command=T_ip_download)
B_txt.place(x=100,y=120)
root.mainloop()
_**py下载 https://wwn.lanzout.com/iRkPs02f2jkj**_
exe下载 https://wwn.lanzout.com/iaktF02f2i9c 密码 6vdu
手机扫一扫
移动阅读更方便
你可能感兴趣的文章