added completions for metasploit commands

- msfconsole
- msfdb
- msfvenom
This commit is contained in:
exploide 2020-04-21 18:07:52 +02:00 committed by Fabian Homborg
parent bd44c3a5cb
commit c0542727c4
3 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,28 @@
complete -c msfconsole -f
# Common options
complete -c msfconsole -s E -l environment -x -d 'Set Rails environment'
# Database options
complete -c msfconsole -s M -l migration-path -xa "(__fish_complete_directories)" -d 'Directory containing additional DB migrations'
complete -c msfconsole -s n -l no-database -d 'Disable database support'
complete -c msfconsole -s y -l yaml -F -d 'YAML file containing database settings'
# Framework options
complete -c msfconsole -s c -F -d 'Load the specified configuration file'
complete -c msfconsole -s v -s V -l version -d 'Show version'
# Module options
complete -c msfconsole -l defer-module-loads -d 'Defer module loading'
complete -c msfconsole -s m -l module-path -xa "(__fish_complete_directories)" -d 'Load an additional module path'
# Console options
complete -c msfconsole -s a -l ask -d 'Ask before exiting Metasploit'
complete -c msfconsole -s H -l history-file -F -d 'Save command history to the specified file'
complete -c msfconsole -s L -l real-readline -d 'Use the system Readline library'
complete -c msfconsole -s o -l output -F -d 'Output to the specified file'
complete -c msfconsole -s p -l plugin -x -d 'Load a plugin on startup'
complete -c msfconsole -s q -l quiet -d 'Do not print the banner on startup'
complete -c msfconsole -s r -l resource -F -d 'Execute the specified resource file'
complete -c msfconsole -s x -l execute-command -x -d 'Execute the specified console commands'
complete -c msfconsole -s h -l help -d 'Show help message'

View File

@ -0,0 +1,41 @@
complete -c msfdb -f
# Commands
complete -c msfdb -n '__fish_use_subcommand' -x -a init -d 'Initialize the component'
complete -c msfdb -n '__fish_use_subcommand' -x -a reinit -d 'Delete and reinitialize the component'
complete -c msfdb -n '__fish_use_subcommand' -x -a delete -d 'Delete and stop the component'
complete -c msfdb -n '__fish_use_subcommand' -x -a status -d 'Check component status'
complete -c msfdb -n '__fish_use_subcommand' -x -a start -d 'Start the component'
complete -c msfdb -n '__fish_use_subcommand' -x -a stop -d 'Stop the component'
complete -c msfdb -n '__fish_use_subcommand' -x -a restart -d 'Restart the component'
# General Options
complete -c msfdb -l component -x -a 'all database webservice' -d 'Component used with provided command'
complete -c msfdb -s d -l debug -d 'Enable debug output'
complete -c msfdb -s h -l help -d 'Show help message'
complete -c msfdb -l use-defaults -d 'Accept all defaults and do not prompt for options'
# Database Options
complete -c msfdb -l msf-db-name -x -d 'Database name'
complete -c msfdb -l msf-db-user-name -x -d 'Database username'
complete -c msfdb -l msf-test-db-name -x -d 'Test database name'
complete -c msfdb -l msf-test-db-user-name -x -d 'Test database username'
complete -c msfdb -l db-port -x -d 'Database port'
complete -c msfdb -l db-pool -x -d 'Database connection pool size'
# Web Service Options
complete -c msfdb -s a -l address -x -a "(__fish_print_addresses)" -d 'Bind to host address'
complete -c msfdb -s p -l port -x -d 'Web service port'
complete -c msfdb -l ssl -d 'Enable SSL'
complete -c msfdb -l no-ssl -d 'Disable SSL'
complete -c msfdb -l ssl-key-file -F -d 'Path to private key'
complete -c msfdb -l ssl-cert-file -F -d 'Path to certificate'
complete -c msfdb -l ssl-disable-verify -d 'Disables (optional) client cert requests'
complete -c msfdb -l no-ssl-disable-verify -d 'Enables (optional) client cert requests'
complete -c msfdb -l environment -xa 'production development' -d 'Web service framework environment'
complete -c msfdb -l retry-max -x -d 'Maximum number of web service connect attempts'
complete -c msfdb -l retry-delay -x -d 'Delay (seconds) between web service connect attempts'
complete -c msfdb -l user -x -d 'Initial web service admin username'
complete -c msfdb -l pass -x -d 'Initial web service admin password'
complete -c msfdb -l msf-data-service -x -d 'Local msfconsole data service connection name'
complete -c msfdb -l no-msf-data-service -x -d 'Disable local msfconsole data service connection'

View File

@ -0,0 +1,74 @@
function __fish_msf_db_running
msfdb status 2> /dev/null | string match -q -r 'Database started|Active: active'
end
function __fish_complete_msf_payloads
if not set -q __fish_msf_cached_payloads; and __fish_msf_db_running
set -g __fish_msf_cached_payloads (msfvenom -l payloads | string replace -f -r '^\s*([[:lower:]]\S*)\s+(\S.*)' '$1\t$2' | string collect)
end
echo $__fish_msf_cached_payloads
end
function __fish_complete_msf_formats
if not set -q __fish_msf_cached_formats; and __fish_msf_db_running
set -g __fish_msf_cached_formats (msfvenom -l formats | string replace -f -r '^\s*([[:lower:]]\S*)' '$1' | string collect)
end
echo $__fish_msf_cached_formats
end
function __fish_complete_msf_encoders
if not set -q __fish_msf_cached_encoders; and __fish_msf_db_running
set -g __fish_msf_cached_encoders (msfvenom -l encoders | string replace -f -r '^\s*([[:lower:]]\S*)\s+\S+\s+(\S.*)' '$1\t$2' | string collect)
end
echo $__fish_msf_cached_encoders
end
function __fish_complete_msf_encrypt
if not set -q __fish_msf_cached_encrypt; and __fish_msf_db_running
set -g __fish_msf_cached_encrypt (msfvenom -l encrypt | string replace -f -r '^\s*([[:lower:]]\S*)' '$1' | string collect)
end
echo $__fish_msf_cached_encrypt
end
function __fish_complete_msf_archs
if not set -q __fish_msf_cached_archs; and __fish_msf_db_running
set -g __fish_msf_cached_archs (msfvenom -l archs | string replace -f -r '^\s*([[:lower:]]\S*)' '$1' | string collect)
end
echo $__fish_msf_cached_archs
end
function __fish_complete_msf_platforms
if not set -q __fish_msf_cached_platforms; and __fish_msf_db_running
set -g __fish_msf_cached_platforms (msfvenom -l platforms | string replace -f -r '^\s*([[:lower:]]\S*)' '$1' | string collect)
end
echo $__fish_msf_cached_platforms
end
complete -c msfvenom -f
complete -c msfvenom -s l -l list -xa 'payloads encoders nops platforms archs encrypt formats all' -d 'List all modules for type'
complete -c msfvenom -s p -l payload -xa "(__fish_complete_msf_payloads)" -d 'Payload to use'
complete -c msfvenom -l list-options -d 'List options for payload'
complete -c msfvenom -s f -l format -xa "(__fish_complete_msf_formats)" -d 'Output format'
complete -c msfvenom -s e -l encoder -xa "(__fish_complete_msf_encoders)" -d 'The encoder to use'
complete -c msfvenom -l sec-name -x -d 'Section name when generating Windows binaries'
complete -c msfvenom -l smallest -d 'Generate the smallest possible payload'
complete -c msfvenom -l encrypt -xa "(__fish_complete_msf_encrypt)" -d 'Type of encryption to apply to the shellcode'
complete -c msfvenom -l encrypt-key -x -d 'A key to be used for --encrypt'
complete -c msfvenom -l encrypt-iv -x -d 'An initialization vector for --encrypt'
complete -c msfvenom -s a -l arch -xa "(__fish_complete_msf_archs)" -d 'The architecture to use'
complete -c msfvenom -l platform -xa "(__fish_complete_msf_platforms)" -d 'The platform to use'
complete -c msfvenom -s o -l out -F -d 'Save the payload to a file'
complete -c msfvenom -s b -l bad-chars -x -d 'Characters to avoid'
complete -c msfvenom -s n -l nopsled -x -d 'Prepend a nopsled'
complete -c msfvenom -l pad-nops -d 'Use nopsled size as total payload size'
complete -c msfvenom -s s -l space -x -d 'Maximum size of the resulting payload'
complete -c msfvenom -l encoder-space -x -d 'Maximum size of the encoded payload'
complete -c msfvenom -s i -l iterations -x -d 'Number of times to encode the payload'
complete -c msfvenom -s c -l add-code -F -d 'Additional win32 shellcode file to include'
complete -c msfvenom -s x -l template -F -d 'Custom executable file to use as a template'
complete -c msfvenom -s k -l keep -d 'Inject the payload as a new thread (for template)'
complete -c msfvenom -s v -l var-name -x -d 'Custom variable name for certain output formats'
complete -c msfvenom -s t -l timeout -x -d 'Number of seconds to wait when reading the payload'
complete -c msfvenom -s h -l help -d 'Show help message'