| 13 | |
| 14 | class Fofa: |
| 15 | def __init__(self): |
| 16 | self.email = Fofa_email |
| 17 | self.key = Fofa_key |
| 18 | self.size = Fofa_Size |
| 19 | self.headers = { |
| 20 | "User-Agent": random.choice(user_agents) |
| 21 | } |
| 22 | if self.check(): |
| 23 | if Ips.ip: |
| 24 | for ip in Ips.ip: |
| 25 | ip = "ip={}".format(ip) |
| 26 | self.run(ip) |
| 27 | else: |
| 28 | try: |
| 29 | logging.info("[FOFA Example]domain=example.com\n") |
| 30 | while 1: |
| 31 | keyword = input("请输入查询关键词:").strip() |
| 32 | size = input("请输入查询的数量(默认100):").strip() |
| 33 | self.size = int(size) if size else 100 |
| 34 | if keyword == "": |
| 35 | logging.error("\n关键字不能为空!") |
| 36 | else: |
| 37 | break |
| 38 | self.run(keyword) |
| 39 | except KeyboardInterrupt: |
| 40 | logging.error("\n用户取消输入!直接退出。") |
| 41 | exit(0) |
| 42 | else: |
| 43 | logging.error("fofa api不可用,请检查配置是否正确!") |
| 44 | |
| 45 | def run(self,keyword): |
| 46 | logging.info("正在调用fofa进行收集资产。。。。") |