1
1
class SQLMapGenerator {
2
2
constructor ( ) {
3
3
this . config = { } ;
4
+ this . tamperScriptList = [
5
+ "0eunion" ,
6
+ "apostrophemask" ,
7
+ "apostrophenullencode" ,
8
+ "appendnullbyte" ,
9
+ "base64encode" ,
10
+ "between" ,
11
+ "binary" ,
12
+ "bluecoat" ,
13
+ "chardoubleencode" ,
14
+ "charencode" ,
15
+ "charunicodeencode" ,
16
+ "charunicodeescape" ,
17
+ "commalesslimit" ,
18
+ "commalessmid" ,
19
+ "commentbeforeparentheses" ,
20
+ "concat2concatws" ,
21
+ "decentities" ,
22
+ "dunion" ,
23
+ "equaltolike" ,
24
+ "equaltorlike" ,
25
+ "escapequotes" ,
26
+ "greatest" ,
27
+ "halfversionedmorekeywords" ,
28
+ "hex2char" ,
29
+ "hexentities" ,
30
+ "htmlencode" ,
31
+ "if2case" ,
32
+ "ifnull2casewhenisnull" ,
33
+ "ifnull2ifisnull" ,
34
+ "informationschemacomment" ,
35
+ "least" ,
36
+ "lowercase" ,
37
+ "luanginx" ,
38
+ "luanginxmore" ,
39
+ "misunion" ,
40
+ "modsecurityversioned" ,
41
+ "modsecurityzeroversioned" ,
42
+ "multiplespaces" ,
43
+ "ord2ascii" ,
44
+ "overlongutf8" ,
45
+ "overlongutf8more" ,
46
+ "percentage" ,
47
+ "plus2concat" ,
48
+ "plus2fnconcat" ,
49
+ "randomcase" ,
50
+ "randomcomments" ,
51
+ "schemasplit" ,
52
+ "scientific" ,
53
+ "sleep2getlock" ,
54
+ "sp_password" ,
55
+ "space2comment" ,
56
+ "space2dash" ,
57
+ "space2hash" ,
58
+ "space2morecomment" ,
59
+ "space2morehash" ,
60
+ "space2mssqlblank" ,
61
+ "space2mssqlhash" ,
62
+ "space2mysqlblank" ,
63
+ "space2mysqldash" ,
64
+ "space2plus" ,
65
+ "space2randomblank" ,
66
+ "substring2leftright" ,
67
+ "symboliclogical" ,
68
+ "unionalltounion" ,
69
+ "unmagicquotes" ,
70
+ "uppercase" ,
71
+ "varnish" ,
72
+ "versionedkeywords" ,
73
+ "versionedmorekeywords" ,
74
+ "xforwardedfor"
75
+ ] ;
76
+
4
77
this . templates = {
5
78
basic_get : {
6
79
name : "tbd" ,
@@ -340,77 +413,9 @@ class SQLMapGenerator {
340
413
if ( techniques . length > 0 ) config [ '--technique' ] = techniques . join ( '' ) ;
341
414
342
415
const tamperScripts = [ ] ;
343
- if ( document . getElementById ( 'tamperscript-0eunion' ) . checked ) tamperScripts . push ( '0eunion' ) ;
344
- if ( document . getElementById ( 'tamperscript-apostrophemask' ) . checked ) tamperScripts . push ( 'apostrophemask' ) ;
345
- if ( document . getElementById ( 'tamperscript-apostrophenullencode' ) . checked ) tamperScripts . push ( 'apostrophenullencode' ) ;
346
- if ( document . getElementById ( 'tamperscript-appendnullbyte' ) . checked ) tamperScripts . push ( 'appendnullbyte' ) ;
347
- if ( document . getElementById ( 'tamperscript-base64encode' ) . checked ) tamperScripts . push ( 'base64encode' ) ;
348
- if ( document . getElementById ( 'tamperscript-between' ) . checked ) tamperScripts . push ( 'between' ) ;
349
- if ( document . getElementById ( 'tamperscript-binary' ) . checked ) tamperScripts . push ( 'binary' ) ;
350
- if ( document . getElementById ( 'tamperscript-bluecoat' ) . checked ) tamperScripts . push ( 'bluecoat' ) ;
351
- if ( document . getElementById ( 'tamperscript-chardoubleencode' ) . checked ) tamperScripts . push ( 'chardoubleencode' ) ;
352
- if ( document . getElementById ( 'tamperscript-charencode' ) . checked ) tamperScripts . push ( 'charencode' ) ;
353
- if ( document . getElementById ( 'tamperscript-charunicodeencode' ) . checked ) tamperScripts . push ( 'charunicodeencode' ) ;
354
- if ( document . getElementById ( 'tamperscript-charunicodeescape' ) . checked ) tamperScripts . push ( 'charunicodeescape' ) ;
355
- if ( document . getElementById ( 'tamperscript-commalesslimit' ) . checked ) tamperScripts . push ( 'commalesslimit' ) ;
356
- if ( document . getElementById ( 'tamperscript-commalessmid' ) . checked ) tamperScripts . push ( 'commalessmid' ) ;
357
- if ( document . getElementById ( 'tamperscript-commentbeforeparentheses' ) . checked ) tamperScripts . push ( 'commentbeforeparentheses' ) ;
358
- if ( document . getElementById ( 'tamperscript-concat2concatws' ) . checked ) tamperScripts . push ( 'concat2concatws' ) ;
359
- if ( document . getElementById ( 'tamperscript-decentities' ) . checked ) tamperScripts . push ( 'decentities' ) ;
360
- if ( document . getElementById ( 'tamperscript-dunion' ) . checked ) tamperScripts . push ( 'dunion' ) ;
361
- if ( document . getElementById ( 'tamperscript-equaltolike' ) . checked ) tamperScripts . push ( 'equaltolike' ) ;
362
- if ( document . getElementById ( 'tamperscript-equaltorlike' ) . checked ) tamperScripts . push ( 'equaltorlike' ) ;
363
- if ( document . getElementById ( 'tamperscript-escapequotes' ) . checked ) tamperScripts . push ( 'escapequotes' ) ;
364
- if ( document . getElementById ( 'tamperscript-greatest' ) . checked ) tamperScripts . push ( 'greatest' ) ;
365
- if ( document . getElementById ( 'tamperscript-halfversionedmorekeywords' ) . checked ) tamperScripts . push ( 'halfversionedmorekeywords' ) ;
366
- if ( document . getElementById ( 'tamperscript-hex2char' ) . checked ) tamperScripts . push ( 'hex2char' ) ;
367
- if ( document . getElementById ( 'tamperscript-hexentities' ) . checked ) tamperScripts . push ( 'hexentities' ) ;
368
- if ( document . getElementById ( 'tamperscript-htmlencode' ) . checked ) tamperScripts . push ( 'htmlencode' ) ;
369
- if ( document . getElementById ( 'tamperscript-if2case' ) . checked ) tamperScripts . push ( 'if2case' ) ;
370
- if ( document . getElementById ( 'tamperscript-ifnull2casewhenisnull' ) . checked ) tamperScripts . push ( 'ifnull2casewhenisnull' ) ;
371
- if ( document . getElementById ( 'tamperscript-ifnull2ifisnull' ) . checked ) tamperScripts . push ( 'ifnull2ifisnull' ) ;
372
- if ( document . getElementById ( 'tamperscript-informationschemacomment' ) . checked ) tamperScripts . push ( 'informationschemacomment' ) ;
373
- if ( document . getElementById ( 'tamperscript-least' ) . checked ) tamperScripts . push ( 'least' ) ;
374
- if ( document . getElementById ( 'tamperscript-lowercase' ) . checked ) tamperScripts . push ( 'lowercase' ) ;
375
- if ( document . getElementById ( 'tamperscript-luanginx' ) . checked ) tamperScripts . push ( 'luanginx' ) ;
376
- if ( document . getElementById ( 'tamperscript-luanginxmore' ) . checked ) tamperScripts . push ( 'luanginxmore' ) ;
377
- if ( document . getElementById ( 'tamperscript-misunion' ) . checked ) tamperScripts . push ( 'misunion' ) ;
378
- if ( document . getElementById ( 'tamperscript-modsecurityversioned' ) . checked ) tamperScripts . push ( 'modsecurityversioned' ) ;
379
- if ( document . getElementById ( 'tamperscript-modsecurityzeroversioned' ) . checked ) tamperScripts . push ( 'modsecurityzeroversioned' ) ;
380
- if ( document . getElementById ( 'tamperscript-multiplespaces' ) . checked ) tamperScripts . push ( 'multiplespaces' ) ;
381
- if ( document . getElementById ( 'tamperscript-ord2ascii' ) . checked ) tamperScripts . push ( 'ord2ascii' ) ;
382
- if ( document . getElementById ( 'tamperscript-overlongutf8' ) . checked ) tamperScripts . push ( 'overlongutf8' ) ;
383
- if ( document . getElementById ( 'tamperscript-overlongutf8more' ) . checked ) tamperScripts . push ( 'overlongutf8more' ) ;
384
- if ( document . getElementById ( 'tamperscript-percentage' ) . checked ) tamperScripts . push ( 'percentage' ) ;
385
- if ( document . getElementById ( 'tamperscript-plus2concat' ) . checked ) tamperScripts . push ( 'plus2concat' ) ;
386
- if ( document . getElementById ( 'tamperscript-plus2fnconcat' ) . checked ) tamperScripts . push ( 'plus2fnconcat' ) ;
387
- if ( document . getElementById ( 'tamperscript-randomcase' ) . checked ) tamperScripts . push ( 'randomcase' ) ;
388
- if ( document . getElementById ( 'tamperscript-randomcomments' ) . checked ) tamperScripts . push ( 'randomcomments' ) ;
389
- if ( document . getElementById ( 'tamperscript-schemasplit' ) . checked ) tamperScripts . push ( 'schemasplit' ) ;
390
- if ( document . getElementById ( 'tamperscript-scientific' ) . checked ) tamperScripts . push ( 'scientific' ) ;
391
- if ( document . getElementById ( 'tamperscript-sleep2getlock' ) . checked ) tamperScripts . push ( 'sleep2getlock' ) ;
392
- if ( document . getElementById ( 'tamperscript-sp_password' ) . checked ) tamperScripts . push ( 'sp_password' ) ;
393
- if ( document . getElementById ( 'tamperscript-space2comment' ) . checked ) tamperScripts . push ( 'space2comment' ) ;
394
- if ( document . getElementById ( 'tamperscript-space2dash' ) . checked ) tamperScripts . push ( 'space2dash' ) ;
395
- if ( document . getElementById ( 'tamperscript-space2hash' ) . checked ) tamperScripts . push ( 'space2hash' ) ;
396
- if ( document . getElementById ( 'tamperscript-space2morecomment' ) . checked ) tamperScripts . push ( 'space2morecomment' ) ;
397
- if ( document . getElementById ( 'tamperscript-space2morehash' ) . checked ) tamperScripts . push ( 'space2morehash' ) ;
398
- if ( document . getElementById ( 'tamperscript-space2mssqlblank' ) . checked ) tamperScripts . push ( 'space2mssqlblank' ) ;
399
- if ( document . getElementById ( 'tamperscript-space2mssqlhash' ) . checked ) tamperScripts . push ( 'space2mssqlhash' ) ;
400
- if ( document . getElementById ( 'tamperscript-space2mysqlblank' ) . checked ) tamperScripts . push ( 'space2mysqlblank' ) ;
401
- if ( document . getElementById ( 'tamperscript-space2mysqldash' ) . checked ) tamperScripts . push ( 'space2mysqldash' ) ;
402
- if ( document . getElementById ( 'tamperscript-space2plus' ) . checked ) tamperScripts . push ( 'space2plus' ) ;
403
- if ( document . getElementById ( 'tamperscript-space2randomblank' ) . checked ) tamperScripts . push ( 'space2randomblank' ) ;
404
- if ( document . getElementById ( 'tamperscript-substring2leftright' ) . checked ) tamperScripts . push ( 'substring2leftright' ) ;
405
- if ( document . getElementById ( 'tamperscript-symboliclogical' ) . checked ) tamperScripts . push ( 'symboliclogical' ) ;
406
- if ( document . getElementById ( 'tamperscript-unionalltounion' ) . checked ) tamperScripts . push ( 'unionalltounion' ) ;
407
- if ( document . getElementById ( 'tamperscript-unmagicquotes' ) . checked ) tamperScripts . push ( 'unmagicquotes' ) ;
408
- if ( document . getElementById ( 'tamperscript-uppercase' ) . checked ) tamperScripts . push ( 'uppercase' ) ;
409
- if ( document . getElementById ( 'tamperscript-varnish' ) . checked ) tamperScripts . push ( 'varnish' ) ;
410
- if ( document . getElementById ( 'tamperscript-versionedkeywords' ) . checked ) tamperScripts . push ( 'versionedkeywords' ) ;
411
- if ( document . getElementById ( 'tamperscript-versionedmorekeywords' ) . checked ) tamperScripts . push ( 'versionedmorekeywords' ) ;
412
- if ( document . getElementById ( 'tamperscript-xforwardedfor' ) . checked ) tamperScripts . push ( 'xforwardedfor' ) ;
413
-
416
+ this . tamperScriptList . forEach ( s => {
417
+ if ( document . getElementById ( 'tamperscript-' + s ) . checked ) tamperScripts . push ( s ) ;
418
+ } ) ;
414
419
const tamper = document . getElementById ( 'tamper' ) ;
415
420
if ( tamperScripts . length > 0 ) tamper . value = tamperScripts . join ( ',' ) ;
416
421
if ( tamper . value . trim ( ) ) config [ '--tamper' ] = tamper . value . trim ( ) ;
@@ -802,7 +807,8 @@ class SQLMapGenerator {
802
807
if ( element ) {
803
808
if ( element . type === 'checkbox' ) {
804
809
element . checked = value === true ;
805
- } else if ( param === '--technique' ) {
810
+ }
811
+ else if ( param === '--technique' ) {
806
812
// Handle technique checkboxes
807
813
[ 'B' , 'E' , 'U' , 'S' , 'T' ] . forEach ( tech => {
808
814
const techElement = document . getElementById ( 'tech' + tech ) ;
@@ -811,6 +817,15 @@ class SQLMapGenerator {
811
817
}
812
818
} ) ;
813
819
}
820
+ else if ( param === '--tamper' ) {
821
+ // Handle tamperscripts checkboxes
822
+ this . tamperScriptList . forEach ( s => {
823
+ const sElement = document . getElementById ( 'tamperscript-' + s ) ;
824
+ if ( sElement ) {
825
+ sElement . checked = value . includes ( s ) ;
826
+ }
827
+ } ) ;
828
+ }
814
829
else {
815
830
element . value = value ;
816
831
0 commit comments