2011-06-29 01:26:24 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2011-06-29 01:26:24 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core/payload/generic'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
module MetasploitModule
|
2011-06-29 01:26:24 +00:00
|
|
|
|
2015-03-09 20:31:04 +00:00
|
|
|
CachedSize = 0
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Payload::Single
|
|
|
|
include Msf::Payload::Generic
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Custom Payload',
|
|
|
|
'Description' => 'Use custom string or file as payload. Set either PAYLOADFILE or
|
|
|
|
PAYLOADSTR.',
|
|
|
|
'Author' => 'scriptjunkie <scriptjunkie[at]scriptjunkie.us>',
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Payload' => "" # not really
|
|
|
|
}
|
|
|
|
))
|
|
|
|
|
|
|
|
# Register options
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('PAYLOADFILE', [ false, "The file to read the payload from" ] ),
|
|
|
|
OptString.new('PAYLOADSTR', [ false, "The string to use as a payload" ] )
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Construct the payload
|
|
|
|
#
|
|
|
|
def generate
|
|
|
|
if datastore['ARCH']
|
|
|
|
self.arch = actual_arch
|
|
|
|
end
|
|
|
|
|
2016-12-28 11:04:41 +00:00
|
|
|
if datastore['PAYLOADSTR']
|
2013-08-30 21:28:54 +00:00
|
|
|
datastore['PAYLOADSTR']
|
2016-12-28 11:04:41 +00:00
|
|
|
elsif datastore['PAYLOADFILE']
|
|
|
|
IO.read(datastore['PAYLOADFILE'])
|
|
|
|
else
|
|
|
|
''
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Only accept the "none" encoder
|
|
|
|
def compatible_encoders
|
|
|
|
encoders = super()
|
|
|
|
encoders2 = []
|
|
|
|
encoders.each do |encname, encmod|
|
|
|
|
encoders2 << [encname, encmod] if encname.include? 'none'
|
|
|
|
end
|
|
|
|
|
|
|
|
return encoders2
|
|
|
|
end
|
2011-06-29 01:26:24 +00:00
|
|
|
end
|