Module: Msf::Payload::Windows::Exec

Includes:
Cmd::Options, Single, Msf::Payload::Windows
Included in:
Exec_X86, Exec_x64
Defined in:
lib/msf/core/payload/windows/exec.rb

Overview

Common command execution implementation for Windows.

Instance Method Summary collapse

Methods included from Single

#payload_type

Methods included from Msf::Payload::Windows

#apply_prepends, exit_types, #handle_intermediate_stage, #include_send_uuid, #initialize, #replace_var

Methods included from PrependMigrate

#apply_prepend_migrate, #initialize, #prepend_migrate, #prepend_migrate?, #prepend_migrate_64

Instance Method Details

#cmd_required?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/msf/core/payload/windows/exec.rb', line 17

def cmd_required?
  true
end

#command_stringObject

Returns the command string to use for execution.



30
31
32
33
34
35
36
37
38
# File 'lib/msf/core/payload/windows/exec.rb', line 30

def command_string
  cmd = datastore['CMD'].to_s

  if cmd.empty? && cmd_required?
    fail_with(Msf::Module::Failure::BadConfig, 'CMD must not be empty')
  end

  cmd
end

#generate(_opts = {}) ⇒ Object



21
22
23
24
25
# File 'lib/msf/core/payload/windows/exec.rb', line 21

def generate(_opts = {})
  raw = super
  raw = ''.dup if raw.nil?
  raw + command_string + "\x00"
end