lib/msf/core/payload_generator.rb
# This method takes a payload module and tries to reconcile a chosen
# platform with the platforms supported by the module.
# @param mod [Msf::Payload] The module class to choose a platform for
# @return [Msf::Module::PlatformList] The selected platform list
This method takes a payload module and tries to reconcile a chosen
platform with the platforms supported by the module.
This method takes a payload module and tries to reconcile a chosen platform with the platforms supported by the module .
def choose_platform(mod)
      chosen_platform = platform_list
      if chosen_platform.platforms.empty?
        chosen_platform = mod.platform
        cli_print "No platform was selected, choosing #{chosen_platform.platforms.first} from the payload"
        @platform = mod.platform.platforms.first.to_s.split("::").last
      elsif (chosen_platform & mod.platform).empty?
        chosen_platform = Msf::Module::PlatformList.new
      end
      begin
        platform_object = Msf::Module::Platform.find_platform(platform)
      rescue ArgumentError
        platform_object = nil
      end
      if mod.kind_of?(Msf::Payload::Generic) && mod.send(:module_info)['Platform'].empty? && platform_object
        datastore['PLATFORM'] = platform
      end
      chosen_platform
    end
def choose_platform ( mod ) chosen_platform = platform_list if chosen_platform . platforms . empty? chosen_platform = mod . platform cli_print "No platform was selected, choosing #{chosen_platform.platforms.first} from the payload" @platform = mod . platform . platforms . first . to_s . split ( "::" ) . last elsif ( chosen_platform & mod . platform ) . empty? chosen_platform = Msf :: Module :: PlatformList . new end begin platform_object = Msf :: Module :: Platform . find_platform ( platform ) rescue ArgumentError platform_object = nil end if mod . kind_of? ( Msf :: Payload :: Generic ) && mod . send ( :module_info ) [ 'Platform' ] . empty? && platform_object datastore [ 'PLATFORM' ] = platform end chosen_platform end
This method takes a payload module and tries to reconcile a chosen
platform with the platforms supported by the module.
This method takes a payload module and tries to reconcile a chosen platform with the platforms supported by the module .
# By default, platform_list will at least return Msf::Module::Platform # if there is absolutely no pre-configured platform info at all
The selected platform list
The selected platform list
Msf::Module::PlatformList
mod
The module class to choose a platform for
The module class to choose a platform for