Used metasploit's cache to make completion faster
This commit is contained in:
parent
f421b08475
commit
92b8614b8c
1 changed files with 8 additions and 17 deletions
|
@ -18,7 +18,6 @@
|
||||||
#
|
#
|
||||||
# * Spencer McIntyre
|
# * Spencer McIntyre
|
||||||
#
|
#
|
||||||
# * Extended by Jonathan Hodgson
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
_msfvenom_archs_list=(
|
_msfvenom_archs_list=(
|
||||||
|
@ -208,27 +207,19 @@ _msfvenom_platform() {
|
||||||
_describe -t platforms 'available platforms' _msfvenom_platforms_list || compadd "$@"
|
_describe -t platforms 'available platforms' _msfvenom_platforms_list || compadd "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
local -a _msfvenom_payload_list
|
|
||||||
|
|
||||||
if [ -f "$HOME/.local/cache/msfvenom/payloads.txt" ]; then
|
|
||||||
while read line; do
|
|
||||||
_msfvenom_payload_list+=("$line")
|
|
||||||
done < "$HOME/.local/cache/msfvenom/payloads.txt"
|
|
||||||
fi
|
|
||||||
|
|
||||||
_msfvenom_payload() {
|
_msfvenom_payload() {
|
||||||
if [ ${#_msfvenom_payload_list[@]} -ne 0 ]; then
|
local cacheFile="$HOME/.msf4/store/modules_metadata.json"
|
||||||
_describe -t payloads 'available payloads' _msfvenom_payload_list || compadd "$@"
|
local -a _msfvenom_payloads_list
|
||||||
|
[ -f "$cacheFile" ] || cacheFile="/opt/metasploit/db/modules_metadata_base.json"
|
||||||
|
if [ ! -f "$cacheFile" ]; then
|
||||||
|
_message -r "Cannot find metasploit cache file. Run msfconsole to populate it"
|
||||||
|
compadd "$@"
|
||||||
else
|
else
|
||||||
_message -r "You need to pre-populate the payload cache, run the following commands:"
|
_msfvenom_payloads_list=("${(f)$(sed -n '/"type": "payload"/,/"ref_name"/p' "$cacheFile" | grep -E '(ref_name|description)' | cut -d '"' -f 4 | sed -n 'h;n;p;g;p' | sed 'N;s/\n/:/')}")
|
||||||
_message -r ""
|
_describe -t payloads 'available payloads' _msfvenom_payloads_list || compadd "$@"
|
||||||
_message -r "mkdir -p \$HOME/.local/cache/msfvenom/"
|
|
||||||
_message -r "msfvenom --list payloads 2> /dev/null | tail -n +5 | sed '2d' | awk -F ' +' '{print \$2 \":\" \$3}' > \$HOME/.local/cache/msfvenom/payloads.txt"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
"--smallest[Generate the smallest possible payload using all available encoders]" \
|
"--smallest[Generate the smallest possible payload using all available encoders]" \
|
||||||
"--sec-name[The new section name to use when generating large Windows binaries. Default: random 4-character alpha string]" \
|
"--sec-name[The new section name to use when generating large Windows binaries. Default: random 4-character alpha string]" \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue