Skip to content

Commit ee92648

Browse files
committed
Land rapid7#3906, Zsh completion for Metasploit
2 parents 0380c5e + 3181d4e commit ee92648

File tree

4 files changed

+205
-0
lines changed

4 files changed

+205
-0
lines changed

external/zsh/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Metasploit completion definitions for zsh. The directory containing the
2+
completion files needs to be added to the ```$fpath``` environment variable,
3+
this is usually done in the ```~/.zshrc``` file.

external/zsh/_msfconsole

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#compdef msfconsole
2+
# ------------------------------------------------------------------------------
3+
# License
4+
# -------
5+
# This file is part of the Metasploit Framework and is released under the MSF
6+
# License, please see the COPYING file for more details.
7+
#
8+
# ------------------------------------------------------------------------------
9+
# Description
10+
# -----------
11+
#
12+
# Completion script for the Metasploit Framework's msfconsole command
13+
# (http://www.metasploit.com/).
14+
#
15+
# ------------------------------------------------------------------------------
16+
# Authors
17+
# -------
18+
#
19+
# * Spencer McIntyre
20+
#
21+
# ------------------------------------------------------------------------------
22+
23+
_arguments \
24+
{-a,--ask}"[Ask before exiting Metasploit or accept 'exit -y']" \
25+
"-c[Load the specified configuration file]:configuration file:_files" \
26+
{-d,--defanged}"[Execute the console as defanged]" \
27+
{-E,--environment}"[Specify the database environment to load from the configuration]:environment:(production development)" \
28+
{-h,--help}"[Show help text]" \
29+
{-L,--real-readline}"[Use the system Readline library instead of RbReadline]" \
30+
{-M,--migration-path}"[Specify a directory containing additional DB migrations]:directory:_files -/" \
31+
{-m,--module-path}"[Specifies an additional module search path]:search path:_files -/" \
32+
{-n,--no-database}"[Disable database support]" \
33+
{-o,--output}"[Output to the specified file]:output file" \
34+
{-p,--plugin}"[Load a plugin on startup]:plugin file:_files" \
35+
{-q,--quiet}"[Do not print the banner on start up]" \
36+
{-r,--resource}"[Execute the specified resource file]:resource file:_files" \
37+
{-v,--version}"[Show version]" \
38+
{-x,--execute-command}"[Execute the specified string as console commands]:commands" \
39+
{-y,--yaml}"[Specify a YAML file containing database settings]:yaml file:_files"

external/zsh/_msfencode

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#compdef msfencode
2+
# ------------------------------------------------------------------------------
3+
# License
4+
# -------
5+
# This file is part of the Metasploit Framework and is released under the MSF
6+
# License, please see the COPYING file for more details.
7+
#
8+
# ------------------------------------------------------------------------------
9+
# Description
10+
# -----------
11+
#
12+
# Completion script for the Metasploit Framework's msfencode command
13+
# (http://www.metasploit.com/).
14+
#
15+
# ------------------------------------------------------------------------------
16+
# Authors
17+
# -------
18+
#
19+
# * Spencer McIntyre
20+
#
21+
# ------------------------------------------------------------------------------
22+
23+
_msfencode_encoders_list=(
24+
'cmd/generic_sh'
25+
'cmd/ifs'
26+
'cmd/powershell_base64'
27+
'cmd/printf_php_mq'
28+
'generic/eicar'
29+
'generic/none'
30+
'mipsbe/byte_xori'
31+
'mipsbe/longxor'
32+
'mipsle/byte_xori'
33+
'mipsle/longxor'
34+
'php/base64'
35+
'ppc/longxor'
36+
'ppc/longxor_tag'
37+
'sparc/longxor_tag'
38+
'x64/xor'
39+
'x86/add_sub'
40+
'x86/alpha_mixed'
41+
'x86/alpha_upper'
42+
'x86/avoid_underscore_tolower'
43+
'x86/avoid_utf8_tolower'
44+
'x86/bloxor'
45+
'x86/call4_dword_xor'
46+
'x86/context_cpuid'
47+
'x86/context_stat'
48+
'x86/context_time'
49+
'x86/countdown'
50+
'x86/fnstenv_mov'
51+
'x86/jmp_call_additive'
52+
'x86/nonalpha'
53+
'x86/nonupper'
54+
'x86/opt_sub'
55+
'x86/shikata_ga_nai'
56+
'x86/single_static_bit'
57+
'x86/unicode_mixed'
58+
'x86/unicode_upper'
59+
)
60+
61+
_msfencode_encoder() {
62+
_describe -t encoders 'available encoders' _msfencode_encoders_list || compadd "$@"
63+
}
64+
65+
_arguments \
66+
"-a[The architecture to encode as]:architecture:(cmd generic mipsbe mipsle php ppc sparc x64 x86)" \
67+
"-b[The list of characters to avoid, example: '\x00\xff']:bad characters" \
68+
"-c[The number of times to encode the data]:times" \
69+
"-d[Specify the directory in which to look for EXE templates]:template file:_files -/" \
70+
"-e[The encoder to use]:encoder:_msfencode_encoder" \
71+
"-h[Help banner]" \
72+
"-i[Encode the contents of the supplied file path]:input file:_files" \
73+
"-k[Keep template working; run payload in new thread (use with -x)]" \
74+
"-l[List available encoders]" \
75+
"-m[Specifies an additional module search path]:module path:_files -/" \
76+
"-n[Dump encoder information]" \
77+
"-o[The output file]:output file" \
78+
"-p[The platform to encode for]:target platform:(android bsd bsdi java linux netware nodejs osx php python ruby solaris unix win)" \
79+
"-s[The maximum size of the encoded data]:maximum size" \
80+
"-t[The output format]:output format:(bash c csharp dw dword java js_be js_le num perl pl powershell ps1 py python raw rb ruby sh vbapplication vbscript asp aspx aspx-exe dll elf exe exe-only exe-service exe-small loop-vbs macho msi msi-nouac osx-app psh psh-net psh-reflection vba vba-exe vbs war)" \
81+
"-v[Increase verbosity]" \
82+
"-x[Specify an alternate executable template]:template file:_files"

external/zsh/_msfvenom

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#compdef msfvenom
2+
# ------------------------------------------------------------------------------
3+
# License
4+
# -------
5+
# This file is part of the Metasploit Framework and is released under the MSF
6+
# License, please see the COPYING file for more details.
7+
#
8+
# ------------------------------------------------------------------------------
9+
# Description
10+
# -----------
11+
#
12+
# Completion script for the Metasploit Framework's msfvenom command
13+
# (http://www.metasploit.com/).
14+
#
15+
# ------------------------------------------------------------------------------
16+
# Authors
17+
# -------
18+
#
19+
# * Spencer McIntyre
20+
#
21+
# ------------------------------------------------------------------------------
22+
23+
_msfvenom_encoders_list=(
24+
'cmd/generic_sh'
25+
'cmd/ifs'
26+
'cmd/powershell_base64'
27+
'cmd/printf_php_mq'
28+
'generic/eicar'
29+
'generic/none'
30+
'mipsbe/byte_xori'
31+
'mipsbe/longxor'
32+
'mipsle/byte_xori'
33+
'mipsle/longxor'
34+
'php/base64'
35+
'ppc/longxor'
36+
'ppc/longxor_tag'
37+
'sparc/longxor_tag'
38+
'x64/xor'
39+
'x86/add_sub'
40+
'x86/alpha_mixed'
41+
'x86/alpha_upper'
42+
'x86/avoid_underscore_tolower'
43+
'x86/avoid_utf8_tolower'
44+
'x86/bloxor'
45+
'x86/call4_dword_xor'
46+
'x86/context_cpuid'
47+
'x86/context_stat'
48+
'x86/context_time'
49+
'x86/countdown'
50+
'x86/fnstenv_mov'
51+
'x86/jmp_call_additive'
52+
'x86/nonalpha'
53+
'x86/nonupper'
54+
'x86/opt_sub'
55+
'x86/shikata_ga_nai'
56+
'x86/single_static_bit'
57+
'x86/unicode_mixed'
58+
'x86/unicode_upper'
59+
)
60+
61+
_msfvenom_encoder() {
62+
_describe -t encoders 'available encoders' _msfvenom_encoders_list || compadd "$@"
63+
}
64+
65+
_arguments \
66+
{-a,--arch}"[The architecture to encode as]:architecture:(cmd generic mipsbe mipsle php ppc sparc x64 x86)" \
67+
{-b,--bad-chars}"[The list of characters to avoid, example: '\x00\xff']:bad characters" \
68+
{-c,--add-code}"[Specify an additional win32 shellcode file to include]:shellcode file:_files" \
69+
{-e,--encoder}"[The encoder to use]:encoder:_msfvenom_encoder" \
70+
{-f,--format}"[Output format]:output format:(bash c csharp dw dword java js_be js_le num perl pl powershell ps1 py python raw rb ruby sh vbapplication vbscript asp aspx aspx-exe dll elf exe exe-only exe-service exe-small loop-vbs macho msi msi-nouac osx-app psh psh-net psh-reflection vba vba-exe vbs war)" \
71+
"--help-formats[List available formats]" \
72+
{-h,--help}"[Help banner]" \
73+
{-i,--iterations}"[The number of times to encode the payload]:iterations" \
74+
{-k,--keep}"[Preserve the template behavior and inject the payload as a new thread]" \
75+
{-l,--list}"[List a module type]:module type:(all encoders nops payloads)" \
76+
{-n,--nopsled}"[Prepend a nopsled of length size on to the payload]:nopsled length" \
77+
{-o,--options}"[List the payload's standard options]" \
78+
"--platform[The platform to encode for]:target platform:(android bsd bsdi java linux netware nodejs osx php python ruby solaris unix win)" \
79+
{-p,--payload}"[Payload to use. Specify a '-' or stdin to use custom payloads]:payload" \
80+
{-s,--space}"[The maximum size of the resulting payload]:length" \
81+
{-x,--template}"[Specify an alternate executable template]:template file:_files"

0 commit comments

Comments
 (0)