-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathscan_main_web.py
executable file
·6044 lines (5409 loc) · 270 KB
/
scan_main_web.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
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Description:[主系统]
# Author:[huan666]
# Date:[2023/11/15]
# update:[2024/9/23]
from flask import Flask, render_template,request
from flask import session
from flask import redirect
from flask_bootstrap import Bootstrap
from flask import send_file
import basic
import subprocess
import os
import re
from flask import jsonify
import report_total
import pandas as pd
from basic import root_domain_scan
#主系统账号密码配置导入
from config import main_username
from config import main_password
# 重点资产数量规则
from config import Shiro_rule
from config import SpringBoot_rule
from config import weblogic_rule
from config import baota_rule
from config import ruoyi_rule
from config import struts2_rule
from config import WordPress_rule
from config import jboss_rule
from config import phpMyAdmin_rule
from config import ThinkPHP_rule
from config import nacos_rule
from config import fanwei_rule
from config import tomcat_rule
from config import finger_list
from config import rule_options
from config import dict
from basic import select_rule
import psutil
import pymysql
# 导入时间模块
import time
import datetime
# 扫面时间差控制
from config import info_time_controls
from config import vuln_time_controls
# 弱口令扫描字典
from config import mysql_dict_user_dir
from config import mysql_dict_pass_dir
from config import ssh_dict_user_dir
from config import ssh_dict_pass_dir
from config import ftp_dict_user_dir
from config import ftp_dict_pass_dir
from config import redis_dict_pass_dir
from config import mssql_dict_user_dir
from config import mssql_dict_pass_dir
from config import tomcat_user_dir
from config import tomcat_pass_dir
from config import nacos_user_dir
from config import nacos_pass_dir
from config import bcrypt_dict
from config import bcrypt_passwd
# 统计列表元素出现次数
from collections import Counter
# 统计第三方接口查询次数
from config import fofa_max_num
from config import otx_max_num
from config import amap_max_num
from config import crt_max_num
from config import shodan_max_num
from config import icp_max_num
# 多线程操作模块
import threading
# 删除漏洞扫描报告二次验证
from config import recheck_username
from config import recheck_password
from config_session import PERMANENT_SESSION_LIFETIME
from config import assetverification
import json
# 校验是否先进行指纹识别
from config import verification_fingerprint_recognition
import shodan
app = Flask(__name__,template_folder='./templates')
app.config.from_pyfile('config_session.py')
app.secret_key = "DragonFire"
bootstrap = Bootstrap(app)
# 执行任何请求之前先执行此函数
@app.before_request
def before_request():
# 在每个请求之前调用,更新session的过期时间
session.permanent = True
app.permanent_session_lifetime = PERMANENT_SESSION_LIFETIME
#IP基础信息查询
@app.route("/ipscaninterface/",methods=['post'])
def ipscaninterface():
user = session.get('username')
if str(user) == main_username:
ip = request.form['ip']
#状态码为200的url
try:
data1=basic.status_scan(ip)
except:
pass
#状态码为200的url指纹信息
try:
data3 = basic.finger_scan(ip)
except:
pass
#icp备案信息-列表返回
try:
# data4 = basic.icp_info(ip)
data4_1 = basic.icp_info_new(ip)
if data4_1 == ['']:
data4 = basic.icp_info(ip)
else:
data4 = data4_1
# print(len(data4))
# print(data4)
except:
pass
#公司位置信息
gd_inter_num_success = basic.total_port_success_num(5)
gd_inter_num_fail = basic.total_port_fail_num(5)
amap_total = int(gd_inter_num_success) + int(gd_inter_num_fail)
if amap_total > int(amap_max_num):
companylocation = ["高德地图接口次数已超过额度"+str(amap_max_num)+"次,无法继续查询,请后台修改额度继续查询"]
else:
try:
# 判断传递过来的公司名称是否有效
company_name = data4[0]
if company_name == "ICP备案接口正在更新维护中":
companylocation = ["未获取到公司名称,无法查询地理位置信息"]
else:
companylocation = basic.amapscan(data4)
basic.success_third_party_port_addone(5)
except:
companylocation = "接口异常"
basic.fail_third_party_port_addone(5)
#ip归属地
try:
output = subprocess.check_output(["sh", "./finger.sh","location",ip], stderr=subprocess.STDOUT)
output_list = output.decode().splitlines()
#定义列表
location_list = []
for ii in output_list:
if "地址" in ii:
location_list.append(ii)
localtion_list_1 = location_list[0].replace("地址","")
localtion_list_result = localtion_list_1.replace(":","")
except:
localtion_list_result = "接口异常"
#端口信息
try:
port = basic.shodan_api(ip)
basic.success_third_party_port_addone(1)
basic.success_third_party_port_addone(2)
except:
basic.fail_third_party_port_addone(1)
basic.fail_third_party_port_addone(2)
#历史域名
try:
history_domain = basic.domain_scan(ip)
except:
history_domain=["接口异常"]
#操作系统识别
try:
os_type = os.popen('bash /TIP/info_scan/finger.sh osscan'+' '+ip).read()
except:
pass
try:
#去掉https://或者http://
urls_list_1 = [re.sub(r'http://|https://', '', url) for url in data1]
except:
pass
# 存活域名列表
try:
urls_list = []
for aa in urls_list_1:
if "cn" in aa or "com" in aa or "xyz" in aa or "top" in aa:
urls_list.append(aa)
except:
pass
#定义存放cdn结果列表
cdn_list = []
#定义存放子域名的列表
subdomain_list_1 = []
urls_list_root = root_domain_scan(urls_list)
for bb in urls_list:
#cdn存放结果
cdn_result = basic.cdnscan(bb)
cdn_list.append(cdn_result)
for ab in urls_list_root:
#子域名存放列表
subdomain_result = basic.subdomain_scan(ab)
subdomain_list_1.append(subdomain_result)
try:
flattened_list = [item for sublist in subdomain_list_1 for item in sublist]
except:
pass
#CDN列表为空判断
if len(cdn_list) == 0:
cdn_list.append("None")
#子域名列表去重
subdomain_list = list(set(flattened_list))
if len(subdomain_list) ==0:
subdomain_list.append("None")
#网站标题
try:
site_title_list_result = basic.title_scan(data1)
except:
pass
#IP属性判断
try:
ipstatus = basic.ipstatus_scan(ip)
except:
pass
return render_template('index.html',data1=data1,data2=ip,data3=data3,data4=data4
,data5=localtion_list_result,data6=port,data7=history_domain,data8=os_type,data9=cdn_list
,data10=site_title_list_result,data11=subdomain_list,data12=ipstatus,data13=companylocation,data20=str(user))
else:
return render_template('login.html')
#跳转首页
@app.route("/index/")
def index():
user = session.get('username')
if str(user) == main_username:
# asset_file_list = basic.list_files_in_directory()
asset_file_list = basic.fofa_grammar_lib()
session_time = basic.select_session_time_lib(1)
return render_template('index.html',data20=str(user),data21=asset_file_list,data22=str(session_time))
else:
return render_template('login.html')
#主系统登录实现
@app.route('/logininterface/',methods=['post'])
def logininterface():
username = request.form['username']
password = request.form['password']
# 登录判断
if str(username) == str(main_username) and str(password) == str(main_password):
session['username'] = username
# session.permanent = True # 确保会话是永久的
login_status = "账号密码正确确认登录系统吗?"
redirecturl = '/index/'
elif str(username) == str(main_username) and str(password) != str(main_password):
login_status = "密码错误"
redirecturl = '/loginpage/'
elif str(username) != str(main_username) and str(password) == str(main_password):
login_status = "账号不存在"
redirecturl = '/loginpage/'
else:
login_status = "登录失败"
redirecturl = '/loginpage/'
message_json = {
'loginstatus':login_status,
'redirect_url':redirecturl,
'nologin':'/loginpage/'
}
return jsonify(message_json)
#历史URL预览
@app.route("/previewhistoryurl/")
def previewhistoryurl():
user = session.get('username')
if str(user) == main_username:
otx_his_num = os.popen('bash /TIP/info_scan/finger.sh otx_history_url_num').read()
otx_domain_url_shell_status = os.popen('bash /TIP/info_scan/finger.sh otx_domain_url_shell_status').read()
if "running" in otx_domain_url_shell_status:
lines = ["正在扫描中......"]
else:
if int(otx_his_num) == 0:
lines = ["未发现漏洞"]
else:
lines = []
with open('/TIP/info_scan/result/otxhistoryurl.txt', 'r') as f:
for line in f:
lines.append(line.strip())
return '<br>'.join(lines)
else:
return render_template('login.html')
#nmap接口预览
@app.route("/nmapresultshow/")
def nmapresultshow():
user = session.get('username')
if str(user) == main_username:
nmap_num = os.popen('bash /TIP/info_scan/finger.sh nmap_scan_num').read()
nmapstatus =os.popen('bash /TIP/info_scan/finger.sh nmapstatus').read()
if "running" in nmapstatus:
lines = ["正在扫描中......"]
else:
if int(nmap_num) == 0:
lines = ["未发现漏洞"]
else:
lines = []
with open('./result/nmap.txt', 'r') as f:
for line in f:
lines.append(line.strip())
return '<br>'.join(lines)
else:
return render_template('login.html')
#nuclei结果预览
@app.route("/nucleiresultshow/")
def nucleiresultshow():
user = session.get('username')
if str(user) == main_username:
nuclei_num = os.popen('bash /TIP/info_scan/finger.sh nuclei_scan_num').read()
nucleistatus =os.popen('bash /TIP/info_scan/finger.sh nucleistatus').read()
if "running" in nucleistatus:
liness = ["正在扫描中......"]
else:
if int(nuclei_num) == 0:
liness = ["未发现漏洞"]
else:
lines = []
with open('./result/nucleiresult.txt', 'r') as f:
for line in f:
lines.append(line.strip())
#文件结果优化展示
liness = []
for line1 in lines:
#页面显示优化
pattern = re.compile(r'\x1b\[[0-9;]*m')
clean_text = pattern.sub('', line1)
liness.append(clean_text)
return '<br>'.join(liness)
else:
return render_template('login.html')
#前端文本框添加URL后端接口
@app.route('/submit_data/', methods=['POST'])
def submit_data():
user = session.get('username')
if str(user) == main_username:
# 筛选后资产时间线更新
basic.assets_status_update('手工录入资产完成')
data = request.json.get('lines', [])
if '' in data:
result_rule = "输入参数不能为空"
if ' ' in data:
result_rule = "输入参数不能包含空格"
if 'alert' in data or 'select' in data or '<' in data or '>' in data or 'union' in data:
result_rule = "请勿进行安全测试!"
else:
# 2024.8.2更新 校验非URL资产
result_rule = ""
if int(assetverification) == 1:
for ii in data:
if "http://" not in ii and "https://" not in ii:
result_rule = "请勿输入非URL字段!"
break
if not result_rule:
# 列表中数据存入文件中
f = open(file='/TIP/batch_scan_domain/url.txt',mode='w')
for line in data:
f.write(str(line)+"\n")
f.close()
# 存入资产项目管理目录,前端通过下拉列表查看资产,以当前时间戳命名文件名
# 获取当前时间
now = datetime.datetime.now()
# 获取年月日时分秒,并确保月份和日期有两位数字
year = str(now.year)
month = now.month if now.month > 9 else f"0{now.month}"
day = now.day if now.day > 9 else f"0{now.day}"
hour = now.hour if now.hour > 9 else f"0{now.hour}"
minute = now.minute if now.minute > 9 else f"0{now.minute}"
second = now.second if now.second > 9 else f"0{now.second}"
# 构建文件名
file_name = f"{year}/{month}/{day}{hour}:{minute}:{second}.txt"
file_name_result = f"/TIP/info_scan/result/assetmanager/{file_name}"
# 确保目录存在
os.makedirs(os.path.dirname(file_name_result), exist_ok=True)
# 打开文件并写入数据
with open(file=file_name_result, mode='w') as f21:
for line21 in data:
f21.write(str(line21) + "\n")
file_line = os.popen('bash /TIP/info_scan/finger.sh textarea_url_num').read()
result_rule = "已成功添加"+str(file_line)+"条资产"
#资产备份
os.popen('cp /TIP/batch_scan_domain/url.txt /TIP/batch_scan_domain/url_back.txt')
message_json = {
"file_line":result_rule
}
return jsonify(message_json)
else:
return render_template('login.html')
#系统管理
@app.route("/systemmanagement/")
def systemmanagement():
user = session.get('username')
if str(user) == main_username:
# 扫描器运行状态,运行显示绿色,停止显示红色
nmapstatus =os.popen('bash /TIP/info_scan/finger.sh nmapstatus').read()
if "running" in nmapstatus:
nmapstatus1 = nmapstatus
nmapstatus2 = ""
nmapcontime = "计算中:"
else:
nmapstatus1 = ""
nmapstatus2 = nmapstatus
nmapcontime = basic.scan_end_start_time(1)
subfinder_status = os.popen('bash /TIP/info_scan/finger.sh subfinder_status').read()
if "running" in subfinder_status:
subfinder_status1 = subfinder_status
subfinder_status2 = ""
subfindercontime = "计算中"
else:
subfinder_status1 = ""
subfinder_status2 = subfinder_status
subfindercontime = basic.scan_end_start_time(31)
redis_status = os.popen('bash /TIP/info_scan/finger.sh redis_vuln_scan_status').read()
if "running" in redis_status:
redis_status1 = redis_status
redis_status2 = ""
rediscontime = "计算中"
else:
redis_status1 = ""
redis_status2 = redis_status
rediscontime = basic.scan_end_start_time(32)
shodanstatus = os.popen('bash /TIP/info_scan/finger.sh shodanassetstatus').read()
shodankeyvalue = basic.select_session_time_lib(3)
apis = shodan.Shodan(shodankeyvalue)
account_info = apis.info()
account_info_num = str(account_info['query_credits'])
total_account_info_num = str(account_info['scan_credits'])
if "running" in shodanstatus:
shodanstatus1 = shodanstatus
shodanstatus2 = ""
else:
shodanstatus1 = ""
shodanstatus2 = shodanstatus
mongodb_status = os.popen('bash /TIP/info_scan/finger.sh mongodb_vuln_scan_status').read()
if "running" in mongodb_status:
mongodb_status1 = mongodb_status
mongodb_status2 = ""
mongodbcontime = "计算中"
else:
mongodb_status1 = ""
mongodb_status2 = mongodb_status
mongodbcontime = basic.scan_end_start_time(33)
memcached_status = os.popen('bash /TIP/info_scan/finger.sh memcached_vuln_scan_status').read()
if "running" in memcached_status:
memcached_status1 = memcached_status
memcached_status2 = ""
memcachedcontime = "计算中"
else:
memcached_status1 = ""
memcached_status2 = memcached_status
memcachedcontime = basic.scan_end_start_time(34)
zookeeper_status = os.popen('bash /TIP/info_scan/finger.sh zookeeper_vuln_scan_status').read()
if "running" in zookeeper_status:
zookeeper_status1 = zookeeper_status
zookeeper_status2 = ""
zookeepercontime = "计算中"
else:
zookeeper_status1 = ""
zookeeper_status2 = zookeeper_status
zookeepercontime = basic.scan_end_start_time(35)
ftp_status = os.popen('bash /TIP/info_scan/finger.sh ftp_vuln_scan_status').read()
if "running" in ftp_status:
ftp_status1 = ftp_status
ftp_status2 = ""
ftpcontime = "计算中"
else:
ftp_status1 = ""
ftp_status2 = ftp_status
ftpcontime = basic.scan_end_start_time(36)
couchdb_status = os.popen('bash /TIP/info_scan/finger.sh couchdb_vuln_scan_status').read()
if "running" in couchdb_status:
couchdb_status1 = couchdb_status
couchdb_status2 = ""
couchdbcontime = "计算中"
else:
couchdb_status1 = ""
couchdb_status2 = couchdb_status
couchdbcontime = basic.scan_end_start_time(37)
docker_status = os.popen('bash /TIP/info_scan/finger.sh docker_vuln_scan_status').read()
if "running" in docker_status:
docker_status1 = docker_status
docker_status2 = ""
dockercontime = "计算中"
else:
docker_status1 = ""
docker_status2 = docker_status
dockercontime = basic.scan_end_start_time(38)
hadoop_status = os.popen('bash /TIP/info_scan/finger.sh hadoop_vuln_scan_status').read()
if "running" in hadoop_status:
hadoop_status1 = hadoop_status
hadoop_status2 = ""
hadoopcontime = "计算中"
else:
hadoop_status1 = ""
hadoop_status2 = hadoop_status
hadoopcontime = basic.scan_end_start_time(39)
nfs_status = os.popen('bash /TIP/info_scan/finger.sh nfs_vuln_scan_status').read()
if "running" in nfs_status:
nfs_status1 = nfs_status
nfs_status2 = ""
nfscontime = "计算中"
else:
nfs_status1 = ""
nfs_status2 = nfs_status
nfscontime = basic.scan_end_start_time(40)
rsync_status = os.popen('bash /TIP/info_scan/finger.sh rsync_vuln_scan_status').read()
if "running" in rsync_status:
rsync_status1 = rsync_status
rsync_status2 = ""
rsynccontime = "计算中"
else:
rsync_status1 = ""
rsync_status2 = rsync_status
rsynccontime = basic.scan_end_start_time(41)
unes1_status = os.popen('bash /TIP/info_scan/finger.sh elasticsearch_vuln_scan_status').read()
if "running" in unes1_status:
unes1_status1 = unes1_status
unes1_status2 = ""
unes1contime = "计算中"
else:
unes1_status1 = ""
unes1_status2 = unes1_status
unes1contime = basic.scan_end_start_time(42)
bcrypt_status = os.popen('bash /TIP/info_scan/finger.sh bcrypt_scan_status').read()
if "running" in bcrypt_status:
bcrypt_status1 = bcrypt_status
bcrypt_status2 = ""
bcryptcontime = "计算中"
else:
bcrypt_status1 = ""
bcrypt_status2 = bcrypt_status
bcryptcontime = basic.scan_end_start_time(43)
cdn_status = os.popen('bash /TIP/info_scan/finger.sh cdn_status').read()
if "running" in cdn_status:
cdn_status1 = cdn_status
cdn_status2 = ""
else:
cdn_status1 = ""
cdn_status2 = cdn_status
nucleistatus =os.popen('bash /TIP/info_scan/finger.sh nucleistatus').read()
if "running" in nucleistatus:
nucleistatus1 = nucleistatus
nucleistatus2 = ""
nucleicontime = "计算中:"
else:
nucleistatus1 = ""
nucleistatus2 = nucleistatus
nucleicontime = basic.scan_end_start_time(23)
xraystatus = os.popen('bash /TIP/info_scan/finger.sh xraystatus').read()
if "running" in xraystatus:
xraystatus1 = xraystatus
xraystatus2 = ""
xraycontime = "计算中:"
else:
xraystatus1 = ""
xraystatus2 = xraystatus
xraycontime = basic.scan_end_start_time(26)
radstatus =os.popen('bash /TIP/info_scan/finger.sh radstatus').read()
if "running" in radstatus:
radstatus1 = radstatus
radstatus2 = ""
else:
radstatus1 = ""
radstatus2 = radstatus
dirscanstatus = os.popen('bash /TIP/info_scan/finger.sh dirsearchstatus').read()
if "running" in dirscanstatus:
dirscanstatus1 = dirscanstatus
dirscanstatus2 = ""
else:
dirscanstatus1 = ""
dirscanstatus2 = dirscanstatus
weblogicstatus = os.popen('bash /TIP/info_scan/finger.sh weblogic_status').read()
if "running" in weblogicstatus:
weblogicstatus1 = weblogicstatus
weblogicstatus2 = ""
weblogiccontime = "计算中:"
else:
weblogicstatus1 = ""
weblogicstatus2 = weblogicstatus
weblogiccontime = basic.scan_end_start_time(10)
struts2status = os.popen('bash /TIP/info_scan/finger.sh struts2_status').read()
if "running" in struts2status:
struts2status1 = struts2status
struts2status2 = ""
struts2contime = "计算中:"
else:
struts2status1 = ""
struts2status2 = struts2status
struts2contime = basic.scan_end_start_time(9)
bbscanstatus = os.popen('bash /TIP/info_scan/finger.sh bbscan_status').read()
if "running" in bbscanstatus:
bbscanstatus1 = bbscanstatus
bbscanstatus2 = ""
bbscancontime = "计算中:"
else:
bbscanstatus1 = ""
bbscanstatus2 = bbscanstatus
bbscancontime = basic.scan_end_start_time(3)
vulmapscanstatus = os.popen('bash /TIP/info_scan/finger.sh vulmapscan_status').read()
if "running" in vulmapscanstatus:
vulmapscanstatus1 = vulmapscanstatus
vulmapscanstatus2 = ""
vulmapcontime = "计算中:"
else:
vulmapscanstatus1 = ""
vulmapscanstatus2 = vulmapscanstatus
vulmapcontime = basic.scan_end_start_time(22)
afrogscanstatus = os.popen('bash /TIP/info_scan/finger.sh afrogscan_status').read()
if "running" in afrogscanstatus:
afrogscanstatus1 = afrogscanstatus
afrogscanstatus2 = ""
afrogcontime = "计算中:"
else:
afrogscanstatus1 = ""
afrogscanstatus2 = afrogscanstatus
afrogcontime = basic.scan_end_start_time(18)
fscanstatus = os.popen('bash /TIP/info_scan/finger.sh fscan_status').read()
if "running" in fscanstatus:
fscanstatus1 = fscanstatus
fscanstatus2 = ""
fscancontime = "计算中:"
else:
fscanstatus1 = ""
fscanstatus2 = fscanstatus
fscancontime = basic.scan_end_start_time(19)
shirostatus = os.popen('bash /TIP/info_scan/finger.sh shiro_status').read()
if "running" in shirostatus:
shirostatus1 = shirostatus
shirostatus2 = ""
shirocontime = "计算中:"
else:
shirostatus1 = ""
shirostatus2 = shirostatus
shirocontime = basic.scan_end_start_time(11)
eholestatus = os.popen('bash /TIP/info_scan/finger.sh ehole_status').read()
if "running" in eholestatus:
eholestatus1 = eholestatus
eholestatus2 = ""
eholecontime = "计算中:"
else:
eholestatus1 = ""
eholestatus2 = eholestatus
eholecontime = basic.scan_end_start_time(2)
httpxstatus = os.popen('bash /TIP/info_scan/finger.sh httpx_status').read()
if "running" in httpxstatus:
httpxstatus1 = httpxstatus
httpxstatus2 = ""
httpxcontime = "计算中:"
else:
httpxstatus1 = ""
httpxstatus2 = httpxstatus
httpxcontime = basic.scan_end_start_time(25)
springbootstatus = os.popen('bash /TIP/info_scan/finger.sh springboot_scan_status').read()
if "running" in springbootstatus:
springbootstatus1 = springbootstatus
springbootstatus2 = ""
springbootcontime = "计算中:"
else:
springbootstatus1 = ""
springbootstatus2 = springbootstatus
springbootcontime = basic.scan_end_start_time(12)
hydrastatus = os.popen('bash /TIP/info_scan/finger.sh hydra_status').read()
if "running" in hydrastatus:
hydrastatus1 = hydrastatus
hydrastatus2 = ""
weakpasscontime = "计算中:"
else:
hydrastatus1 = ""
hydrastatus2 = hydrastatus
weakpasscontime = basic.scan_end_start_time(20)
urlfinderstatus = os.popen('bash /TIP/info_scan/finger.sh urlfinder_status').read()
if "running" in urlfinderstatus:
urlfinderstatus1 = urlfinderstatus
urlfinderstatus2 = ""
apiintersacecontime = "计算中:"
else:
urlfinderstatus1 = ""
urlfinderstatus2 = urlfinderstatus
apiintersacecontime = basic.scan_end_start_time(21)
thinkphpstatus = os.popen('bash /TIP/info_scan/finger.sh TPscan_status').read()
if "running" in thinkphpstatus:
thinkphpstatus1 = thinkphpstatus
thinkphpstatus2 = ""
thinkphpcontime = "计算中:"
else:
thinkphpstatus1 = ""
thinkphpstatus2 = thinkphpstatus
thinkphpcontime = basic.scan_end_start_time(13)
seeyonstatus = os.popen('bash /TIP/info_scan/finger.sh seeyon_vuln_scan_status').read()
if "running" in seeyonstatus:
seeyonstatus1 = seeyonstatus
seeyonstatus2 = ""
seeyoncontime = "计算中:"
else:
seeyonstatus1 = ""
seeyonstatus2 = seeyonstatus
seeyoncontime = basic.scan_end_start_time(27)
yonsuite_status = os.popen('bash /TIP/info_scan/finger.sh yonsuite_vuln_scan_status').read()
if "running" in yonsuite_status:
yonsuite_status1 = yonsuite_status
yonsuite_status2 = ""
yonsuitecontime = "计算中:"
else:
yonsuite_status1 = ""
yonsuite_status2 = yonsuite_status
yonsuitecontime = basic.scan_end_start_time(28)
kingdee_status = os.popen('bash /TIP/info_scan/finger.sh kingdee_vuln_scan_status').read()
if "running" in kingdee_status:
kingdee_status1 = kingdee_status
kingdee_status2 = ""
kingdeecontime = "计算中:"
else:
kingdee_status1 = ""
kingdee_status2 = kingdee_status
kingdeecontime = basic.scan_end_start_time(29)
wanhu_status = os.popen('bash /TIP/info_scan/finger.sh wanhu_vuln_scan_status').read()
if "running" in wanhu_status:
wanhu_status1 = wanhu_status
wanhu_status2 = ""
wanhucontime = "计算中:"
else:
wanhu_status1 = ""
wanhu_status2 = wanhu_status
wanhucontime = basic.scan_end_start_time(30)
jndi_status = os.popen('bash /TIP/info_scan/finger.sh jndi_server_status').read()
if "running" in jndi_status:
jndi_status1 = jndi_status
jndi_status2 = ""
else:
jndi_status1 = ""
jndi_status2 = jndi_status
jndi_python_status = os.popen('bash /TIP/info_scan/finger.sh jndi_python_server_status').read()
if "running" in jndi_python_status:
jndi_python_status1 = jndi_python_status
jndi_python_status2 = ""
else:
jndi_python_status1 = ""
jndi_python_status2 = jndi_python_status
# 目标url行数
url_file_num = os.popen('bash /TIP/info_scan/finger.sh url_file_num').read()
# 重点资产数量查询
shiro_num = basic.key_point_assets_num(Shiro_rule)
springboot_num = basic.key_point_assets_num(SpringBoot_rule)
weblogic_num = basic.key_point_assets_num(weblogic_rule)
baota_num = basic.key_point_assets_num(baota_rule)
ruoyi_num = basic.key_point_assets_num(ruoyi_rule)
struts2_num = basic.key_point_assets_num(struts2_rule)
WordPress_num = basic.key_point_assets_num(WordPress_rule)
jboss_num = basic.key_point_assets_num(jboss_rule)
phpmyadmin_num = basic.key_point_assets_num(phpMyAdmin_rule)
ThinkPHP_num = basic.key_point_assets_num(ThinkPHP_rule)
nacos_num = basic.key_point_assets_num(nacos_rule)
fanwei_num = basic.key_point_assets_num(fanwei_rule)
tomcat_num = basic.key_point_assets_num(tomcat_rule)
# cpu占用率
cpu_percent = psutil.cpu_percent(interval=1)
# 获取内存信息
mem = psutil.virtual_memory()
# 计算内存占用百分比
memory_percent = mem.percent
# 资产规则
if int(rule_options) == 1:
key_asset_rule = str(finger_list)
if len(finger_list) == 0:
key_asset_rule = ['规则为空']
key_asset_rule_origin = '数据来源: 配置文件'
elif int(rule_options) == 2:
key_asset_rule = select_rule()
if len(key_asset_rule) == 0:
key_asset_rule = ['规则为空']
key_asset_rule_origin = '数据来源: MySQL数据库'
else:
key_asset_rule = ['参数只能为0/1']
# 当前自查数量
url_file_current_num = os.popen('bash /TIP/info_scan/finger.sh current_url_file_num').read()
# 筛选后资产状态查询
assets_status = basic.assets_status_show()
# 漏洞扫描器时间线查询
vuln_scan_status_shijianxian = basic.vuln_scan_status_show()
# 磁盘读速率
disk_read = basic.disk_read_write()[0]
# 磁盘写速率
disk_write = basic.disk_read_write()[1]
# python后端服务状态
infoinfostatus = os.popen('bash /TIP/info_scan/finger.sh infoinfostatus').read()
if "running" in infoinfostatus:
infoinfostatus1 = infoinfostatus
infoinfostatus2 = ""
else:
infoinfostatus1 = ""
infoinfostatus2 = infoinfostatus
dirsub_sys_status = os.popen('bash /TIP/info_scan/finger.sh dirsub_sys_status').read()
if "running" in dirsub_sys_status:
dirsub_sys_status1 = dirsub_sys_status
dirsub_sys_status2 = ""
else:
dirsub_sys_status1 = ""
dirsub_sys_status2 = dirsub_sys_status
xray_report_status = os.popen('bash /TIP/info_scan/finger.sh xray_report_status').read()
if "running" in xray_report_status:
xray_report_status1 = xray_report_status
xray_report_status2 = ""
else:
xray_report_status1 = ""
xray_report_status2 = xray_report_status
urlfinder_report_status = os.popen('bash /TIP/info_scan/finger.sh urlfinder_report_status').read()
if "running" in urlfinder_report_status:
urlfinder_report_status1 = urlfinder_report_status
urlfinder_report_status2 = ""
else:
urlfinder_report_status1 = ""
urlfinder_report_status2 = urlfinder_report_status
afrog_report_status = os.popen('bash /TIP/info_scan/finger.sh afrog_report_status').read()
if "running" in afrog_report_status:
afrog_report_status1 = afrog_report_status
afrog_report_status2 = ""
else:
afrog_report_status1 = ""
afrog_report_status2 = afrog_report_status
otx_status = os.popen('bash /TIP/info_scan/finger.sh otx_domain_url_shell_status').read()
if "running" in otx_status:
otx_status1 = otx_status
otx_status2 = ""
otxcontime = "计算中:"
else:
otx_status1 = ""
otx_status2 = otx_status
otxcontime = basic.scan_end_start_time(4)
crt_status = os.popen('bash /TIP/info_scan/finger.sh crt_subdomain_shell_status').read()
if "running" in crt_status:
crt_status1 = crt_status
crt_status2 = ""
crtcontime = "计算中:"
else:
crt_status1 = ""
crt_status2 = crt_status
crtcontime = basic.scan_end_start_time(5)
weaver_status = os.popen('bash /TIP/info_scan/finger.sh weaver_status').read()
if "running" in weaver_status:
weaver_status1 = weaver_status
weaver_status2 = ""
weavercontime = "计算中:"
else:
weaver_status1 = ""
weaver_status2 = weaver_status
weavercontime = basic.scan_end_start_time(24)
es_unauthorized_status = os.popen('bash /TIP/info_scan/finger.sh es_unauthorized_status').read()
if "running" in es_unauthorized_status:
es_unauthorized_status1 = es_unauthorized_status
es_unauthorized_status2 = ""
esccontime = "计算中:"
else:
es_unauthorized_status1 = ""
es_unauthorized_status2 = es_unauthorized_status
esccontime = basic.scan_end_start_time(14)
nacos_status = os.popen('bash /TIP/info_scan/finger.sh nacos_vuln_scan_status').read()
if "running" in nacos_status: