MCPcopy Create free account
hub / github.com/EASY233/Finger / Quake

Class Quake

api/quake.py:12–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12class Quake:
13 def __init__(self):
14 self.headers = {
15 "User-Agent": random.choice(user_agents),
16 "X-QuakeToken": QuakeKey
17 }
18 if QuakeKey == "":
19 logging.warning("请先在config/config.py文件中配置quake的api")
20 exit(0)
21
22 try:
23 logging.info("[QUAKE Example]domain:example.com\n")
24 while 1:
25 self.keywords = input("请输入查询关键词:").strip()
26 self.size = input("请输入查询数量:").strip()
27 if self.keywords == "" or self.size == "":
28 logging.error("\n关键字或查询数量不能为空!")
29 elif self.size.isdigit() != True:
30 logging.error("\n查询数量非整数!")
31 else:
32 break
33 self.run()
34 except KeyboardInterrupt:
35 logging.error("\n用户取消输入!直接退出。")
36 exit(0)
37
38
39 def run(self):
40 logging.info("正在使用使用360 Quake进行资产收集。。。")
41 logging.info("查询关键词为:{0},查询数量为:{1}".format(self.keywords, self.size))
42 self.data = {
43 "query": self.keywords,
44 "start": 0,
45 "size": self.size
46 }
47 try:
48 response = requests.post(url="https://quake.360.cn/api/v3/search/quake_service", headers=self.headers,
49 json=self.data, timeout=10)
50 datas = json.loads(response.text)
51 if len(datas['data']) >= 1 and datas['code'] == 0:
52 for data in datas['data']:
53 port = "" if data['port'] == 80 or data["port"] == 443 else ":{}".format(str(data['port']))
54 if 'http/ssl' == data['service']['name']:
55 url = 'https://' + data['service']['http']['host'] + port
56 logging.info(url)
57 Urls.url.append(url)
58 elif 'http' == data['service']['name']:
59 url = 'http://' + data['service']['http']['host'] + port
60 logging.info(url)
61 Urls.url.append(url)
62 except Exception as e:
63 logging.error("获取失败")
64 pass

Callers 1

api_dataMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected