做网站含营销,erp系统教学,天猫交易网站,怎样做网站才不能被攻破免责声明:本文仅做技术交流与学习... 目录
fofa.py
fofa搜索参数分析
fofa_api.py fofa.py
import requests
from bs4 import BeautifulSoup# 登录fofa之后,把自己的cookie弄过来.
header{cookie:
}
# 参数为搜索的语法.
urlhttps://fofa.info/result?qbase64dGl0bGU9IuS4… 免责声明:本文仅做技术交流与学习... 目录
fofa.py
fofa搜索参数分析
fofa_api.py fofa.py
import requests
from bs4 import BeautifulSoup# 登录fofa之后,把自己的cookie弄过来.
header{cookie:
}
# 参数为搜索的语法.
urlhttps://fofa.info/result?qbase64dGl0bGU9IuS4iua1t%2BS6pOmAmuWkp%2BWtpiIgJiYgY291bnRyeT0iQ04i
srequests.get(url,headersheader).text
# print(s)
soup BeautifulSoup(s, lxml)
# 获取要搜索的总页数.
edu1soup.find_all(p,attrs{class: hsxa-nav-font-size})
for edu in edu1:edu_name edu.span.get_text()iint(edu_name)/10yeshuint(i)1# print(yeshu)
# 依次对每页的数据进行爬取:for ye in range(1,yeshu1):url https://fofa.info/result?qbase64dGl0bGU9IuS4iua1t%2BS6pOmAmuWkp%2BWtpiIgJiYgY291bnRyeT0iQ04ipagestr(ye)page_size10print(url)s requests.get(url,headersheader).textedu1soup.find_all(span,attrs{class: hsxa-host})# 提取所有域名(网址):for edu in edu1:edu_name edu.a.get_text().strip()print(edu_name)
fofa搜索参数分析 -------------- fofa_api.py 通过fofa的api接口直接调用. import requests
import base64# emailyour_emailkeyyour_keyqbase64dGl0bGU9ImJpbmci
def get_fofa_data(email, apikey):for edu_name in open(edu_name.txt, encodingutf-8):e edu_name.strip()# 搜索语法search %s countryCN titleError 404--Not Found % e# 先编码在解.......b base64.b64encode(search.encode(utf-8))b b.decode(utf-8)url https://fofa.info/api/v1/search/all?email%skey%sqbase64%s % (email, apikey, b)s requests.get(url).json()print(查询- edu_name)print(url)# 拿取详细数据:if s[size] ! 0:print(edu_name 有数据啦)for ip in s[results]:print(ip[0])else:print(没有数据)if __name__ __main__:email apikey get_fofa_data(email, apikey)