Module: Msf::Payload::Custom

Defined in:
lib/msf/core/payload/custom.rb

Defined Under Namespace

Modules: Options

Instance Method Summary collapse

Instance Method Details

#read_stage_size?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/msf/core/payload/custom.rb', line 27

def read_stage_size?
  true
end

#setup_handlerObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/msf/core/payload/custom.rb', line 12

def setup_handler
  if datastore['SHELLCODE_FILE'].blank?
    fail_with(Msf::Module::Failure::BadConfig, "No SHELLCODE_FILE provided")
  end
  begin
    # read the file before we start the handler to make sure that it is valid
    test = File.binread(datastore['SHELLCODE_FILE'])
  rescue => e
    print_error("Unable to read #{datastore['SHELLCODE_FILE']}:")
    elog("Unable to read #{datastore['SHELLCODE_FILE']}:", error: e)
    fail_with(Msf::Module::Failure::BadConfig, "Bad SHELLCODE_FILE provided")
  end
  super
end

#stage_payload(_opts = {}) ⇒ Object



6
7
8
9
10
# File 'lib/msf/core/payload/custom.rb', line 6

def stage_payload(_opts = {})
  return nil if datastore['SHELLCODE_FILE'].blank?

  File.binread(datastore['SHELLCODE_FILE'])
end