Skip to content

Commit

Permalink
Update Fofa.py
Browse files Browse the repository at this point in the history
  • Loading branch information
EASY233 committed Jun 7, 2021
1 parent 2ee4b9e commit afa298a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Fofa.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,25 @@ def __init__(self):
def run(self,ip):
keyword = "ip={}".format(ip)
keyword = quote(str(base64.b64encode(keyword.encode()), encoding='utf-8'))
url = "https://fofa.so/api/v1/search/all?email={0}&key={1}&qbase64={2}&full=false&fields=ip,title,port,domain,protocol,host&size={3}".format(
url = "https://fofa.so/api/v1/search/all?email={0}&key={1}&qbase64={2}&full=false&fields=protocol,host&size={3}".format(
self.email, self.key, keyword, self.size)
try:
response = requests.get(url,timeout=10,headers = self.headers )
datas = json.loads(response.text)
for data in datas["results"]:
for keys in data:
if "http" == keys or "https" == keys:
Urls.url.append("{0}:https://{1}/".format(data[4], data[5]))
logging.info("{0}:https://{1}/".format(data[4], data[5]))
Urls.url.append("{0}:https://{1}/".format(data[0], data[1]))
logging.info("{0}:https://{1}/".format(data[0], data[1]))
except requests.exceptions.ReadTimeout:
logging.error("请求超时")
except requests.exceptions.ConnectionError:
logging.error("网络超时")
except json.decoder.JSONDecodeError:
logging.error("获取失败,请重试")
except:
logging.error("获取失败")
pass


def check(self):
Expand Down

0 comments on commit afa298a

Please sign in to comment.