2011-06-29 01:26:24 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2011-06-29 01:26:24 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/payload/generic'
|
|
|
|
|
|
|
|
module Metasploit3
|
|
|
|
|
|
|
|
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.',
|
2012-03-05 20:28:23 +00:00
|
|
|
'Author' => 'scriptjunkie <scriptjunkie[at]scriptjunkie.us>',
|
2011-06-29 01:26:24 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Payload' => "" # not really
|
|
|
|
}
|
|
|
|
))
|
2011-11-28 04:42:59 +00:00
|
|
|
|
2011-06-29 01:26:24 +00:00
|
|
|
# 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" ] )
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Construct the payload
|
|
|
|
#
|
|
|
|
def generate
|
|
|
|
if datastore['PAYLOADFILE']
|
|
|
|
IO.read(datastore['PAYLOADFILE'])
|
|
|
|
elsif datastore['PAYLOADSTR']
|
|
|
|
datastore['PAYLOADSTR']
|
|
|
|
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
|
|
|
|
|
|
|
|
end
|