ernket / shepherd Goto Github PK
View Code? Open in Web Editor NEW将fofa quake zoomeye hunter等空间测绘聚合的小工具
License: GNU General Public License v3.0
将fofa quake zoomeye hunter等空间测绘聚合的小工具
License: GNU General Public License v3.0
fofa.py:61 应该改成这样,去掉了导出fid的字段,这个字段需要企业会员
fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
如果不改的话,返回结果为:{'error': True, 'errmsg': '[820001] 没有权限搜索fid字段'}
在这种情况下会报
[-]fofa模块存在问题:
local variable 'result' referenced before assignment
原因是异常处理没做好,在以下片段的代码里头,当errmsg存在于res.text时,result不会被创建,但紧接着又使用了result['results'],就会报变量在没定义前使用
while True:
fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
#print(fofa_search_url)
res = requests.get(fofa_search_url, headers=header)
if 'errmsg' not in res.text:
result = json.loads(res.text)
if len(result['results'])==0: #如果当前页面返回的数据为0,说明已遍历完成,无需继续
可以改成
while True:
fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
#print(fofa_search_url)
res = requests.get(fofa_search_url, headers=header)
if 'errmsg' in res.text:
print(res.text) #输出此时api返回结果
continue #执行下次循环直到成功
result = json.loads(res.text)
if len(result['results'])==0: #如果当前页面返回的数据为0,说明已遍历完成,无需继续
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.