2022-05-02 12:09:25 -05:00
|
|
|
# -*- coding => binary -*-
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
module Msf::Payload::Custom
|
|
|
|
|
|
2022-05-26 18:31:37 -05:00
|
|
|
def stage_payload(_opts = {})
|
2022-09-07 13:19:22 -05:00
|
|
|
return nil if datastore['SHELLCODE_FILE'].blank?
|
|
|
|
|
|
|
|
|
|
File.binread(datastore['SHELLCODE_FILE'])
|
2022-05-26 18:31:37 -05:00
|
|
|
end
|
|
|
|
|
|
2022-06-06 09:10:57 -05:00
|
|
|
def setup_handler
|
2022-09-07 13:19:22 -05:00
|
|
|
if datastore['SHELLCODE_FILE'].blank?
|
2022-06-06 09:10:57 -05:00
|
|
|
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")
|
2022-05-26 18:31:37 -05:00
|
|
|
end
|
|
|
|
|
super
|
|
|
|
|
end
|
|
|
|
|
|
2022-05-05 15:58:46 -05:00
|
|
|
def read_stage_size?
|
2022-05-02 12:09:25 -05:00
|
|
|
true
|
|
|
|
|
end
|
|
|
|
|
end
|