46 lines
788 B
Ruby
46 lines
788 B
Ruby
require 'rex/exploitation/egghunter'
|
|
|
|
module Msf
|
|
|
|
###
|
|
#
|
|
# This mixin provides a interface to generating egghunters for various
|
|
# platforms using the Rex::Exploitation::Egghunter class.
|
|
#
|
|
###
|
|
module Exploit::Egghunter
|
|
|
|
#
|
|
# Creates an instance of an exploit that uses an Egghunter overwrite.
|
|
#
|
|
def initialize(info = {})
|
|
super
|
|
end
|
|
|
|
|
|
#
|
|
# Generates an egghunter stub based on the current target's architecture
|
|
# and operating system.
|
|
#
|
|
def generate_egghunter
|
|
os = target['Platform']
|
|
arch = target.arch
|
|
|
|
arch ||= ARCH_X86
|
|
os ||= 'win'
|
|
|
|
egg = Rex::Exploitation::Egghunter.new(os, arch)
|
|
bunny = egg.generate(payload_badchars)
|
|
|
|
if (bunny.nil?)
|
|
print_error("The egghunter could not be generated")
|
|
raise ArgumentError
|
|
end
|
|
|
|
return bunny
|
|
end
|
|
|
|
end
|
|
|
|
end
|