@@ -58,94 +58,95 @@ require 'msf/core/payload_generator'
58
58
opt . separator ( '' )
59
59
opt . separator ( 'Options:' )
60
60
61
- opt . on ( '-p' , '--payload <payload>' , String , 'Payload to use. Specify a \'-\' or stdin to use custom payloads' ) do |p |
61
+ opt . on ( '-p' , '--payload <payload>' , String ,
62
+ 'Payload to use. Specify a \'-\' or stdin to use custom payloads' ) do |p |
62
63
if p == '-'
63
64
opts [ :payload ] = 'stdin'
64
65
else
65
66
opts [ :payload ] = p
66
67
end
67
68
end
68
69
69
- opt . on ( '-l' , '--list [module_type]' , Array , 'List a module type. Options are: payloads, encoders, nops, all' ) do |l |
70
+ opt . on ( '--payload-options' , "List the payload's standard options" ) do
71
+ opts [ :list_options ] = true
72
+ end
73
+
74
+ opt . on ( '-l' , '--list [type]' , Array , 'List a module type. Options are: payloads, encoders, nops, all' ) do |l |
70
75
if l . nil? or l . empty?
71
76
l = [ "all" ]
72
77
end
73
78
opts [ :list ] = l
74
79
end
75
80
76
- opt . on ( '-n' , '--nopsled <length>' , Integer , 'Prepend a nopsled of [length] size on to the payload' ) do |n |
81
+ opt . on ( '-n' , '--nopsled <length>' , Integer , 'Prepend a nopsled of [length] size on to the payload' ) do |n |
77
82
opts [ :nops ] = n . to_i
78
83
end
79
84
80
- opt . on ( '-f' , '--format <format>' , String , "Output format (use --help-formats for a list)" ) do |f |
85
+ opt . on ( '-f' , '--format <format>' , String , "Output format (use --help-formats for a list)" ) do |f |
81
86
opts [ :format ] = f
82
87
end
83
88
84
- opt . on ( '-e' , '--encoder [encoder]' , String , 'The encoder to use' ) do |e |
89
+ opt . on ( '--help-formats' , String , "List available formats" ) do
90
+ init_framework ( :module_types => [ ] )
91
+ msg = "Executable formats\n " +
92
+ "\t " + ::Msf ::Util ::EXE . to_executable_fmt_formats . join ( ", " ) + "\n " +
93
+ "Transform formats\n " +
94
+ "\t " + ::Msf ::Simple ::Buffer . transform_formats . join ( ", " )
95
+ raise UsageError , msg
96
+ end
97
+
98
+ opt . on ( '-e' , '--encoder <encoder>' , String , 'The encoder to use' ) do |e |
85
99
opts [ :encoder ] = e
86
100
end
87
101
88
- opt . on ( '-a' , '--arch <architecture >' , String , 'The architecture to use' ) do |a |
102
+ opt . on ( '-a' , '--arch <arch >' , String , 'The architecture to use' ) do |a |
89
103
opts [ :arch ] = a
90
104
end
91
105
92
- opt . on ( '--platform <platform>' , String , 'The platform of the payload' ) do |l |
106
+ opt . on ( '--platform <platform>' , String , 'The platform of the payload' ) do |l |
93
107
opts [ :platform ] = l
94
108
end
95
109
96
- opt . on ( '-s' , '--space <length>' , Integer , 'The maximum size of the resulting payload' ) do |s |
110
+ opt . on ( '-s' , '--space <length>' , Integer , 'The maximum size of the resulting payload' ) do |s |
97
111
opts [ :space ] = s
98
112
end
99
113
100
- opt . on ( '--encoder-space <length>' , Integer , 'The maximum size of the encoded payload (defaults to the -s value)' ) do |s |
114
+ opt . on ( '--encoder-space <length>' , Integer , 'The maximum size of the encoded payload (defaults to the -s value)' ) do |s |
101
115
opts [ :encoder_space ] = s
102
116
end
103
117
104
- opt . on ( '-b' , '--bad-chars <list>' , String , 'The list of characters to avoid example: \'\x00\xff\'' ) do |b |
118
+ opt . on ( '-b' , '--bad-chars <list>' , String , 'The list of characters to avoid example: \'\x00\xff\'' ) do |b |
105
119
opts [ :badchars ] = Rex ::Text . hex_to_raw ( b )
106
120
end
107
121
108
- opt . on ( '-i' , '--iterations <count>' , Integer , 'The number of times to encode the payload' ) do |i |
122
+ opt . on ( '-i' , '--iterations <count>' , Integer , 'The number of times to encode the payload' ) do |i |
109
123
opts [ :iterations ] = i
110
124
end
111
125
112
- opt . on ( '-c' , '--add-code <path>' , String , 'Specify an additional win32 shellcode file to include' ) do |x |
126
+ opt . on ( '-c' , '--add-code <path>' , String , 'Specify an additional win32 shellcode file to include' ) do |x |
113
127
opts [ :add_code ] = x
114
128
end
115
129
116
- opt . on ( '-x' , '--template <path>' , String , 'Specify a custom executable file to use as a template' ) do |x |
130
+ opt . on ( '-x' , '--template <path>' , String , 'Specify a custom executable file to use as a template' ) do |x |
117
131
opts [ :template ] = x
118
132
end
119
133
120
134
opt . on ( '-k' , '--keep' , 'Preserve the template behavior and inject the payload as a new thread' ) do
121
135
opts [ :keep ] = true
122
136
end
123
137
124
- opt . on ( '--payload-options' , "List the payload's standard options" ) do
125
- opts [ :list_options ] = true
126
- end
127
-
128
- opt . on ( '-o' , '--out <path>' , 'Save the payload' ) do |x |
138
+ opt . on ( '-o' , '--out <path>' , 'Save the payload' ) do |x |
129
139
opts [ :out ] = x
130
140
end
131
141
132
- opt . on ( '-v' , '--var-name <name>' , String , 'Specify a custom variable name to use for certain output formats' ) do |x |
142
+ opt . on ( '-v' , '--var-name <name>' , String , 'Specify a custom variable name to use for certain output formats' ) do |x |
133
143
opts [ :var_name ] = x
134
144
end
135
145
136
146
opt . on_tail ( '-h' , '--help' , 'Show this message' ) do
137
147
raise UsageError , "#{ opt } "
138
148
end
139
149
140
- opt . on_tail ( '--help-formats' , String , "List available formats" ) do
141
- init_framework ( :module_types => [ ] )
142
- msg = "Executable formats\n " +
143
- "\t " + ::Msf ::Util ::EXE . to_executable_fmt_formats . join ( ", " ) + "\n " +
144
- "Transform formats\n " +
145
- "\t " + ::Msf ::Simple ::Buffer . transform_formats . join ( ", " )
146
- raise UsageError , msg
147
- end
148
-
149
150
begin
150
151
opt . parse! ( args )
151
152
rescue OptionParser ::InvalidOption => e
0 commit comments