|
7 | 7 | # | |
8 | 8 | # ---------------------------------------------------------------------------+ |
9 | 9 |
|
10 | | -if _command_exists sqlmap |
11 | | -then |
| 10 | +_command_exists sqlmap || return |
12 | 11 |
|
13 | | - function _sqlmap() |
14 | | - { |
15 | | - local cur prev |
| 12 | +function _sqlmap() { |
| 13 | + local cur prev |
16 | 14 |
|
17 | | - COMPREPLY=() |
18 | | - cur="$(_get_cword)" |
19 | | - prev="$(_get_pword)" |
| 15 | + COMPREPLY=() |
| 16 | + cur="$(_get_cword)" |
| 17 | + prev="$(_get_pword)" |
20 | 18 |
|
21 | | - case $prev in |
| 19 | + case $prev in |
22 | 20 |
|
23 | | - # List directory content |
24 | | - --tamper) |
25 | | - COMPREPLY=( $( compgen -W "$tamper" -- "$cur" ) ) |
26 | | - return 0 |
27 | | - ;; |
28 | | - --output-dir|-t|-l|-m|-r|--load-cookies|--proxy-file|--sql-file|--shared-lib|--file-write) |
29 | | - _filedir |
30 | | - return 0 |
31 | | - ;; |
32 | | - -c) |
33 | | - _filedir ini |
34 | | - return 0 |
35 | | - ;; |
36 | | - --method) |
37 | | - COMPREPLY=( $( compgen -W 'GET POST PUT' -- "$cur" ) ) |
38 | | - return 0 |
39 | | - ;; |
40 | | - --auth-type) |
41 | | - COMPREPLY=( $( compgen -W 'Basic Digest NTLM PKI' -- "$cur" ) ) |
42 | | - return 0 |
43 | | - ;; |
44 | | - --tor-type) |
45 | | - COMPREPLY=( $( compgen -W 'HTTP SOCKS4 SOCKS5' -- "$cur" ) ) |
46 | | - return 0 |
47 | | - ;; |
48 | | - -v) |
49 | | - COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) ) |
50 | | - return 0 |
51 | | - ;; |
52 | | - --dbms) |
53 | | - COMPREPLY=( $( compgen -W 'mysql mssql access postgres' -- "$cur" ) ) |
54 | | - return 0 |
55 | | - ;; |
56 | | - --level|--crawl) |
57 | | - COMPREPLY=( $( compgen -W '1 2 3 4 5' -- "$cur" ) ) |
58 | | - return 0 |
59 | | - ;; |
60 | | - --risk) |
61 | | - COMPREPLY=( $( compgen -W '0 1 2 3' -- "$cur" ) ) |
62 | | - return 0 |
63 | | - ;; |
64 | | - --technique) |
65 | | - COMPREPLY=( $( compgen -W 'B E U S T Q' -- "$cur" ) ) |
66 | | - return 0 |
67 | | - ;; |
68 | | - -s) |
69 | | - _filedir sqlite |
70 | | - return 0 |
71 | | - ;; |
72 | | - --dump-format) |
73 | | - COMPREPLY=( $( compgen -W 'CSV HTML SQLITE' -- "$cur" ) ) |
74 | | - return 0 |
75 | | - ;; |
76 | | - -x) |
77 | | - _filedir xml |
78 | | - return 0 |
79 | | - ;; |
80 | | - esac |
| 21 | + # List directory content |
| 22 | + --tamper) |
| 23 | + COMPREPLY=($(compgen -W "$tamper" -- "$cur")) |
| 24 | + return 0 |
| 25 | + ;; |
| 26 | + --output-dir | -t | -l | -m | -r | --load-cookies | --proxy-file | --sql-file | --shared-lib | --file-write) |
| 27 | + _filedir |
| 28 | + return 0 |
| 29 | + ;; |
| 30 | + -c) |
| 31 | + _filedir ini |
| 32 | + return 0 |
| 33 | + ;; |
| 34 | + --method) |
| 35 | + COMPREPLY=($(compgen -W 'GET POST PUT' -- "$cur")) |
| 36 | + return 0 |
| 37 | + ;; |
| 38 | + --auth-type) |
| 39 | + COMPREPLY=($(compgen -W 'Basic Digest NTLM PKI' -- "$cur")) |
| 40 | + return 0 |
| 41 | + ;; |
| 42 | + --tor-type) |
| 43 | + COMPREPLY=($(compgen -W 'HTTP SOCKS4 SOCKS5' -- "$cur")) |
| 44 | + return 0 |
| 45 | + ;; |
| 46 | + -v) |
| 47 | + COMPREPLY=($(compgen -W '1 2 3 4 5 6' -- "$cur")) |
| 48 | + return 0 |
| 49 | + ;; |
| 50 | + --dbms) |
| 51 | + COMPREPLY=($(compgen -W 'mysql mssql access postgres' -- "$cur")) |
| 52 | + return 0 |
| 53 | + ;; |
| 54 | + --level | --crawl) |
| 55 | + COMPREPLY=($(compgen -W '1 2 3 4 5' -- "$cur")) |
| 56 | + return 0 |
| 57 | + ;; |
| 58 | + --risk) |
| 59 | + COMPREPLY=($(compgen -W '0 1 2 3' -- "$cur")) |
| 60 | + return 0 |
| 61 | + ;; |
| 62 | + --technique) |
| 63 | + COMPREPLY=($(compgen -W 'B E U S T Q' -- "$cur")) |
| 64 | + return 0 |
| 65 | + ;; |
| 66 | + -s) |
| 67 | + _filedir sqlite |
| 68 | + return 0 |
| 69 | + ;; |
| 70 | + --dump-format) |
| 71 | + COMPREPLY=($(compgen -W 'CSV HTML SQLITE' -- "$cur")) |
| 72 | + return 0 |
| 73 | + ;; |
| 74 | + -x) |
| 75 | + _filedir xml |
| 76 | + return 0 |
| 77 | + ;; |
| 78 | + esac |
81 | 79 |
|
82 | | - if [[ "$cur" == * ]]; then |
83 | | - COMPREPLY=( $( compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \ |
84 | | - --data --param-del --cookie --cookie-del --load-cookies \ |
85 | | - --drop-set-cookie --user-agent --random-agent --host --referer \ |
86 | | - --headers --auth-type --auth-cred --auth-private --ignore-401 \ |
87 | | - --proxy --proxy-cred --proxy-file --ignore-proxy --tor --tor-port \ |
88 | | - --tor-type --check-tor --delay --timeout --retries --randomize \ |
89 | | - --safe-url --safe-freq --skip-urlencode --csrf-token --csrf-url \ |
90 | | - --force-ssl --hpp --eval -o --predict-output --keep-alive \ |
91 | | - --null-connection --threads -p --skip --dbms --dbms-cred \ |
92 | | - --os --invalid-bignum --invalid-logical --invalid-string \ |
93 | | - --no-cast --no-escape --prefix --suffix --tamper --level \ |
94 | | - --risk --string --not-string --regexp --code --text-only \ |
95 | | - --titles --technique --time-sec --union-cols --union-char \ |
96 | | - --union-from --dns-domain --second-order -f --fingerprint \ |
97 | | - -a --all -b --banner --current-user --current-db --hostname \ |
98 | | - --is-dba --users --passwords --privileges --roles --dbs --tables \ |
99 | | - --columns --schema --count --dump --dump-all --search --comments \ |
100 | | - -D -T -C -X -U --exclude-sysdbs --where --start --stop \ |
101 | | - --first --last --sql-query --sql-shell --sql-file --common-tables \ |
102 | | - --common-columns --udf-inject --shared-lib --file-read --file-write \ |
103 | | - --file-dest --os-cmd --os-shell --os-pwn --os-smbrelay --os-bof \ |
104 | | - --priv-esc --msf-path --tmp-path --reg-read --reg-add --reg-del \ |
105 | | - --reg-key --reg-value --reg-data --reg-type -s -t --batch \ |
106 | | - --charset --crawl --csv-del --dump-format --eta --flush-session \ |
107 | | - --forms --fresh-queries --hex --output-dir --parse-errors \ |
108 | | - --pivot-column --save --scope --test-filter --update \ |
109 | | - -z --alert --answers --beep --check-waf --cleanup \ |
110 | | - --dependencies --disable-coloring --gpage --identify-waf \ |
111 | | - --mobile --page-rank --purge-output --smart \ |
112 | | - --sqlmap-shell --wizard' -- "$cur" ) ) |
113 | | - # this removes any options from the list of completions that have |
114 | | - # already been specified somewhere on the command line, as long as |
115 | | - # these options can only be used once (in a word, "options", in |
116 | | - # opposition to "tests" and "actions", as in the find(1) manpage). |
117 | | - onlyonce=' -h --help -hh --version -v -d -u --url -l -x -m -r -g -c \ |
118 | | - --drop-set-cookie --random-agent \ |
119 | | - --ignore-401 \ |
120 | | - --ignore-proxy --tor \ |
121 | | - --check-tor \ |
122 | | - --skip-urlencode \ |
123 | | - --force-ssl --hpp -o --predict-output --keep-alive \ |
124 | | - --null-connection -p \ |
125 | | - --invalid-bignum --invalid-logical --invalid-string \ |
126 | | - --no-cast --no-escape \ |
127 | | - --text-only \ |
128 | | - --titles \ |
129 | | - -f --fingerprint \ |
130 | | - -a --all -b --banner --current-user --current-db --hostname \ |
131 | | - --is-dba --users --passwords --privileges --roles --dbs --tables \ |
132 | | - --columns --schema --count --dump --dump-all --search --comments \ |
133 | | - -D -T -C -X -U --exclude-sysdbs \ |
134 | | - --sql-shell --common-tables \ |
135 | | - --common-columns --udf-inject \ |
136 | | - --os-shell --os-pwn --os-smbrelay --os-bof \ |
137 | | - --priv-esc --reg-read --reg-add --reg-del \ |
138 | | - -s -t --batch \ |
139 | | - --eta --flush-session \ |
140 | | - --forms --fresh-queries --hex --parse-errors \ |
141 | | - --save --update \ |
142 | | - -z --beep --check-waf --cleanup \ |
143 | | - --dependencies --disable-coloring --identify-waf \ |
144 | | - --mobile --page-rank --purge-output --smart \ |
145 | | - --sqlmap-shell --wizard ' |
146 | | - COMPREPLY=( $( \ |
147 | | - (while read -d ' ' i; do |
148 | | - [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && |
149 | | - continue |
150 | | - # flatten array with spaces on either side, |
151 | | - # otherwise we cannot grep on word boundaries of |
152 | | - # first and last word |
153 | | - COMPREPLY=" ${COMPREPLY[@]} " |
154 | | - # remove word from list of completions |
155 | | - COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) |
156 | | - done |
157 | | - printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" |
158 | | - ) ) |
| 80 | + if [[ "$cur" == * ]]; then |
| 81 | + COMPREPLY=($(compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \ |
| 82 | + --data --param-del --cookie --cookie-del --load-cookies \ |
| 83 | + --drop-set-cookie --user-agent --random-agent --host --referer \ |
| 84 | + --headers --auth-type --auth-cred --auth-private --ignore-401 \ |
| 85 | + --proxy --proxy-cred --proxy-file --ignore-proxy --tor --tor-port \ |
| 86 | + --tor-type --check-tor --delay --timeout --retries --randomize \ |
| 87 | + --safe-url --safe-freq --skip-urlencode --csrf-token --csrf-url \ |
| 88 | + --force-ssl --hpp --eval -o --predict-output --keep-alive \ |
| 89 | + --null-connection --threads -p --skip --dbms --dbms-cred \ |
| 90 | + --os --invalid-bignum --invalid-logical --invalid-string \ |
| 91 | + --no-cast --no-escape --prefix --suffix --tamper --level \ |
| 92 | + --risk --string --not-string --regexp --code --text-only \ |
| 93 | + --titles --technique --time-sec --union-cols --union-char \ |
| 94 | + --union-from --dns-domain --second-order -f --fingerprint \ |
| 95 | + -a --all -b --banner --current-user --current-db --hostname \ |
| 96 | + --is-dba --users --passwords --privileges --roles --dbs --tables \ |
| 97 | + --columns --schema --count --dump --dump-all --search --comments \ |
| 98 | + -D -T -C -X -U --exclude-sysdbs --where --start --stop \ |
| 99 | + --first --last --sql-query --sql-shell --sql-file --common-tables \ |
| 100 | + --common-columns --udf-inject --shared-lib --file-read --file-write \ |
| 101 | + --file-dest --os-cmd --os-shell --os-pwn --os-smbrelay --os-bof \ |
| 102 | + --priv-esc --msf-path --tmp-path --reg-read --reg-add --reg-del \ |
| 103 | + --reg-key --reg-value --reg-data --reg-type -s -t --batch \ |
| 104 | + --charset --crawl --csv-del --dump-format --eta --flush-session \ |
| 105 | + --forms --fresh-queries --hex --output-dir --parse-errors \ |
| 106 | + --pivot-column --save --scope --test-filter --update \ |
| 107 | + -z --alert --answers --beep --check-waf --cleanup \ |
| 108 | + --dependencies --disable-coloring --gpage --identify-waf \ |
| 109 | + --mobile --page-rank --purge-output --smart \ |
| 110 | + --sqlmap-shell --wizard' -- "$cur")) |
| 111 | + # this removes any options from the list of completions that have |
| 112 | + # already been specified somewhere on the command line, as long as |
| 113 | + # these options can only be used once (in a word, "options", in |
| 114 | + # opposition to "tests" and "actions", as in the find(1) manpage). |
| 115 | + onlyonce=' -h --help -hh --version -v -d -u --url -l -x -m -r -g -c \ |
| 116 | + --drop-set-cookie --random-agent \ |
| 117 | + --ignore-401 \ |
| 118 | + --ignore-proxy --tor \ |
| 119 | + --check-tor \ |
| 120 | + --skip-urlencode \ |
| 121 | + --force-ssl --hpp -o --predict-output --keep-alive \ |
| 122 | + --null-connection -p \ |
| 123 | + --invalid-bignum --invalid-logical --invalid-string \ |
| 124 | + --no-cast --no-escape \ |
| 125 | + --text-only \ |
| 126 | + --titles \ |
| 127 | + -f --fingerprint \ |
| 128 | + -a --all -b --banner --current-user --current-db --hostname \ |
| 129 | + --is-dba --users --passwords --privileges --roles --dbs --tables \ |
| 130 | + --columns --schema --count --dump --dump-all --search --comments \ |
| 131 | + -D -T -C -X -U --exclude-sysdbs \ |
| 132 | + --sql-shell --common-tables \ |
| 133 | + --common-columns --udf-inject \ |
| 134 | + --os-shell --os-pwn --os-smbrelay --os-bof \ |
| 135 | + --priv-esc --reg-read --reg-add --reg-del \ |
| 136 | + -s -t --batch \ |
| 137 | + --eta --flush-session \ |
| 138 | + --forms --fresh-queries --hex --parse-errors \ |
| 139 | + --save --update \ |
| 140 | + -z --beep --check-waf --cleanup \ |
| 141 | + --dependencies --disable-coloring --identify-waf \ |
| 142 | + --mobile --page-rank --purge-output --smart \ |
| 143 | + --sqlmap-shell --wizard ' |
| 144 | + COMPREPLY=($( |
| 145 | + ( |
| 146 | + while read -d ' ' i; do |
| 147 | + [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && continue |
| 148 | + # flatten array with spaces on either side, |
| 149 | + # otherwise we cannot grep on word boundaries of |
| 150 | + # first and last word |
| 151 | + COMPREPLY=" ${COMPREPLY[@]} " |
| 152 | + # remove word from list of completions |
| 153 | + COMPREPLY=(${COMPREPLY/ ${i%% *} / }) |
| 154 | + done |
| 155 | + printf '%s ' "${COMPREPLY[@]}" |
| 156 | + ) <<< "${COMP_WORDS[@]}" |
| 157 | + )) |
159 | 158 |
|
160 | | - # else |
161 | | - # _filedir bat |
162 | | - fi |
163 | | - } |
| 159 | + #else |
| 160 | + #_filedir bat |
| 161 | + fi |
| 162 | +} |
164 | 163 |
|
165 | | - |
166 | | - complete -F _sqlmap sqlmap |
167 | | - |
168 | | -fi |
| 164 | +complete -F _sqlmap sqlmap |
0 commit comments