File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,10 @@ def choose_arch(mod)
144
144
if arch . blank?
145
145
@arch = mod . arch . first
146
146
cli_print "No Arch selected, selecting Arch: #{ arch } from the payload"
147
+ datastore [ 'ARCH' ] = arch if mod . kind_of? ( Msf ::Payload ::Generic )
147
148
return mod . arch . first
148
149
elsif mod . arch . include? arch
150
+ datastore [ 'ARCH' ] = arch if mod . kind_of? ( Msf ::Payload ::Generic )
149
151
return arch
150
152
else
151
153
return nil
@@ -157,14 +159,28 @@ def choose_arch(mod)
157
159
# @param mod [Msf::Payload] The module class to choose a platform for
158
160
# @return [Msf::Module::PlatformList] The selected platform list
159
161
def choose_platform ( mod )
162
+ # By default, platform_list will at least return Msf::Module::Platform
163
+ # if there is absolutely no pre-configured platform info at all
160
164
chosen_platform = platform_list
165
+
161
166
if chosen_platform . platforms . empty?
162
167
chosen_platform = mod . platform
163
168
cli_print "No platform was selected, choosing #{ chosen_platform . platforms . first } from the payload"
164
169
@platform = mod . platform . platforms . first . to_s . split ( "::" ) . last
165
170
elsif ( chosen_platform & mod . platform ) . empty?
166
171
chosen_platform = Msf ::Module ::PlatformList . new
167
172
end
173
+
174
+ begin
175
+ platform_object = Msf ::Module ::Platform . find_platform ( platform )
176
+ rescue ArgumentError
177
+ platform_object = nil
178
+ end
179
+
180
+ if mod . kind_of? ( Msf ::Payload ::Generic ) && mod . send ( :module_info ) [ 'Platform' ] . empty? && platform_object
181
+ datastore [ 'PLATFORM' ] = platform
182
+ end
183
+
168
184
chosen_platform
169
185
end
170
186
You can’t perform that action at this time.
0 commit comments