CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/core/exploit/omelet.rb
Views: 11784
1
# -*- coding: binary -*-
2
3
require 'rex/exploitation/omelet'
4
5
module Msf
6
7
###
8
#
9
# This mixin provides an interface to generating eggs-to-omelet hunters for win/x86
10
# platforms using the Rex::Exploitation::Omelet class.
11
#
12
# written by corelanc0d3r <peter.ve [at] corelan.be>
13
#
14
###
15
module Exploit::Omelet
16
17
#
18
# Creates an instance of an exploit that uses an Omelet overwrite.
19
#
20
def initialize(info = {})
21
super
22
end
23
24
25
#
26
# Generates an omelet hunter stub and eggs
27
#
28
def generate_omelet(payload, badchars = nil, opts = {})
29
# Prefer the target's platform/architecture information, but use
30
# the module's if no target specific information exists
31
los = target_platform
32
larch = target_arch || ARCH_X86
33
34
# If we found a platform list, then take the first platform
35
los = los.names[0] if (los.kind_of?(Msf::Module::PlatformList))
36
37
# Use the first architecture if one was specified
38
larch = larch[0] if (larch.kind_of?(Array))
39
40
if los.nil?
41
raise RuntimeError, "No platform restrictions were specified -- cannot select omelet hunter"
42
end
43
44
badchars ||= payload_badchars
45
46
omelet = Rex::Exploitation::Omelet.new(los, larch)
47
scrambledeggs = omelet.generate(payload, badchars, opts)
48
49
if (scrambledeggs.nil?)
50
print_error("The omelet hunter could not be generated")
51
raise ArgumentError
52
end
53
54
return scrambledeggs
55
end
56
57
end
58
59
end
60
61