-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.py
753 lines (675 loc) · 31.7 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
from tkinter import *
from tkinter.messagebox import showinfo, showerror
from ttkbootstrap import Notebook, Button, Entry, StringVar, Treeview, Scrollbar, Combobox
import socket
from httpx import get, post, ReadTimeout
from base64 import b64encode
from ipaddress import IPv4Address
from configparser import ConfigParser
from concurrent.futures import ThreadPoolExecutor
cfg = ConfigParser()
typ = {"域名": "domain", "IP": "ip"}
class WinGUI(Tk):
def __init__(self):
super().__init__()
self.__win()
self.__tk_info()
self.__tk_selector()
self.tk_input_ip = self.__tk_input_ip()
self.tk_button_search = self.__tk_button_search()
self.tk_tabs = Tabs_results(self)
def __win(self):
self.title("inforGUI信息查询聚合工具 Powered by Wrong-pixel")
# 设置窗口大小、居中
width = 1000
height = 550
screenwidth = self.winfo_screenwidth()
screenheight = self.winfo_screenheight()
geometry = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
self.geometry(geometry)
self.resizable(width=False, height=False)
# 提示框
def __tk_info(self):
label = Label(self, anchor="nw", wraplength=680, justify="left", font=('微软雅黑', 13, 'bold'),
text="注意,各平台对域名查询存在诸多差异,结果较少时可以分别尝试根域名及子域名")
label.place(x=50, y=5, width=600, height=30)
# 选择框
def __tk_selector(self):
self.selector = Combobox(self, state="readonly", width=60)
self.selector['value'] = ('IP', '域名')
# 默认使用IP查询
self.selector.current(0)
self.selector.place(x=600, y=5, width=60, height=30)
return self.selector
# 主界面输入框
def __tk_input_ip(self):
self.ipt = Entry(self)
self.ipt.place(x=670, y=5, width=200, height=30)
return self.ipt
# 主界面查询按钮
def __tk_button_search(self):
self.btn = Button(self, text="查询", command=self.__schedule)
self.btn.place(x=880, y=5, width=102, height=30)
return self.btn
def __schedule(self):
# 每次进行查询都保存一次config
self.__save_config()
self.target = self.tk_input_ip.get().replace("\n", "")
self.method = self.selector.get()
if self.target == "":
showerror(title="Error", message="请输入目标!")
return
# 如果查询目标选择的是IP,就进行IP格式检查
if self.method == "IP":
try:
IPv4Address(self.target)
except:
showerror(title="error", message="IP输入有误!")
return
# 为了避免假死,使用线程池管理多个线程以提高并发
executor = ThreadPoolExecutor()
# fofa查询
if self.tk_tabs.tk_tabs_config.fofa_key.get() != "" and self.tk_tabs.tk_tabs_config.fofa_mail.get() != "":
executor.submit(self.__get_fofa)
else:
self.tk_tabs.tk_tabs_fofa.tk_label['text'] = "fofa配置缺失,本次不予查询!"
# hunter查询
if self.tk_tabs.tk_tabs_config.hunter_username.get() != "" and self.tk_tabs.tk_tabs_config.hunter_key.get() != "":
executor.submit(self.__get_hunter)
else:
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = "鹰图配置缺失,本次不予查询!"
# 微步查询
if self.tk_tabs.tk_tabs_config.weibu_key.get() != "":
executor.submit(self.__get_weibu)
else:
self.tk_tabs.tk_tabs_weibu.tk_label['text'] = "微步配置缺失,本次不予查询!"
# 0zone查询
if self.tk_tabs.tk_tabs_config.zone_key.get() != "":
executor.submit(self.__get_0zone)
else:
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = "0zone配置缺失,本次不予查询!"
# shodan
if self.tk_tabs.tk_tabs_config.shodan_key.get() != "":
executor.submit(self.__get_shodan)
else:
self.tk_tabs.tk_tabs_shodan.tk_label['text'] = "shodan配置缺失,本次不予查询!"
# zoomeye
if self.tk_tabs.tk_tabs_config.zoomeye_key.get() != "":
executor.submit(self.__get_zoomeye)
else:
self.tk_tabs.tk_tabs_zoomeye.tk_label['text'] = "zoomeye配置缺失,本次不予查询!"
def __get_fofa(self):
word = f"{typ[self.method]}=\"{self.target}\""
query = b64encode(word.encode()).decode()
fofa_url = f"https://fofa.info/api/v1/search/all?email={self.tk_tabs.tk_tabs_config.fofa_mail.get()}&key={self.tk_tabs.tk_tabs_config.fofa_key.get()}&qbase64={query}&fields=host,ip,title,country_name,province,city,icp,protocol,isp"
try:
[self.tk_tabs.tk_tabs_fofa.tk_table.delete(item) for item in
self.tk_tabs.tk_tabs_fofa.tk_table.get_children()]
except:
pass
try:
self.tk_tabs.tk_tabs_fofa.tk_label['text'] = f"正在fofa上查询{self.target}的相关信息......"
data = get(fofa_url, timeout=10).json()
if not data['results']:
self.tk_tabs.tk_tabs_fofa.tk_label['text'] = f"fofa查询完毕,未查询到相关信息"
else:
self.tk_tabs.tk_tabs_fofa.tk_label['text'] = f"fofa查询完毕,双击可复制所选内容"
for item in data['results']:
self.tk_tabs.tk_tabs_fofa.tk_table.insert("", END, values=[item[0], item[1], item[2],
item[3] + " " + item[4] + " " + item[5],
item[6], item[7]])
except ReadTimeout:
self.tk_tabs.tk_tabs_fofa.tk_label['text'] = f"查询FOFA信息超时!"
return
except BaseException:
self.tk_tabs.tk_tabs_fofa.tk_label['text'] = "查询FOFA出错!请检查网络及FOFA配置!"
return
def __get_hunter(self):
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = f"正在鹰图上查询{self.target}的相关信息......"
try:
[self.tk_tabs.tk_tabs_hunter.tk_table.delete(item) for item in
self.tk_tabs.tk_tabs_hunter.tk_table.get_children()]
except:
pass
words = b64encode(bytes(f'{typ[self.method]}="{self.target}"'.encode())).decode()
hunter_url = f"https://hunter.qianxin.com/openApi/search?username={self.tk_tabs.tk_tabs_config.hunter_username.get()}&api-key={self.tk_tabs.tk_tabs_config.hunter_key.get()}&search={words}&page=1&page_size=10&is_web=1"
try:
res = get(hunter_url, timeout=5).json()
if res['code'] != 200:
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = "查询鹰图信息超时"
return
else:
use_point = res['data']['consume_quota']
left_point = res['data']['rest_quota']
try:
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = f"鹰图查询完毕!{use_point}, {left_point},双击可复制所选内容"
for data in res['data']['arr']:
self.tk_tabs.tk_tabs_hunter.tk_table.insert("", END, values=[
data['url'],
data['port'],
str(data['web_title']) if data['web_title'] else "N/A",
data['domain'] if data['domain'] else "N/A",
str(data['status_code']),
data['company'] if data['company'] else "N/A",
data['country'] + data['province'] + data['city'],
data['isp']
])
except TypeError:
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = "没有在鹰图上查询到相关信息"
return
except TimeoutError:
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = "查询FOFA出错!请检查网络及FOFA配置!"
except BaseException as e:
self.tk_tabs.tk_tabs_hunter.tk_label['text'] = f"查询鹰图信息失败!错误信息为:{e}"
return
def __get_weibu(self):
self.tk_tabs.tk_tabs_weibu.tk_label['text'] = f"正在微步上查询{self.target}的相关信息......"
try:
[self.tk_tabs.tk_tabs_weibu.tk_table.delete(item) for item in
self.tk_tabs.tk_tabs_weibu.tk_table.get_children()]
except:
pass
if self.method == "域名":
try:
ip = socket.gethostbyname(self.tk_tabs.tk_tabs_config.weibu_key.get())
except:
self.tk_tabs.tk_tabs_weibu.tk_label['text'] = f"域名解析IP失败,建议从其他结果获取IP后进行查询或前往微步在线查询"
return
else:
ip = self.target
weibu_url = "https://api.threatbook.cn/v3/scene/ip_reputation"
query = {
"apikey": ip,
"resource": self.target,
"lang": "zh"
}
try:
res = post(url=weibu_url, params=query, timeout=5).json()
data = res['data'][self.target]
self.tk_tabs.tk_tabs_weibu.tk_label['text'] = f"微步查询完毕,双击可复制所选内容"
target_judgments = ""
for item in data['judgments']:
target_judgments += item + ","
target_tags = ""
for item in data['tags_classes']:
for tag in item['tags']:
target_tags += tag + ","
self.tk_tabs.tk_tabs_weibu.tk_table.insert("", END, values=[
data['severity'],
target_judgments[:-1],
target_tags[:-1],
data['basic']['carrier'],
data['basic']['location']['country'] + " " + data['basic']['location']['province'] +
data['basic']['location']['city'],
data['scene'],
data['confidence_level']
])
except TimeoutError:
self.tk_tabs.tk_tabs_weibu.tk_label['text'] = "微步查询超时!"
return
except KeyError:
self.tk_tabs.tk_tabs_weibu.tk_label['text'] = f"微步查询失败!可能是每日API请求次数已达上限"
return
def __get_0zone(self):
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = f"正在0zone上查询{self.target}的相关信息......"
try:
[self.tk_tabs.tk_tabs_0zone.tk_table.delete(item) for item in
self.tk_tabs.tk_tabs_0zone.tk_table.get_children()]
except:
pass
url = "https://0.zone/api/data/"
if self.method == "IP":
query = {
"title": f"ip={self.target}",
"title_type": "site",
"page": 1,
"pagesize": 10,
"zone_key_id": f"{self.tk_tabs.tk_tabs_config.zone_key.get()}"
}
else:
query = {
"title": f"url={self.target}",
"title_type": "site",
"page": 1,
"pagesize": 10,
"zone_key_id": f"{self.tk_tabs.tk_tabs_config.zone_key.get()}"
}
try:
data = post(url=url, data=query, timeout=5).json()
if data['code'] == 1:
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = f"查询出错,错误信息为: {data['message']}"
return
if not data['data']:
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = "没有在0zero平台查询到相关信息!"
return
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = "0zone查询完毕,双击可复制所选内容"
for item in data['data']:
self.tk_tabs.tk_tabs_0zone.tk_table.insert("", END, values=[
item["ip"] + ":" + item["port"],
item["url"] if item["url"] else "N/A",
item["title"] if item["title"] else "N/A",
item["os"] if item["os"] else "N/A",
item["component"] if item["component"] else "N/A",
item["operator"] if item["operator"] else "N/A",
item["protocol"] if item["protocol"] else "N/A"
])
except TimeoutError:
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = "查询0zone信息超时"
return
except BaseException as e:
self.tk_tabs.tk_tabs_0zone.tk_label['text'] = f"查询0zone信息失败!错误信息为:{e}"
return
def __get_shodan(self):
self.tk_tabs.tk_tabs_shodan.tk_label['text'] = f"正在shodan上查询{self.target}的相关信息......"
try:
[self.tk_tabs.tk_tabs_shodan.tk_table.delete(item) for item in
self.tk_tabs.tk_tabs_shodan.tk_table.get_children()]
except:
pass
url = f"https://api.shodan.io/shodan/host/{self.target}?key={self.tk_tabs.tk_tabs_config.shodan_key.get()}"
try:
data = get(url, timeout=5).json()
if 'error' in data:
self.tk_tabs.tk_tabs_shodan.tk_label['text'] = f"没有在shodan上查询到 {self.target} 的相关信息"
else:
# ip
try:
ip = data['ip_str']
except:
ip = "N/A"
# 端口
try:
target_port = ""
for item in data['ports']:
target_port += str(item) + "、"
except:
target_port = "N/A"
try:
target_isp = data['isp']
except:
target_isp = "N/A"
try:
for host in data['domains']:
for domain in data['hostnames']:
self.tk_tabs.tk_tabs_shodan.tk_table.insert("", END,
values=[ip, target_port[:-1], host, domain,
target_isp])
except:
self.tk_tabs.tk_tabs_shodan.tk_table.insert("", END,
values=[ip, target_port[:-1], "N/A", "N/A", target_isp])
self.tk_tabs.tk_tabs_shodan.tk_label['text'] = "shodan查询完毕,双击可复制所选内容"
except TimeoutError:
self.tk_tabs.tk_tabs_shodan.tk_label['text'] = "查询shodan信息超时!"
return
except BaseException as e:
self.tk_tabs.tk_tabs_shodan.tk_label['text'] = f"查询shodan信息失败!错误信息为:{e}"
return
def __get_zoomeye(self):
self.tk_tabs.tk_tabs_zoomeye.tk_label['text'] = f"正在zoomeye上查询{self.target}的相关信息......"
try:
[self.tk_tabs.tk_tabs_zoomeye.tk_table.delete(item) for item in
self.tk_tabs.tk_tabs_zoomeye.tk_table.get_children()]
except:
pass
url = "https://api.zoomeye.org/host/search?query=%s" % self.target
headers = {
"API-KEY": self.tk_tabs.tk_tabs_config.zoomeye_key.get()
}
try:
data = get(url=url, headers=headers, timeout=5).json()
if data['total'] != 0:
for item in data['matches']:
self.tk_tabs.tk_tabs_zoomeye.tk_table.insert("", END, values=[
item['ip'],
str(item['portinfo']['port']) if item['portinfo']['port'] else "",
item['portinfo']['app'] if item['portinfo']['app'] else "",
item['portinfo']['title'][0] if item['portinfo']['title'] is not None else "",
item['portinfo']['service'] if item['portinfo']['service'] else "",
])
self.tk_tabs.tk_tabs_zoomeye.tk_label['text'] = "zoomeye查询完毕,双击可复制所选内容"
else:
self.tk_tabs.tk_tabs_zoomeye.tk_label['text'] = f"没有在zoomeye上查询到 {self.target} 的相关信息"
except TimeoutError:
self.tk_tabs.tk_tabs_zoomeye.tk_label['text'] = "查询zoomeye信息超时!"
return
except BaseException as e:
self.tk_tabs.tk_tabs_zoomeye.tk_label['text'] = f"查询zoomeye信息失败!错误信息为:{e}"
return
def __save_config(self):
if not cfg.has_section('fofa'):
cfg.add_section('fofa')
cfg.set('fofa', 'mail', self.tk_tabs.tk_tabs_config.tk_label_frame_fofa.tk_input_fofa_mail.get())
cfg.set('fofa', 'apikey', self.tk_tabs.tk_tabs_config.tk_label_frame_fofa.tk_input_fofa_key.get())
if not cfg.has_section('hunter'):
cfg.add_section('hunter')
cfg.set('hunter', 'username', self.tk_tabs.tk_tabs_config.tk_label_frame_hunter.tk_input_hunter_username.get())
cfg.set('hunter', 'apikey', self.tk_tabs.tk_tabs_config.tk_label_frame_hunter.tk_input_hunter_key.get())
if not cfg.has_section('weibu'):
cfg.add_section('weibu')
cfg.set('weibu', 'apikey', self.tk_tabs.tk_tabs_config.tk_label_frame_weibu.tk_input_weibu_key.get())
if not cfg.has_section('0zone'):
cfg.add_section('0zone')
cfg.set('0zone', 'apikey', self.tk_tabs.tk_tabs_config.tk_label_frame_0zone.tk_input_0zone_key.get())
if not cfg.has_section('shodan'):
cfg.add_section('shodan')
cfg.set('shodan', 'apikey', self.tk_tabs.tk_tabs_config.tk_label_frame_shodan.tk_input_shodan_key.get())
if not cfg.has_section('zoomeye'):
cfg.add_section('zoomeye')
cfg.set('zoomeye', 'apikey', self.tk_tabs.tk_tabs_config.tk_label_frame_zoomeye.tk_input_zoomeye_key.get())
cfg.write(open("config.ini", 'w'))
# 结果页,主要的显示区域
class Tabs_results(Notebook):
def __init__(self, parent):
super().__init__(parent)
self.__frame()
def __frame(self):
self.tk_tabs_hunter = Frame_results(self, attribute={'url': 250, '端口': 50, "网页标题": 150, '域名': 200, '状态码': 60,
"备案主体": 70, '归属地': 60, "运营商": 100})
self.add(self.tk_tabs_hunter, text="鹰图")
self.tk_tabs_fofa = Frame_results(self, attribute={'host': 250, 'ip': 150, '标题': 150, '地理位置': 150, 'ICP备案号': 150, '协议': 50})
self.add(self.tk_tabs_fofa, text="FOFA")
self.tk_tabs_weibu = Frame_results(self,
attribute={'威胁等级': 70, 'IP类型判断': 230, '威胁类型': 120, '运营商': 120, '地理位置': 120,
"场景": 120, "情报可信度": 120})
self.add(self.tk_tabs_weibu, text="微步")
self.tk_tabs_0zone = Frame_results(self, attribute={'host': 200, 'url': 250, '网页标题': 230, '操作系统': 70, '服务器': 60,
"运营商": 70, "协议": 60})
# 0zone目前会员API已不可用,计划更新为Quake API
self.add(self.tk_tabs_0zone, text="0zone")
self.tk_tabs_shodan = Frame_results(self,
attribute={'IP': 100, '开放的端口': 150, '域名': 150, '子域名': 200, '运营商': 320})
self.add(self.tk_tabs_shodan, text="shodan")
self.tk_tabs_zoomeye = Frame_results(self,
attribute={'IP': 100, '端口': 50, '服务标题': 250, '应用': 250, '协议': 250, })
self.add(self.tk_tabs_zoomeye, text="zoomeye")
self.tk_tabs_config = Frame_config(self)
self.add(self.tk_tabs_config, text="配置页")
self.place(x=10, y=40, width=980, height=500)
# 单个结果页的frame-fofa
class Frame_results(Frame):
def __init__(self, parent, attribute: dict):
super().__init__(parent)
self.attribute = attribute
self.__frame()
self.tk_label = self.__tk_label()
self.tk_table = self.__tk_table()
def __frame(self):
self.place(x=10, y=40, width=960, height=480)
def __tk_label(self):
label = Label(
self,
borderwidth=3,
relief="sunken",
font=('微软雅黑', 15, 'bold'),
anchor="n"
)
label.place(x=10, y=10, width=958, height=30)
label.bind('<Double-1>', self.__get_value_label)
return label
def __tk_table(self):
y_scroll = Scrollbar(
self,
orient=VERTICAL,
)
table = Treeview(
self,
show="headings",
columns=list(self.attribute),
yscrollcommand=y_scroll.set,
padding=5,
)
for text, width in self.attribute.items(): # 批量设置列属性
table.heading(text, text=text, anchor='w')
table.column(text, anchor='w', width=width, stretch=False) # stretch 不自动拉伸
y_scroll.config(command=table.yview)
y_scroll.pack(side=RIGHT, fill=Y)
table.place(x=10, y=40, width=950, height=420)
table.bind('<Double-1>', self.__get_value_table)
return table
def __get_value_table(self, event):
root.clipboard_clear()
selections = self.tk_table.selection()
values = {}
try:
for row in selections:
values = self.tk_table.item(row, 'values')
column = self.tk_table.identify_column(event.x)
root.clipboard_append(values[int(column.replace("#", "")) - 1])
self.tk_label['text'] = f'{values[int(column.replace("#", "")) - 1]}复制成功!' if values[int(column.replace("#",
"")) - 1] != "" else "啥都没有哦"
except:
return
def __get_value_label(self, event):
try:
print(event)
root.clipboard_clear()
root.clipboard_append(self.tk_label['text'])
except:
return
# 配置页的总frame
class Frame_config(Frame):
def __init__(self, parent):
super().__init__(parent)
self.__frame()
self.__check_config()
self.tk_label_frame_fofa = Frame_config_fofa(self, self.fofa_mail, self.fofa_key)
self.tk_label_frame_hunter = Frame_config_hunter(self, self.hunter_username, self.hunter_key)
self.tk_label_frame_weibu = Frame_config_weibu(self, self.weibu_key)
self.tk_label_frame_0zone = Frame_config_0zone(self, self.zone_key)
self.tk_label_frame_shodan = Frame_config_shodan(self, self.shodan_key)
self.tk_label_frame_zoomeye = Frame_config_zoomeye(self, self.zoomeye_key)
self.__self_label_tips()
def __frame(self):
self.configure()
self.place(x=10, y=40, width=985, height=480)
def __self_label_tips(self):
label = Label(self, anchor="nw", wraplength=280, justify="left", font=('微软雅黑', 13, 'bold'), text="""
fofa APIKEY获取地址:https://fofa.info/personalData\n\n\n\n
鹰图APIKEY获取地址:https://hunter.qianxin.com/home/userInfo\n\n\n\n
微步APIKEY获取地址:https://x.threatbook.cn/v5/myApi\n\n
0zero APIKEY获取地址:https://0.zone/applyParticulars?type=site\n\n
shodan APIKEY获取地址:https://account.shodan.io/\n\n
zoomeye APIKEY获取地址:https://www.zoomeye.org/profile\n
""")
label.place(x=680, y=10, width=295, height=450)
def __check_config(self):
read_ok = cfg.read('cconfig.ini', encoding='utf-8')
if not read_ok:
showinfo(title="info",
message=f"未在当前目录检测到config.ini,请在config页进行配置,进行一次查询后会将配置保存到当前目录的config.ini,之后即可自动读取配置")
self.fofa_mail = StringVar(value="")
self.fofa_key = StringVar(value="")
self.hunter_username = StringVar(value="")
self.hunter_key = StringVar(value="")
self.weibu_key = StringVar(value="")
self.zone_key = StringVar(value="")
self.shodan_key = StringVar(value="")
self.zoomeye_key = StringVar(value="")
else:
# fofa配置
# mail
try:
self.fofa_mail = StringVar(value=cfg['fofa']['mail'])
except KeyError:
self.fofa_mail = StringVar(value="")
# apikey
try:
self.fofa_key = StringVar(value=cfg['fofa']['apikey'])
except KeyError:
self.fofa_key = StringVar(value="")
# hunter配置
# username
try:
self.hunter_username = StringVar(value=cfg['hunter']['username'])
except KeyError:
self.hunter_username = StringVar(value="")
# apikey
try:
self.hunter_key = StringVar(value=cfg['hunter']['apikey'])
except KeyError:
self.hunter_key = StringVar(value="")
# 微步配置
try:
self.weibu_key = StringVar(value=cfg['weibu']['apikey'])
except KeyError:
self.weibu_key = StringVar(value="")
# 0zone
try:
self.zone_key = StringVar(value=cfg['0zone']['apikey'])
except KeyError:
self.zone_key = StringVar(value="")
# shodan
try:
self.shodan_key = StringVar(value=cfg['shodan']['apikey'])
except KeyError:
self.shodan_key = StringVar(value="")
# zoomeye
try:
self.zoomeye_key = StringVar(value=cfg['zoomeye']['apikey'])
except KeyError:
self.zoomeye_key = StringVar(value="")
# 配置页的fofa frame
class Frame_config_fofa(LabelFrame):
def __init__(self, parent, fofa_mail, fofa_key):
super().__init__(parent)
self.fofa_key = fofa_key
self.fofa_mail = fofa_mail
self.__frame()
self.tk_input_fofa_mail = self.__tk_input_fofa_mail()
self.tk_input_fofa_key = self.__tk_input_fofa_key()
self.tk_label_fofa_mail = self.__tk_label_fofa_mail()
self.tk_label_fofa_key = self.__tk_label_fofa_key()
def __frame(self):
self.configure(text="fofa")
self.place(x=10, y=10, width=655, height=90)
def __tk_input_fofa_mail(self):
ipt = Entry(self, textvariable=self.fofa_mail)
ipt.place(x=80, y=0, width=560, height=30)
return ipt
def __tk_input_fofa_key(self):
ipt = Entry(self, textvariable=self.fofa_key)
ipt.place(x=80, y=35, width=560, height=30)
return ipt
def __tk_label_fofa_mail(self):
label = Label(self, text="邮箱")
label.place(x=10, y=0, width=70, height=30)
return label
def __tk_label_fofa_key(self):
label = Label(self, text="APIKEY")
label.place(x=10, y=35, width=70, height=30)
return label
# 配置页的鹰图frame
class Frame_config_hunter(LabelFrame):
def __init__(self, parent, hunter_username, hunter_key):
super().__init__(parent)
self.hunter_key = hunter_key
self.hunter_username = hunter_username
self.__frame()
self.tk_input_hunter_username = self.__tk_input_hunter_username()
self.tk_input_hunter_key = self.__tk_input_hunter_key()
self.tk_label_hunter_username = self.__tk_label_hunter_username()
self.tk_label_hunter_key = self.__tk_label_hunter_key()
def __frame(self):
self.configure(text="鹰图")
self.place(x=10, y=110, width=655, height=90)
def __tk_input_hunter_username(self):
ipt = Entry(self, textvariable=self.hunter_username)
ipt.place(x=80, y=0, width=560, height=30)
return ipt
def __tk_input_hunter_key(self):
ipt = Entry(self, textvariable=self.hunter_key)
ipt.place(x=80, y=35, width=560, height=30)
return ipt
def __tk_label_hunter_username(self):
label = Label(self, text="用户名")
label.place(x=10, y=0, width=70, height=30)
return label
def __tk_label_hunter_key(self):
label = Label(self, text="APIKEY")
label.place(x=10, y=35, width=70, height=30)
return label
# 配置页的微步frame
class Frame_config_weibu(LabelFrame):
def __init__(self, parent, weibu_key):
super().__init__(parent)
self.weibu_key = weibu_key
self.__frame()
self.tk_input_weibu_key = self.__tk_input_weibu_key()
self.tk_label_weibu_key = self.__tk_label_weibu_key()
def __frame(self):
self.configure(text="微步")
self.place(x=10, y=210, width=655, height=55)
def __tk_input_weibu_key(self):
ipt = Entry(self, textvariable=self.weibu_key)
ipt.place(x=80, y=0, width=560, height=30)
return ipt
def __tk_label_weibu_key(self):
label = Label(self, text="APIKEY")
label.place(x=10, y=0, width=70, height=30)
return label
# 配置页的0zone frame
class Frame_config_0zone(LabelFrame):
def __init__(self, parent, zone_key):
super().__init__(parent)
self.zone_key = zone_key
self.__frame()
self.tk_input_0zone_key = self.__tk_input_0zone_key()
self.tk_label_0zone_key = self.__tk_label_0zone_key()
def __frame(self):
self.configure(text="0zone")
self.place(x=10, y=275, width=655, height=55)
def __tk_input_0zone_key(self):
ipt = Entry(self, textvariable=self.zone_key)
ipt.place(x=80, y=0, width=560, height=30)
return ipt
def __tk_label_0zone_key(self):
label = Label(self, text="APIKEY")
label.place(x=10, y=0, width=70, height=30)
return label
# 配置页的shodan frame
class Frame_config_shodan(LabelFrame):
def __init__(self, parent, shodan_key):
super().__init__(parent)
self.shodan_key = shodan_key
self.__frame()
self.tk_input_shodan_key = self.__tk_input_shodan_key()
self.tk_label_shodan_key = self.__tk_label_shodan_key()
def __frame(self):
self.configure(text="shodan")
self.place(x=10, y=340, width=655, height=55)
def __tk_input_shodan_key(self):
ipt = Entry(self, textvariable=self.shodan_key)
ipt.place(x=80, y=0, width=560, height=30)
return ipt
def __tk_label_shodan_key(self):
label = Label(self, text="APIKEY")
label.place(x=10, y=0, width=70, height=30)
return label
# 配置页的zoomeye frame
class Frame_config_zoomeye(LabelFrame):
def __init__(self, parent, zoomeye_key):
super().__init__(parent)
self.zoomeye_key = zoomeye_key
self.__frame()
self.tk_input_zoomeye_key = self.__tk_input_zoomeye_key()
self.tk_label_zoomeye_key = self.__tk_label_zoomeye_key()
def __frame(self):
self.configure(text="zoomeye")
self.place(x=10, y=405, width=655, height=55)
def __tk_input_zoomeye_key(self):
ipt = Entry(self, textvariable=self.zoomeye_key)
ipt.place(x=80, y=0, width=560, height=30)
return ipt
def __tk_label_zoomeye_key(self):
label = Label(self, text="APIKEY")
label.place(x=10, y=0, width=70, height=30)
return label
class Win(WinGUI):
def __init__(self):
super().__init__()
self.__event_bind()
def __event_bind(self):
pass
if __name__ == "__main__":
root = Win()
root.mainloop()