1
1
class SQLMapGenerator {
2
2
constructor ( ) {
3
3
this . config = { } ;
4
+
5
+ this . paramMapping = {
6
+ '-u' : 'url' ,
7
+ '-d' : 'directDb' ,
8
+ '-g' : 'googleDork' ,
9
+ '-m' : 'targetsFile' ,
10
+ '-l' : 'burpFile' ,
11
+ '--scope' : 'burpFileScope' ,
12
+
13
+ '--timeout' : 'timeout' ,
14
+ '--delay' : 'delay' ,
15
+ '--threads' : 'threads' ,
16
+ '--force-ssl' : 'forceSsl' ,
17
+ '--keep-alive' : 'keepAlive' ,
18
+ '--null-connection' : 'nullConnection' ,
19
+
20
+ '--proxy' : 'proxy' ,
21
+ '--proxy-cred' : 'proxyCred' ,
22
+ '--proxy-file' : 'proxyFile' ,
23
+ '--proxy-freq' : 'proxyFreq' ,
24
+ '--ignore-proxy' : 'proxyIgnore' ,
25
+ '--tor' : 'tor' ,
26
+ '--check-tor' : 'checkTor' ,
27
+ '--tor-port' : 'torPort' ,
28
+ '--tor-type' : 'torType' ,
29
+
30
+ '--method' : 'method' ,
31
+ '--param-del' : 'paramDel' ,
32
+ '-r' : 'requestFile' ,
33
+ '--data' : 'data' ,
34
+
35
+ '--host' : 'host' ,
36
+ '-A' : 'userAgent' ,
37
+ '--random-agent' : 'userAgent' ,
38
+ '--mobile' : 'mobileUserAgent' ,
39
+ '--referer' : 'referer' ,
40
+ '-H' : 'headers' ,
41
+
42
+ '--cookie' : 'cookie' ,
43
+ '--cookie-del' : 'cookieDel' ,
44
+ '--live-cookies' : 'cookieLive' ,
45
+ '--load-cookies' : 'cookieLoad' ,
46
+ '--drop-set-cookie' : 'cookieDrop' ,
47
+ '--auth-type' : 'authType' ,
48
+ '--auth-cred' : 'authCred' ,
49
+ '--auth-file' : 'authFile' ,
50
+
51
+ '--csrf-token' : 'csrfToken' ,
52
+ '--csrf-method' : 'csrfMethod' ,
53
+ '--csrf-url' : 'csrfUrl' ,
54
+ '--csrf-retries' : 'csrfRetries' ,
55
+
56
+ '-p' : 'paramTest' ,
57
+ '--skip' : 'paramSkip' ,
58
+ '--param-exclude' : 'paramExclude' ,
59
+ '--param-filter' : 'paramFilter' ,
60
+ '--prefix' : 'prefix' ,
61
+ '--suffix' : 'suffix' ,
62
+
63
+ '--string' : 'string' ,
64
+ '--regexp' : 'regexp' ,
65
+ '--not-string' : 'notString' ,
66
+ '--code' : 'code' ,
67
+ '--titles' : 'titles' ,
68
+ '--text-only' : 'textOnly' ,
69
+ '--level' : 'level' ,
70
+
71
+ '--risk' : 'risk' ,
72
+ '--dbms' : 'dbms' ,
73
+ '--os' : 'os' ,
74
+ '--second-url' : 'secondUrl' ,
75
+ '--second-req' : 'secondReq' ,
76
+ '--technique' : 'technique' ,
77
+ '--invalid-bignum' : 'invalidBignum' ,
78
+ '--invalid-logical' : 'invalidLogical' ,
79
+ '--invalid-string' : 'invalidString' ,
80
+ '--no-cast' : 'noCast' ,
81
+ '--no-escape' : 'noEscape' ,
82
+ '--predict-output' :'predictOutput' ,
83
+
84
+ '--all' : 'all' ,
85
+ '--banner' : 'banner' ,
86
+ '--columns' : 'columns' ,
87
+ '--comments' : 'comments' ,
88
+ '--count' : 'count' ,
89
+ '--current-user' : 'currentUser' ,
90
+ '--current-db' : 'currentDb' ,
91
+ '--dbs' : 'dbs' ,
92
+ '--dump' : 'dump' ,
93
+ '--dump-all' : 'dumpAll' ,
94
+ '--exclude-sysdbs' : 'excludeSysdbs' ,
95
+ '--hostname' : 'hostname' ,
96
+ '--is-dba' : 'isDba' ,
97
+ '--passwords' : 'passwords' ,
98
+ '--privileges' : 'privileges' ,
99
+ '--roles' : 'roles' ,
100
+ '--schema' : 'schema' ,
101
+ '--search' : 'search' ,
102
+ '--statements' : 'statements' ,
103
+ '--tables' : 'tables' ,
104
+ '--users' : 'users' ,
105
+
106
+ '-D' : 'database' ,
107
+ '-T' : 'table' ,
108
+ '-C' : 'column' ,
109
+ '-X' : 'exclude' ,
110
+ '-U' : 'user' ,
111
+ '--pivot-column' : 'pivotColumn' ,
112
+ '--where' : 'where' ,
113
+ '--start' : 'start' ,
114
+ '--stop' : 'stop' ,
115
+ '--first' : 'first' ,
116
+ '--last' : 'last' ,
117
+ '--sql-query' : 'sqlQuery' ,
118
+ '--sql-file' : 'sqlFile' ,
119
+
120
+ '--tamper' : 'tamper' ,
121
+
122
+ '-v' : 'verbose' ,
123
+ '-t' : 'trafficFile' ,
124
+ '--batch' : 'batch' ,
125
+ '--parse-errors' : 'parseErrors'
126
+ } ;
127
+
4
128
this . tamperScriptList = [
5
129
"0eunion" ,
6
130
"apostrophemask" ,
@@ -431,7 +555,10 @@ class SQLMapGenerator {
431
555
if ( suffix ) config [ '--suffix' ] = suffix ;
432
556
433
557
const secondUrl = document . getElementById ( 'secondUrl' ) . value . trim ( ) ;
434
- if ( secondUrl ) config [ '--second-url' ] = secondUrl ;
558
+ if ( secondUrl ) config [ '--second-url' ] = secondUrl ;
559
+
560
+ const secondReq = document . getElementById ( 'secondReq' ) . value . trim ( ) ;
561
+ if ( secondReq ) config [ '--second-req' ] = secondReq ;
435
562
436
563
// Techniques
437
564
const techniques = [ ] ;
@@ -493,6 +620,7 @@ class SQLMapGenerator {
493
620
if ( document . getElementById ( 'dumpAll' ) . checked ) config [ '--dump-all' ] = true ;
494
621
if ( document . getElementById ( 'hostname' ) . checked ) config [ '--hostname' ] = true ;
495
622
if ( document . getElementById ( 'isDba' ) . checked ) config [ '--is-dba' ] = true ;
623
+ if ( document . getElementById ( 'excludeSysdbs' ) . checked ) config [ '--exclude-sysdbs' ] = true ;
496
624
if ( document . getElementById ( 'passwords' ) . checked ) config [ '--passwords' ] = true ;
497
625
if ( document . getElementById ( 'privileges' ) . checked ) config [ '--privileges' ] = true ;
498
626
if ( document . getElementById ( 'roles' ) . checked ) config [ '--roles' ] = true ;
@@ -530,11 +658,17 @@ class SQLMapGenerator {
530
658
if ( stop ) config [ '--stop' ] = stop ;
531
659
532
660
const first = document . getElementById ( 'first' ) . value . trim ( ) ;
533
- if ( first ) config [ '--first' ] = first ;
661
+ if ( first ) config [ '--first' ] = first ;
534
662
535
663
const last = document . getElementById ( 'last' ) . value . trim ( ) ;
536
664
if ( last ) config [ '--last' ] = last ;
537
665
666
+ const sqlQuery = document . getElementById ( 'sqlQuery' ) . value . trim ( ) ;
667
+ if ( sqlQuery ) config [ '--sql-query' ] = sqlQuery ;
668
+
669
+ const sqlFile = document . getElementById ( 'sqlFile' ) . value . trim ( ) ;
670
+ if ( sqlFile ) config [ '--sql-file' ] = sqlFile ;
671
+
538
672
return config ;
539
673
}
540
674
@@ -543,26 +677,7 @@ class SQLMapGenerator {
543
677
let command = 'sqlmap' ;
544
678
545
679
// Order of parameters for better readability
546
- const paramOrder = [
547
- '-u' , '-d' , '-r' , '-m' , '-l' , '--scope' , '-g' ,
548
- '--timeout' , '--delay' , '--threads' ,
549
- '--proxy' , '--proxy-cred' , '--proxy-file' , '--proxy-freq' , '--ignore-proxy' ,
550
- '--tor' , '--check-tor' , '--tor-port' , '--tor-type' ,
551
- '--force-ssl' , '--keep-alive' , '--null-connection' , '--http2' ,
552
- '--method' , '--data' , '--param-del' ,
553
- '--string' , '--not-string' , '--regexp' , '--code' , '--text-only' , '--titles' ,
554
- '--host' , '-A' , '--mobile' , '--random-agent' , "--referer" , "-H" ,
555
- '--cookie' , '--cookie-del' , '--live-cookies' , '--load-cookies' , '--drop-set-cookie' ,
556
- '--auth-type' , '--auth-cred' , '--auth-file' ,
557
- '--csrf-token' , '--csrf-url' , '--csrf-method' , '--csrf-retries' ,
558
- '-p' , '--skip' , '--param-exclude' , '--param-filter' , '--level' , '--risk' , '--dbms' , '--os' ,
559
- '--technique' , '--invalid-bignum' , '--invalid-logical' , '--invalid-string' , '--no-cast' , '--no-escape' , '--predict-output' ,
560
- '--batch' , '-v' , '-t' , '--parse-errors' , '--test-filter' ,
561
- '--all' , '--banner' , '--columns' , '--comments' , '--count' , '--current-user' , '--current-db' , '--dbs' , '--dump' , '--dump-all' ,
562
- '--hostname' , '--is-dba' , '--passwords' , '--privileges' , '--roles' , '--schema' , '--search' , '--statements' , '--tables' , '--users' ,
563
- '-D' , '-T' , '-C' , '-X' , '-U' , '--pivot-column' , '--where' , '--start' , '--stop' , '--first' , '--last' ,
564
- '--tamper' , '--prefix' , '--suffix' , '--csrf-token' , '--csrf-url' , '--second-url'
565
- ] ;
680
+ const paramOrder = Object . keys ( this . paramMapping ) ;
566
681
567
682
// Add parameters in order
568
683
paramOrder . forEach ( param => {
@@ -592,9 +707,10 @@ class SQLMapGenerator {
592
707
// Check if we have hashtag with proper config and load it if so
593
708
try {
594
709
let hashtag = location . hash . substr ( 1 ) ;
595
- if ( hashtag . length > 0 ) {
710
+ if ( hashtag . length > 0 && hashtag !== "e30=" ) {
596
711
let hashtagCmd = JSON . parse ( atob ( hashtag ) ) ;
597
712
this . applyConfiguration ( hashtagCmd ) ;
713
+ this . showMessage ( "Configuration loaded from URL" , 'success' ) ;
598
714
}
599
715
} catch ( ex ) {
600
716
console . log ( ex ) ;
@@ -792,119 +908,12 @@ class SQLMapGenerator {
792
908
793
909
applyConfiguration ( config ) {
794
910
// Reset form first
795
- this . resetConfiguration ( ) ;
911
+ this . resetConfiguration ( true ) ;
796
912
797
913
// Apply configuration
798
914
Object . entries ( config ) . forEach ( ( [ param , value ] ) => {
799
- // Map parameters to form element IDs
800
- const paramMapping = {
801
- '-u' : 'url' ,
802
- '-d' : 'directDb' ,
803
- '-r' : 'requestFile' ,
804
- '-m' : 'targetsFile' ,
805
- '-l' : 'burpFile' ,
806
- '--scope' : 'burpFileScope' ,
807
- '-g' : 'googleDork' ,
808
- '--force-ssl' : 'forceSsl' ,
809
- '--timeout' : 'timeout' ,
810
- '--delay' : 'delay' ,
811
- '--threads' : 'threads' ,
812
- '--proxy' : 'proxy' ,
813
- '--proxy-cred' : 'proxyCred' ,
814
- '--proxy-file' : 'proxyFile' ,
815
- '--proxy-freq' : 'proxyFreq' ,
816
- '--ignore-proxy' : 'proxyIgnore' ,
817
- '--tor' : 'tor' ,
818
- '--check-tor' : 'checkTor' ,
819
- '--tor-port' : 'torPort' ,
820
- '--tor-type' : 'torType' ,
821
- '--method' : 'method' ,
822
- '--data' : 'data' ,
823
- '--param-del' : 'paramDel' ,
824
- '--prefix' : 'prefix' ,
825
- '--suffix' : 'suffix' ,
826
- '--host' : 'host' ,
827
- '-A' : 'userAgent' ,
828
- '--string' : 'string' ,
829
- '--not-string' : 'notString' ,
830
- '--regexp' : 'regexp' ,
831
- '--code' : 'code' ,
832
- '--titles' : 'titles' ,
833
- '--text-only' : 'textOnly' ,
834
- '--mobile' : 'mobileUserAgent' ,
835
- '--random-agent' : 'userAgent' ,
836
- '--referer' : 'referer' ,
837
- '-H' : 'headers' ,
838
- '--cookie' : 'cookie' ,
839
- '--cookie-del' : 'cookieDel' ,
840
- '--live-cookies' : 'cookieLive' ,
841
- '--drop-set-cookie' : 'cookieDrop' ,
842
- '--load-cookies' : 'cookieLoad' ,
843
- '--auth-type' : 'authType' ,
844
- '--auth-cred' : 'authCred' ,
845
- '--auth-file' : 'authFile' ,
846
- '--csrf-token' : 'csrfToken' ,
847
- '--csrf-url' : 'csrfUrl' ,
848
- '--csrf-method' : 'csrfMethod' ,
849
- '--csrf-retries' : 'csrfRetries' ,
850
- '-p' : 'paramTest' ,
851
- '--skip' : 'paramSkip' ,
852
- '--param-exclude' : 'paramExclude' ,
853
- '--param-filter' : 'paramFilter' ,
854
- '--level' : 'level' ,
855
- '--risk' : 'risk' ,
856
- '--dbms' : 'dbms' ,
857
- '--os' : 'os' ,
858
- '--technique' : 'technique' ,
859
- '--invalid-bignum' : 'invalidBignum' ,
860
- '--invalid-logical' : 'invalidLogical' ,
861
- '--invalid-string' : 'invalidString' ,
862
- '--no-cast' : 'noCast' ,
863
- '--no-escape' : 'noEscape' ,
864
- '--predict-output' :'predictOutput' ,
865
- '--keep-alive' : 'keepAlive' ,
866
- '--batch' : 'batch' ,
867
- '-v' : 'verbose' ,
868
- '-t' : 'trafficFile' ,
869
- '--parse-errors' : 'parseErrors' ,
870
- '--test-filter' : 'testFilter' ,
871
- '--all' : 'all' ,
872
- '--banner' : 'banner' ,
873
- '--columns' : 'columns' ,
874
- '--comments' : 'comments' ,
875
- '--count' : 'count' ,
876
- '--current-user' : 'currentUser' ,
877
- '--current-db' : 'currentDb' ,
878
- '--dbs' : 'dbs' ,
879
- '--dump' : 'dump' ,
880
- '--dump-all' : 'dumpAll' ,
881
- '--hostname' : 'hostname' ,
882
- '--is-dba' : 'isDba' ,
883
- '--passwords' : 'passwords' ,
884
- '--privileges' : 'privileges' ,
885
- '--roles' : 'roles' ,
886
- '--schema' : 'schema' ,
887
- '--search' : 'search' ,
888
- '--statements' : 'statements' ,
889
- '--tables' : 'tables' ,
890
- '--users' : 'users' ,
891
- '-D' : 'database' ,
892
- '-T' : 'table' ,
893
- '-C' : 'column' ,
894
- '-X' : 'exclude' ,
895
- '-U' : 'user' ,
896
- '--where' : 'where' ,
897
- '--start' : 'start' ,
898
- '--stop' : 'stop' ,
899
- '--first' : 'first' ,
900
- '--last' : 'last' ,
901
- '--pivot-column' : 'pivotColumn' ,
902
- '--null-connection' : 'nullConnection' ,
903
- '--tamper' : 'tamper' ,
904
- '--second-url' : 'secondUrl'
905
- } ;
906
915
907
- const elementId = paramMapping [ param ] ;
916
+ const elementId = this . paramMapping [ param ] ;
908
917
if ( elementId ) {
909
918
const element = document . getElementById ( elementId ) ;
910
919
if ( element ) {
@@ -947,7 +956,7 @@ class SQLMapGenerator {
947
956
this . updateCommand ( ) ;
948
957
}
949
958
950
- resetConfiguration ( ) {
959
+ resetConfiguration ( skipResetAlert = false ) {
951
960
// Reset all form fields
952
961
document . querySelectorAll ( 'input, select, textarea' ) . forEach ( element => {
953
962
if ( element . type === 'checkbox' ) {
@@ -974,29 +983,25 @@ class SQLMapGenerator {
974
983
document . getElementById ( 'customCsrfMethodGroup' ) . style . display = 'none' ;
975
984
976
985
this . updateCommand ( ) ;
977
- this . showMessage ( 'Configuration deleted' , 'info' ) ;
986
+ if ( ! skipResetAlert ) {
987
+ this . showMessage ( 'Configuration loaded' , 'info' ) ;
988
+ }
978
989
}
979
990
980
991
showMessage ( message , type = 'info' ) {
981
992
// Create message element
982
993
const messageEl = document . createElement ( 'div' ) ;
983
994
messageEl . className = `status status--${ type } ` ;
984
995
messageEl . textContent = message ;
985
- messageEl . style . position = 'fixed' ;
986
- messageEl . style . top = '20px' ;
987
- messageEl . style . right = '20px' ;
988
- messageEl . style . zIndex = '1000' ;
989
- messageEl . style . minWidth = '300px' ;
990
- messageEl . style . padding = '12px 16px' ;
991
996
992
- document . body . appendChild ( messageEl ) ;
997
+ document . getElementById ( "status-container" ) . appendChild ( messageEl ) ;
993
998
994
- // Remove after 10 seconds
999
+ // Remove after 6 seconds
995
1000
setTimeout ( ( ) => {
996
1001
if ( messageEl . parentNode ) {
997
1002
messageEl . parentNode . removeChild ( messageEl ) ;
998
1003
}
999
- } , 10000 ) ;
1004
+ } , 6000 ) ;
1000
1005
}
1001
1006
}
1002
1007
0 commit comments