pull/1962/merge
John D Pell 2023-07-22 14:31:54 +08:00 committed by GitHub
commit 84c9b07e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 148 additions and 152 deletions

View File

@ -7,11 +7,9 @@
# | # |
# ---------------------------------------------------------------------------+ # ---------------------------------------------------------------------------+
if _command_exists sqlmap _command_exists sqlmap || return
then
function _sqlmap() function _sqlmap() {
{
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
@ -22,10 +20,10 @@ then
# List directory content # List directory content
--tamper) --tamper)
COMPREPLY=( $( compgen -W "$tamper" -- "$cur" ) ) COMPREPLY=($(compgen -W "$tamper" -- "$cur"))
return 0 return 0
;; ;;
--output-dir|-t|-l|-m|-r|--load-cookies|--proxy-file|--sql-file|--shared-lib|--file-write) --output-dir | -t | -l | -m | -r | --load-cookies | --proxy-file | --sql-file | --shared-lib | --file-write)
_filedir _filedir
return 0 return 0
;; ;;
@ -34,35 +32,35 @@ then
return 0 return 0
;; ;;
--method) --method)
COMPREPLY=( $( compgen -W 'GET POST PUT' -- "$cur" ) ) COMPREPLY=($(compgen -W 'GET POST PUT' -- "$cur"))
return 0 return 0
;; ;;
--auth-type) --auth-type)
COMPREPLY=( $( compgen -W 'Basic Digest NTLM PKI' -- "$cur" ) ) COMPREPLY=($(compgen -W 'Basic Digest NTLM PKI' -- "$cur"))
return 0 return 0
;; ;;
--tor-type) --tor-type)
COMPREPLY=( $( compgen -W 'HTTP SOCKS4 SOCKS5' -- "$cur" ) ) COMPREPLY=($(compgen -W 'HTTP SOCKS4 SOCKS5' -- "$cur"))
return 0 return 0
;; ;;
-v) -v)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) ) COMPREPLY=($(compgen -W '1 2 3 4 5 6' -- "$cur"))
return 0 return 0
;; ;;
--dbms) --dbms)
COMPREPLY=( $( compgen -W 'mysql mssql access postgres' -- "$cur" ) ) COMPREPLY=($(compgen -W 'mysql mssql access postgres' -- "$cur"))
return 0 return 0
;; ;;
--level|--crawl) --level | --crawl)
COMPREPLY=( $( compgen -W '1 2 3 4 5' -- "$cur" ) ) COMPREPLY=($(compgen -W '1 2 3 4 5' -- "$cur"))
return 0 return 0
;; ;;
--risk) --risk)
COMPREPLY=( $( compgen -W '0 1 2 3' -- "$cur" ) ) COMPREPLY=($(compgen -W '0 1 2 3' -- "$cur"))
return 0 return 0
;; ;;
--technique) --technique)
COMPREPLY=( $( compgen -W 'B E U S T Q' -- "$cur" ) ) COMPREPLY=($(compgen -W 'B E U S T Q' -- "$cur"))
return 0 return 0
;; ;;
-s) -s)
@ -70,7 +68,7 @@ then
return 0 return 0
;; ;;
--dump-format) --dump-format)
COMPREPLY=( $( compgen -W 'CSV HTML SQLITE' -- "$cur" ) ) COMPREPLY=($(compgen -W 'CSV HTML SQLITE' -- "$cur"))
return 0 return 0
;; ;;
-x) -x)
@ -80,7 +78,7 @@ then
esac esac
if [[ "$cur" == * ]]; then if [[ "$cur" == * ]]; then
COMPREPLY=( $( compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \ COMPREPLY=($(compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \
--data --param-del --cookie --cookie-del --load-cookies \ --data --param-del --cookie --cookie-del --load-cookies \
--drop-set-cookie --user-agent --random-agent --host --referer \ --drop-set-cookie --user-agent --random-agent --host --referer \
--headers --auth-type --auth-cred --auth-private --ignore-401 \ --headers --auth-type --auth-cred --auth-private --ignore-401 \
@ -109,7 +107,7 @@ then
-z --alert --answers --beep --check-waf --cleanup \ -z --alert --answers --beep --check-waf --cleanup \
--dependencies --disable-coloring --gpage --identify-waf \ --dependencies --disable-coloring --gpage --identify-waf \
--mobile --page-rank --purge-output --smart \ --mobile --page-rank --purge-output --smart \
--sqlmap-shell --wizard' -- "$cur" ) ) --sqlmap-shell --wizard' -- "$cur"))
# this removes any options from the list of completions that have # this removes any options from the list of completions that have
# already been specified somewhere on the command line, as long as # already been specified somewhere on the command line, as long as
# these options can only be used once (in a word, "options", in # these options can only be used once (in a word, "options", in
@ -143,26 +141,24 @@ then
--dependencies --disable-coloring --identify-waf \ --dependencies --disable-coloring --identify-waf \
--mobile --page-rank --purge-output --smart \ --mobile --page-rank --purge-output --smart \
--sqlmap-shell --wizard ' --sqlmap-shell --wizard '
COMPREPLY=( $( \ COMPREPLY=($(
(while read -d ' ' i; do (
[[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && while read -d ' ' i; do
continue [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && continue
# flatten array with spaces on either side, # flatten array with spaces on either side,
# otherwise we cannot grep on word boundaries of # otherwise we cannot grep on word boundaries of
# first and last word # first and last word
COMPREPLY=" ${COMPREPLY[@]} " COMPREPLY=" ${COMPREPLY[@]} "
# remove word from list of completions # remove word from list of completions
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) COMPREPLY=(${COMPREPLY/ ${i%% *} / })
done done
printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" printf '%s ' "${COMPREPLY[@]}"
) ) ) <<< "${COMP_WORDS[@]}"
))
# else #else
# _filedir bat #_filedir bat
fi fi
} }
complete -F _sqlmap sqlmap
complete -F _sqlmap sqlmap
fi