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