Skip to content

Commit 1fd8fe5

Browse files
committed
Merge staging/great-backport to master
Conflicts: spec/lib/msf/core/module_spec.rb
2 parents 7058966 + 33ca914 commit 1fd8fe5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1661
-1360
lines changed

lib/msf/base/serializer/readable_text.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ class ReadableText
2020
# @return [String] formatted text output of the dump.
2121
def self.dump_module(mod, indent = " ")
2222
case mod.type
23-
when MODULE_PAYLOAD
23+
when Msf::MODULE_PAYLOAD
2424
return dump_payload_module(mod, indent)
25-
when MODULE_NOP
25+
when Msf::MODULE_NOP
2626
return dump_basic_module(mod, indent)
27-
when MODULE_ENCODER
27+
when Msf::MODULE_ENCODER
2828
return dump_basic_module(mod, indent)
29-
when MODULE_EXPLOIT
29+
when Msf::MODULE_EXPLOIT
3030
return dump_exploit_module(mod, indent)
31-
when MODULE_AUX
31+
when Msf::MODULE_AUX
3232
return dump_auxiliary_module(mod, indent)
33-
when MODULE_POST
33+
when Msf::MODULE_POST
3434
return dump_post_module(mod, indent)
3535
else
3636
return dump_generic_module(mod, indent)

lib/msf/base/simple/framework.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def on_module_created(instance)
5454

5555
ModuleSimplifiers =
5656
{
57-
MODULE_ENCODER => Msf::Simple::Encoder,
58-
MODULE_EXPLOIT => Msf::Simple::Exploit,
59-
MODULE_NOP => Msf::Simple::Nop,
60-
MODULE_PAYLOAD => Msf::Simple::Payload,
61-
MODULE_AUX => Msf::Simple::Auxiliary,
62-
MODULE_POST => Msf::Simple::Post,
57+
Msf::MODULE_ENCODER => Msf::Simple::Encoder,
58+
Msf::MODULE_EXPLOIT => Msf::Simple::Exploit,
59+
Msf::MODULE_NOP => Msf::Simple::Nop,
60+
Msf::MODULE_PAYLOAD => Msf::Simple::Payload,
61+
Msf::MODULE_AUX => Msf::Simple::Auxiliary,
62+
Msf::MODULE_POST => Msf::Simple::Post,
6363
}
6464

6565
#

lib/msf/core.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
require 'rex/ui'
1919

2020
module Msf
21+
autoload :Author, 'msf/core/author'
22+
autoload :Platform, 'msf/core/platform'
23+
autoload :Reference, 'msf/core/reference'
24+
autoload :SiteReference, 'msf/core/site_reference'
25+
autoload :Target, 'msf/core/target'
26+
27+
#
28+
# Constants
29+
#
30+
2131
LogSource = "core"
2232
end
2333

lib/msf/core/author.rb

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# -*- coding: binary -*-
2+
require 'msf/core'
3+
4+
###
5+
#
6+
# This data type represents an author of a piece of code in either
7+
# the framework, a module, a script, or something entirely unrelated.
8+
#
9+
###
10+
class Msf::Author
11+
12+
# A hash of known author names
13+
Known =
14+
{
15+
'amaloteaux' => 'alex_maloteaux' + 0x40.chr + 'metasploit.com',
16+
'anonymous' => 'Unknown',
17+
'bannedit' => 'bannedit' + 0x40.chr + 'metasploit.com',
18+
'Carlos Perez' => 'carlos_perez' + 0x40.chr + 'darkoperator.com',
19+
'cazz' => 'bmc' + 0x40.chr + 'shmoo.com',
20+
'CG' => 'cg' + 0x40.chr + 'carnal0wnage.com',
21+
'ddz' => 'ddz' + 0x40.chr + 'theta44.org',
22+
'egypt' => 'egypt' + 0x40.chr + 'metasploit.com',
23+
'et' => 'et' + 0x40.chr + 'metasploit.com',
24+
'Christian Mehlmauer' => 'FireFart' + 0x40.chr + 'gmail.com',
25+
'hdm' => 'hdm' + 0x40.chr + 'metasploit.com',
26+
'I)ruid' => 'druid' + 0x40.chr + 'caughq.org',
27+
'jcran' => 'jcran' + 0x40.chr + 'metasploit.com',
28+
'jduck' => 'jduck' + 0x40.chr + 'metasploit.com',
29+
'joev' => 'joev' + 0x40.chr + 'metasploit.com',
30+
'juan vazquez' => 'juan.vazquez' + 0x40.chr + 'metasploit.com',
31+
'kf' => 'kf_list' + 0x40.chr + 'digitalmunition.com',
32+
'kris katterjohn' => 'katterjohn' + 0x40.chr + 'gmail.com',
33+
'MC' => 'mc' + 0x40.chr + 'metasploit.com',
34+
'Ben Campbell' => 'eat_meatballs' + 0x40.chr + 'hotmail.co.uk',
35+
'msmith' => 'msmith' + 0x40.chr + 'metasploit.com',
36+
'mubix' => 'mubix' + 0x40.chr + 'hak5.org',
37+
'natron' => 'natron' + 0x40.chr + 'metasploit.com',
38+
'optyx' => 'optyx' + 0x40.chr + 'no$email.com',
39+
'patrick' => 'patrick' + 0x40.chr + 'osisecurity.com.au',
40+
'pusscat' => 'pusscat' + 0x40.chr + 'metasploit.com',
41+
'Ramon de C Valle' => 'rcvalle' + 0x40.chr + 'metasploit.com',
42+
'sf' => 'stephen_fewer' + 0x40.chr + 'harmonysecurity.com',
43+
'sinn3r' => 'sinn3r' + 0x40.chr + 'metasploit.com',
44+
'skape' => 'mmiller' + 0x40.chr + 'hick.org',
45+
'skylined' => 'skylined' + 0x40.chr + 'edup.tudelft.nl',
46+
'spoonm' => 'spoonm' + 0x40.chr + 'no$email.com',
47+
'stinko' => 'vinnie' + 0x40.chr + 'metasploit.com',
48+
'theLightCosine' => 'theLightCosine' + 0x40.chr + 'metasploit.com',
49+
'todb' => 'todb' + 0x40.chr + 'metasploit.com',
50+
'vlad902' => 'vlad902' + 0x40.chr + 'gmail.com',
51+
'wvu' => 'wvu' + 0x40.chr + 'metasploit.com'
52+
}
53+
54+
#
55+
# Class method that translates a string to an instance of the Author class,
56+
# if it's of the right format, and returns the Author class instance
57+
#
58+
def self.from_s(str)
59+
instance = self.new
60+
61+
# If the serialization fails...
62+
if (instance.from_s(str) == false)
63+
return nil
64+
end
65+
66+
return instance
67+
end
68+
69+
#
70+
# Transforms the supplied source into an array of authors
71+
#
72+
def self.transform(src)
73+
Rex::Transformer.transform(src, Array, [ self ], 'Author')
74+
end
75+
76+
def initialize(name = nil, email = nil)
77+
self.name = name
78+
self.email = email || Known[name]
79+
end
80+
81+
#
82+
# Compares authors
83+
#
84+
def ==(tgt)
85+
return (tgt.to_s == to_s)
86+
end
87+
88+
#
89+
# Serialize the author object to a string in form:
90+
#
91+
# name <email>
92+
#
93+
def to_s
94+
str = "#{name}"
95+
96+
if (email and not email.empty?)
97+
str += " <#{email}>"
98+
end
99+
100+
return str
101+
end
102+
103+
#
104+
# Translate the author from the supplied string which may
105+
# have either just a name or also an email address
106+
#
107+
def from_s(str)
108+
109+
110+
# Supported formats:
111+
# known_name
112+
# user [at/@] host [dot/.] tld
113+
# Name <user [at/@] host [dot/.] tld>
114+
115+
116+
if ((m = str.match(/^\s*([^<]+)<([^>]+)>\s*$/)))
117+
self.name = m[1].sub(/<.*/, '')
118+
self.email = m[2].sub(/\s*\[at\]\s*/, '@').sub(/\s*\[dot\]\s*/, '.')
119+
else
120+
if (Known[str])
121+
self.email = Known[str]
122+
self.name = str
123+
else
124+
self.email = str.sub(/\s*\[at\]\s*/, '@').sub(/\s*\[dot\]\s*/, '.').gsub(/^<|>$/, '')
125+
m = self.email.match(/([^@]+)@/)
126+
self.name = m ? m[1] : nil
127+
if !(self.email and self.email.index('@'))
128+
self.name = self.email
129+
self.email = ''
130+
end
131+
end
132+
end
133+
134+
self.name.strip! if self.name
135+
136+
return true
137+
end
138+
139+
#
140+
# Sets the name of the author and updates the email if it's a known author.
141+
#
142+
def name=(name)
143+
self.email = Known[name] if (Known[name])
144+
@name = name
145+
end
146+
147+
attr_accessor :email
148+
attr_reader :name
149+
end

lib/msf/core/auxiliary.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class Auxiliary < Msf::Module
2121
# Returns MODULE_AUX to indicate that this is an auxiliary module.
2222
#
2323
def self.type
24-
MODULE_AUX
24+
Msf::MODULE_AUX
2525
end
2626

2727
#
2828
# Returns MODULE_AUX to indicate that this is an auxiliary module.
2929
#
3030
def type
31-
MODULE_AUX
31+
Msf::MODULE_AUX
3232
end
3333

3434
#

lib/msf/core/encoder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ def initialize(info)
162162
# Returns MODULE_ENCODER to indicate that this is an encoder module.
163163
#
164164
def self.type
165-
return MODULE_ENCODER
165+
return Msf::MODULE_ENCODER
166166
end
167167

168168
#
169169
# Returns MODULE_ENCODER to indicate that this is an encoder module.
170170
#
171171
def type
172-
return MODULE_ENCODER
172+
return Msf::MODULE_ENCODER
173173
end
174174

175175
#

lib/msf/core/exploit.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,14 @@ def capabilities
621621
# Returns MODULE_EXPLOIT to indicate that this is an exploit module.
622622
#
623623
def self.type
624-
MODULE_EXPLOIT
624+
Msf::MODULE_EXPLOIT
625625
end
626626

627627
#
628628
# Returns MODULE_EXPLOIT to indicate that this is an exploit module.
629629
#
630630
def type
631-
MODULE_EXPLOIT
631+
Msf::MODULE_EXPLOIT
632632
end
633633

634634
#

lib/msf/core/framework.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module Offspring
6969
def initialize(opts={})
7070

7171
# Allow specific module types to be loaded
72-
types = opts[:module_types] || MODULE_TYPES
72+
types = opts[:module_types] || Msf::MODULE_TYPES
7373

7474
self.threads = ThreadManager.new(self)
7575
self.events = EventDispatcher.new(self)

0 commit comments

Comments
 (0)