Files
metasploit-gs/lib/msf/core/payload/custom.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
794 B
Ruby
Raw Normal View History

2022-05-02 12:09:25 -05:00
# -*- coding => binary -*-
#
module Msf::Payload::Custom
def stage_payload(_opts = {})
2022-09-07 13:19:22 -05:00
return nil if datastore['SHELLCODE_FILE'].blank?
File.binread(datastore['SHELLCODE_FILE'])
end
def setup_handler
2022-09-07 13:19:22 -05:00
if datastore['SHELLCODE_FILE'].blank?
fail_with(Msf::Module::Failure::BadConfig, "No SHELLCODE_FILE provided")
2022-09-07 13:19:22 -05:00
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
2022-09-07 15:43:50 -05:00
print_error("Unable to read #{datastore['SHELLCODE_FILE']}:")
elog("Unable to read #{datastore['SHELLCODE_FILE']}:", error: e)
2022-09-07 13:19:22 -05:00
fail_with(Msf::Module::Failure::BadConfig, "Bad SHELLCODE_FILE provided")
end
super
end
def read_stage_size?
2022-05-02 12:09:25 -05:00
true
end
end