ronin-exploits 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +27 -0
- data/Manifest.txt +21 -5
- data/README.txt +40 -3
- data/Rakefile +6 -6
- data/TODO.txt +12 -9
- data/lib/ronin/exploits/allow.rb +1 -1
- data/lib/ronin/{targeted_arch.rb → exploits/arch.rb} +1 -5
- data/lib/ronin/exploits/exploit.rb +59 -144
- data/lib/ronin/exploits/ftp.rb +4 -1
- data/lib/ronin/exploits/helpers.rb +1 -0
- data/lib/ronin/exploits/helpers/file_based.rb +113 -0
- data/lib/ronin/exploits/http.rb +10 -0
- data/lib/ronin/exploits/license.rb +34 -0
- data/lib/ronin/exploits/os.rb +34 -0
- data/lib/ronin/{targeted_product.rb → exploits/product.rb} +1 -1
- data/lib/ronin/exploits/remote_tcp.rb +2 -3
- data/lib/ronin/exploits/remote_udp.rb +2 -3
- data/lib/ronin/exploits/target.rb +8 -10
- data/lib/ronin/exploits/verifiers.rb +92 -0
- data/lib/ronin/exploits/version.rb +1 -1
- data/lib/ronin/exploits/web.rb +21 -1
- data/lib/ronin/model/has_default_port.rb +54 -0
- data/lib/ronin/model/targets_arch.rb +8 -10
- data/lib/ronin/model/targets_os.rb +9 -9
- data/lib/ronin/payloads.rb +1 -0
- data/lib/ronin/payloads/arch.rb +32 -0
- data/lib/ronin/payloads/asm_payload.rb +34 -0
- data/lib/ronin/payloads/encoder.rb +24 -18
- data/lib/ronin/payloads/helpers/exceptions.rb +2 -1
- data/lib/ronin/payloads/helpers/exceptions/{unimplemented.rb → not_implemented.rb} +1 -1
- data/lib/ronin/payloads/helpers/file_system.rb +12 -12
- data/lib/ronin/payloads/helpers/rpc.rb +7 -7
- data/lib/ronin/payloads/helpers/shell.rb +2 -2
- data/lib/ronin/payloads/license.rb +34 -0
- data/lib/ronin/payloads/nops.rb +3 -1
- data/lib/ronin/{targeted_os.rb → payloads/os.rb} +1 -5
- data/lib/ronin/payloads/payload.rb +89 -41
- data/lib/ronin/payloads/shellcode.rb +4 -1
- data/lib/ronin/ui/command_line/commands/exploits.rb +1 -1
- data/lib/ronin/ui/command_line/commands/payload.rb +2 -2
- data/lib/ronin/ui/command_line/commands/payloads.rb +1 -1
- data/spec/exploits/exploit_spec.rb +12 -30
- data/spec/exploits/file_based_exploit_spec.rb +39 -0
- data/spec/exploits/ftp_spec.rb +1 -5
- data/spec/exploits/http_spec.rb +4 -4
- data/spec/exploits/remote_tcp_spec.rb +7 -3
- data/spec/exploits/remote_udp_spec.rb +7 -3
- data/spec/exploits/target_spec.rb +9 -2
- data/spec/exploits/targets/buffer_overflow_spec.rb +6 -2
- data/spec/exploits/web_spec.rb +6 -0
- data/spec/model/has_default_port_spec.rb +27 -0
- data/spec/model/models/default_port_model.rb +13 -0
- data/spec/model/models/non_default_port_model.rb +11 -0
- data/spec/model/models/targets_arch_model.rb +11 -0
- data/spec/model/models/targets_os_model.rb +11 -0
- data/spec/model/targets_arch_spec.rb +22 -0
- data/spec/model/targets_os_spec.rb +23 -0
- data/spec/objects/exploits/example.rb +25 -0
- data/spec/objects/exploits/test.rb +0 -4
- data/spec/objects/payloads/test.rb +5 -1
- data/spec/payloads/encoder_spec.rb +5 -1
- data/spec/payloads/payload_spec.rb +77 -14
- metadata +58 -13
- metadata.gz.sig +0 -0
- data/spec/objects/payloads/example.rb +0 -19
data.tar.gz.sig
ADDED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
=== 0.2.1 / 2009-07-02
|
2
|
+
|
3
|
+
* Use Hoe >= 2.0.0.
|
4
|
+
* Require ronin >= 0.2.4.
|
5
|
+
* Added Ronin::Model::TargetsArch.
|
6
|
+
* Added Ronin::Model::TargetsOS.
|
7
|
+
* Added Ronin::Mode::HasDefaultPort.
|
8
|
+
* Added Exploit#deployed?.
|
9
|
+
* Added Exploit#inspect.
|
10
|
+
* Added Exploits::Helpers::FileBased.
|
11
|
+
* Added Exploits::Web#http_method.
|
12
|
+
* Added Exploits::Web#targeted_url_path.
|
13
|
+
* Added Payload#inspect.
|
14
|
+
* Added Payload#call method.
|
15
|
+
* Renamed Exploit#exploit to Exploit#call.
|
16
|
+
* Renamed Payloads::Helpers::Unimplemented to
|
17
|
+
Payloads::Helpers::NotImplemented.
|
18
|
+
* Renamed RPC#call to RPC#call_method.
|
19
|
+
* Removed Exploit#switch_payload.
|
20
|
+
* Moved verifier methods into Exploits::Verifiers.
|
21
|
+
* Allow Exploit#allow to accept multiple behaviors.
|
22
|
+
* Include UI::Diagnostics into Ronin::Exploits::Exploit.
|
23
|
+
* Include Sessions::HTTP into Exploits::Web.
|
24
|
+
* Include UI::Diagnostics into Ronin::Payloads::Payload.
|
25
|
+
* Allow Payload#controlling to accept multiple behaviors.
|
26
|
+
* Added more specs.
|
27
|
+
|
1
28
|
=== 0.2.0 / 2009-04-11
|
2
29
|
|
3
30
|
* Added Ronin::TargetedArch.
|
data/Manifest.txt
CHANGED
@@ -7,9 +7,7 @@ TODO.txt
|
|
7
7
|
bin/ronin-payload
|
8
8
|
bin/ronin-payloads
|
9
9
|
bin/ronin-exploits
|
10
|
-
lib/ronin/
|
11
|
-
lib/ronin/targeted_os.rb
|
12
|
-
lib/ronin/targeted_product.rb
|
10
|
+
lib/ronin/model/has_default_port.rb
|
13
11
|
lib/ronin/model/targets_arch.rb
|
14
12
|
lib/ronin/model/targets_os.rb
|
15
13
|
lib/ronin/vuln/behavior.rb
|
@@ -21,7 +19,13 @@ lib/ronin/exploits/exceptions/target_data_missing.rb
|
|
21
19
|
lib/ronin/exploits/exceptions/exploit_not_built.rb
|
22
20
|
lib/ronin/exploits/exceptions/restricted_char.rb
|
23
21
|
lib/ronin/exploits/exceptions/payload_size.rb
|
22
|
+
lib/ronin/exploits/arch.rb
|
23
|
+
lib/ronin/exploits/os.rb
|
24
|
+
lib/ronin/exploits/license.rb
|
25
|
+
lib/ronin/exploits/product.rb
|
26
|
+
lib/ronin/exploits/verifiers.rb
|
24
27
|
lib/ronin/exploits/helpers.rb
|
28
|
+
lib/ronin/exploits/helpers/file_based.rb
|
25
29
|
lib/ronin/exploits/helpers/binary.rb
|
26
30
|
lib/ronin/exploits/helpers/padding.rb
|
27
31
|
lib/ronin/exploits/helpers/buffer_overflow.rb
|
@@ -44,12 +48,15 @@ lib/ronin/exploits/version.rb
|
|
44
48
|
lib/ronin/payloads.rb
|
45
49
|
lib/ronin/payloads/exceptions.rb
|
46
50
|
lib/ronin/payloads/exceptions/unknown_helper.rb
|
51
|
+
lib/ronin/payloads/license.rb
|
52
|
+
lib/ronin/payloads/arch.rb
|
53
|
+
lib/ronin/payloads/os.rb
|
47
54
|
lib/ronin/payloads/encoder.rb
|
48
55
|
lib/ronin/payloads/encoders.rb
|
49
56
|
lib/ronin/payloads/encoders/xor.rb
|
50
57
|
lib/ronin/payloads/helpers.rb
|
51
58
|
lib/ronin/payloads/helpers/exceptions.rb
|
52
|
-
lib/ronin/payloads/helpers/exceptions/
|
59
|
+
lib/ronin/payloads/helpers/exceptions/not_implemented.rb
|
53
60
|
lib/ronin/payloads/helpers/exceptions/program_not_found.rb
|
54
61
|
lib/ronin/payloads/helpers/file_system.rb
|
55
62
|
lib/ronin/payloads/helpers/shell.rb
|
@@ -58,6 +65,7 @@ lib/ronin/payloads/control.rb
|
|
58
65
|
lib/ronin/payloads/payload_author.rb
|
59
66
|
lib/ronin/payloads/payload.rb
|
60
67
|
lib/ronin/payloads/binary_payload.rb
|
68
|
+
lib/ronin/payloads/asm_payload.rb
|
61
69
|
lib/ronin/payloads/nops.rb
|
62
70
|
lib/ronin/payloads/shellcode.rb
|
63
71
|
lib/ronin/payloads/web_payload.rb
|
@@ -69,9 +77,16 @@ spec/spec_helper.rb
|
|
69
77
|
spec/helpers/database.rb
|
70
78
|
spec/helpers/objects.rb
|
71
79
|
spec/objects/exploits/test.rb
|
80
|
+
spec/objects/exploits/example.rb
|
72
81
|
spec/objects/payloads/test.rb
|
73
|
-
spec/objects/payloads/example.rb
|
74
82
|
spec/exploits_spec.rb
|
83
|
+
spec/model/models/default_port_model.rb
|
84
|
+
spec/model/models/non_default_port_model.rb
|
85
|
+
spec/model/models/targets_arch_model.rb
|
86
|
+
spec/model/models/targets_os_model.rb
|
87
|
+
spec/model/has_default_port_spec.rb
|
88
|
+
spec/model/targets_arch_spec.rb
|
89
|
+
spec/model/targets_os_spec.rb
|
75
90
|
spec/vuln/behavior_spec.rb
|
76
91
|
spec/exploits/targets/buffer_overflow_spec.rb
|
77
92
|
spec/exploits/target_spec.rb
|
@@ -81,6 +96,7 @@ spec/exploits/remote_udp_spec.rb
|
|
81
96
|
spec/exploits/ftp_spec.rb
|
82
97
|
spec/exploits/http_spec.rb
|
83
98
|
spec/exploits/web_spec.rb
|
99
|
+
spec/exploits/file_based_exploit_spec.rb
|
84
100
|
spec/exploits/binary_exploit_spec.rb
|
85
101
|
spec/exploits/padding_exploit_spec.rb
|
86
102
|
spec/exploits/buffer_overflow_exploit_spec.rb
|
data/README.txt
CHANGED
@@ -71,32 +71,51 @@ of Ronin.
|
|
71
71
|
* Define a shellcode payload:
|
72
72
|
|
73
73
|
ronin_shellcode do
|
74
|
+
#
|
75
|
+
# Cacheable data.
|
76
|
+
#
|
74
77
|
cache do
|
75
78
|
self.name = 'test'
|
76
79
|
self.version = '0.5'
|
80
|
+
self.description = %{This is an example shellcode payload.}
|
81
|
+
|
82
|
+
author(:name => 'Postmodern', :organization => 'SophSec')
|
77
83
|
|
78
84
|
self.arch :i686
|
79
85
|
self.os :name => 'Linux'
|
80
86
|
end
|
81
87
|
|
88
|
+
#
|
89
|
+
# Configurable parameters.
|
90
|
+
#
|
82
91
|
parameter :exit_status,
|
83
92
|
:default => 0,
|
84
93
|
:description => 'Exit status of shellcode'
|
85
94
|
|
95
|
+
#
|
96
|
+
# Builds the assembly payload, which will call the SYS_EXIT
|
97
|
+
# syscall with the exit_status of the shellcode.
|
98
|
+
#
|
86
99
|
def build
|
87
100
|
@payload = "\x66\x31\xc0\xfe\xc0"
|
88
101
|
|
89
|
-
|
90
|
-
@payload << "\xb3#{@exit_status.chr}
|
102
|
+
unless @exit_status == 0
|
103
|
+
@payload << "\xb3#{@exit_status.chr}"
|
91
104
|
else
|
92
|
-
@payload << "\x66\x31\xdb
|
105
|
+
@payload << "\x66\x31\xdb"
|
93
106
|
end
|
107
|
+
|
108
|
+
@payload << "\xcd\x80"
|
109
|
+
return @payload
|
94
110
|
end
|
95
111
|
end
|
96
112
|
|
97
113
|
* Define a payload encoder:
|
98
114
|
|
99
115
|
ronin_payload_encoder do
|
116
|
+
#
|
117
|
+
# Cacheable data.
|
118
|
+
#
|
100
119
|
cache do
|
101
120
|
self.name = 'base64_encode'
|
102
121
|
self.description = %{Example base64 payload encoder}
|
@@ -105,6 +124,9 @@ of Ronin.
|
|
105
124
|
self.os :name => 'Linux'
|
106
125
|
end
|
107
126
|
|
127
|
+
#
|
128
|
+
# Base64 encodes the specified _data_.
|
129
|
+
#
|
108
130
|
def call(data)
|
109
131
|
return data.to_s.base64_encode
|
110
132
|
end
|
@@ -115,8 +137,17 @@ of Ronin.
|
|
115
137
|
ronin_remote_tcp_exploit do
|
116
138
|
helper :buffer_overflow
|
117
139
|
|
140
|
+
#
|
141
|
+
# Cacheable data.
|
142
|
+
#
|
118
143
|
cache do
|
119
144
|
self.name = 'test'
|
145
|
+
self.description = %{This is an example exploit.}
|
146
|
+
|
147
|
+
self.status = :potential
|
148
|
+
self.disclosure = [:in_wild, :public]
|
149
|
+
|
150
|
+
author(:name => 'Postmodern', :organization => 'SophSec')
|
120
151
|
|
121
152
|
targeting do |target|
|
122
153
|
target.arch :i686
|
@@ -125,10 +156,16 @@ of Ronin.
|
|
125
156
|
end
|
126
157
|
end
|
127
158
|
|
159
|
+
#
|
160
|
+
# Builds the exploit.
|
161
|
+
#
|
128
162
|
def build
|
129
163
|
@buffer = "USER #{build_buffer}\n"
|
130
164
|
end
|
131
165
|
|
166
|
+
#
|
167
|
+
# Deploys the built exploit.
|
168
|
+
#
|
132
169
|
def deploy
|
133
170
|
tcp_send @buffer
|
134
171
|
end
|
data/Rakefile
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
+
require 'hoe/signing'
|
5
6
|
require './tasks/spec.rb'
|
6
|
-
require './lib/ronin/exploits/version.rb'
|
7
7
|
|
8
|
-
Hoe.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
Hoe.spec('ronin-exploits') do
|
9
|
+
self.rubyforge_name = 'ronin'
|
10
|
+
self.developer('Postmodern', 'postmodern.mod3@gmail.com')
|
11
|
+
self.remote_rdoc_dir = 'docs/ronin-exploits'
|
12
|
+
self.extra_deps = [['ronin', '>=0.2.4']]
|
13
13
|
end
|
14
14
|
|
15
15
|
# vim: syntax=Ruby
|
data/TODO.txt
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
== TODO:
|
2
2
|
|
3
|
-
=== Ronin Exploits 0.
|
3
|
+
=== Ronin Exploits 0.2.1:
|
4
4
|
|
5
|
-
*
|
6
|
-
* Target attributes:
|
7
|
-
* Arch (name).
|
8
|
-
* OS (name, version).
|
9
|
-
* Authors
|
10
|
-
* Spec exploit/payload relations and dm-scope methods.
|
11
|
-
* Add methods for chaining exploits.
|
5
|
+
* Integreate with DataMapper 0.10.0.
|
12
6
|
|
13
|
-
=== Ronin Exploits 0.2.
|
7
|
+
=== Ronin Exploits 0.2.2:
|
8
|
+
|
9
|
+
* Move RPC code out of ronin and into ronin-exploits:
|
10
|
+
* Define base XMLRPC Client, Call and Response classes.
|
11
|
+
* Define base JSONRPC Client, Call and Response classes.
|
12
|
+
* Prepare Ronin::Payloads::Payload to use RPC.
|
13
|
+
* Add top-level methods to Ronin::Exploits and Ronin::Payloads:
|
14
|
+
* Goal: Deploy an exploit/payload in one-line of code.
|
15
|
+
|
16
|
+
=== Longterm:
|
14
17
|
|
15
18
|
* Design a basic Vulnerability Scanner class:
|
16
19
|
* Scan networks of hosts.
|
data/lib/ronin/exploits/allow.rb
CHANGED
@@ -38,7 +38,7 @@ module Ronin
|
|
38
38
|
# The behavior which is allowed
|
39
39
|
belongs_to :behavior,
|
40
40
|
:child_key => [:behavior_id],
|
41
|
-
:class_name => '
|
41
|
+
:class_name => 'Ronin::Vuln::Behavior'
|
42
42
|
|
43
43
|
# The exploit which facilitates the behavior
|
44
44
|
belongs_to :exploit
|
@@ -24,15 +24,11 @@
|
|
24
24
|
require 'ronin/arch'
|
25
25
|
|
26
26
|
module Ronin
|
27
|
-
class
|
27
|
+
class Arch
|
28
28
|
|
29
29
|
# The exploit targets for the Arch
|
30
30
|
has n, :targets,
|
31
31
|
:class_name => 'Ronin::Exploits::Target'
|
32
32
|
|
33
|
-
# The payloads which target the Arch
|
34
|
-
has n, :payloads,
|
35
|
-
:class_name => 'Ronin::Payloads::Payload'
|
36
|
-
|
37
33
|
end
|
38
34
|
end
|
@@ -26,13 +26,18 @@ require 'ronin/exploits/exceptions/target_unspecified'
|
|
26
26
|
require 'ronin/exploits/exceptions/target_data_missing'
|
27
27
|
require 'ronin/exploits/exceptions/restricted_char'
|
28
28
|
require 'ronin/exploits/exceptions/exploit_not_built'
|
29
|
+
require 'ronin/exploits/license'
|
30
|
+
require 'ronin/exploits/verifiers'
|
29
31
|
require 'ronin/exploits/exploit_author'
|
30
32
|
require 'ronin/exploits/target'
|
31
33
|
require 'ronin/exploits/allow'
|
32
|
-
require 'ronin/payloads/payload'
|
33
34
|
require 'ronin/vuln/behavior'
|
34
35
|
require 'ronin/cacheable'
|
35
|
-
require 'ronin/
|
36
|
+
require 'ronin/model/has_name'
|
37
|
+
require 'ronin/model/has_description'
|
38
|
+
require 'ronin/model/has_version'
|
39
|
+
require 'ronin/model/has_license'
|
40
|
+
require 'ronin/ui/diagnostics'
|
36
41
|
|
37
42
|
require 'parameters'
|
38
43
|
require 'chars/char_set'
|
@@ -43,22 +48,18 @@ module Ronin
|
|
43
48
|
|
44
49
|
include Parameters
|
45
50
|
include Cacheable
|
46
|
-
include
|
51
|
+
include Model::HasName
|
52
|
+
include Model::HasDescription
|
53
|
+
include Model::HasVersion
|
54
|
+
include Model::HasLicense
|
55
|
+
include UI::Diagnostics
|
56
|
+
include Verifiers
|
47
57
|
|
48
58
|
contextify :ronin_exploit
|
49
59
|
|
50
60
|
# Primary key of the exploit
|
51
61
|
property :id, Serial
|
52
62
|
|
53
|
-
# Name of the exploit
|
54
|
-
property :name, String, :index => true
|
55
|
-
|
56
|
-
# Version of the exploit
|
57
|
-
property :version, String, :default => '0.1', :index => true
|
58
|
-
|
59
|
-
# Description of the exploit
|
60
|
-
property :description, Text
|
61
|
-
|
62
63
|
# The status of the exploit (either, :potential, :proven or
|
63
64
|
# :weaponized)
|
64
65
|
property :status, Enum[
|
@@ -110,8 +111,11 @@ module Ronin
|
|
110
111
|
def initialize(attributes={},&block)
|
111
112
|
super(attributes)
|
112
113
|
|
114
|
+
initialize_params(attributes)
|
115
|
+
|
113
116
|
@target = nil
|
114
117
|
@built = false
|
118
|
+
@deployed = false
|
115
119
|
|
116
120
|
@restricted_chars = Chars::CharSet.new
|
117
121
|
@encoders = []
|
@@ -119,28 +123,6 @@ module Ronin
|
|
119
123
|
instance_eval(&block) if block
|
120
124
|
end
|
121
125
|
|
122
|
-
#
|
123
|
-
# Finds all exploits with names like the specified _name_.
|
124
|
-
#
|
125
|
-
def self.named(name)
|
126
|
-
self.all(:name.like => "%#{name}%")
|
127
|
-
end
|
128
|
-
|
129
|
-
#
|
130
|
-
# Finds all exploits with descriptions like the specified
|
131
|
-
# _description_.
|
132
|
-
#
|
133
|
-
def self.describing(description)
|
134
|
-
self.all(:description.like => "%#{description}%")
|
135
|
-
end
|
136
|
-
|
137
|
-
#
|
138
|
-
# Finds the exploit with the most recent vesion.
|
139
|
-
#
|
140
|
-
def self.latest
|
141
|
-
self.first(:order => [:version.desc])
|
142
|
-
end
|
143
|
-
|
144
126
|
#
|
145
127
|
# Adds an ExploitAuthor with the given _attributes_ to the exploit.
|
146
128
|
# If a _block_ is given, it will be passed to the newly created
|
@@ -155,12 +137,14 @@ module Ronin
|
|
155
137
|
end
|
156
138
|
|
157
139
|
#
|
158
|
-
# Adds a new Allow object granting the specified
|
140
|
+
# Adds a new Allow object granting the specified _behaviors_.
|
159
141
|
#
|
160
|
-
# allowing :code_exec
|
142
|
+
# allowing :code_exec, :auth_bypass
|
161
143
|
#
|
162
|
-
def allowing(
|
163
|
-
|
144
|
+
def allowing(*behaviors)
|
145
|
+
behaviors.each do |behavior|
|
146
|
+
self.allows << Allow.new(:behavior => Vuln::Behavior[behavior])
|
147
|
+
end
|
164
148
|
end
|
165
149
|
|
166
150
|
#
|
@@ -260,37 +244,14 @@ module Ronin
|
|
260
244
|
end
|
261
245
|
|
262
246
|
#
|
263
|
-
#
|
264
|
-
#
|
265
|
-
# it's previous value.
|
266
|
-
#
|
267
|
-
def switch_payload(new_payload,&block)
|
268
|
-
old_payload = @payload
|
269
|
-
@payload = new_payload
|
270
|
-
|
271
|
-
block.call(self)
|
272
|
-
|
273
|
-
@payload = old_payload
|
274
|
-
return self
|
275
|
-
end
|
276
|
-
|
277
|
-
#
|
278
|
-
# Builds and encodes the current payload, returning the encoded
|
279
|
-
# payload in String form.
|
247
|
+
# Encodes the current payload, returning the encoded payload in
|
248
|
+
# String form.
|
280
249
|
#
|
281
250
|
def encode_payload!
|
282
251
|
@encoded_payload = ''
|
283
252
|
|
284
253
|
if @payload
|
285
|
-
|
286
|
-
@payload.params = self.params
|
287
|
-
end
|
288
|
-
|
289
|
-
if @payload.kind_of?(Payloads::Payload)
|
290
|
-
@encoded_payload = @payload.build!
|
291
|
-
else
|
292
|
-
@encoded_payload = @payload.to_s
|
293
|
-
end
|
254
|
+
@encoded_payload = @payload.to_s
|
294
255
|
|
295
256
|
@encoders.each do |encoder|
|
296
257
|
if (new_payload = encoder.call(@encoded_payload))
|
@@ -317,7 +278,7 @@ module Ronin
|
|
317
278
|
#
|
318
279
|
def build!(options={})
|
319
280
|
if options[:payload]
|
320
|
-
@payload
|
281
|
+
@payload = options.delete(:payload)
|
321
282
|
end
|
322
283
|
|
323
284
|
self.params = options
|
@@ -346,30 +307,37 @@ module Ronin
|
|
346
307
|
end
|
347
308
|
|
348
309
|
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
|
353
|
-
|
354
|
-
|
310
|
+
# Returns +true+ if the exploit has previously been deployed, returns
|
311
|
+
# +false+ otherwise.
|
312
|
+
#
|
313
|
+
def deployed?
|
314
|
+
@deployed == true
|
315
|
+
end
|
316
|
+
|
317
|
+
#
|
318
|
+
# Verifies then deploys the exploit with the given _block_. If a
|
319
|
+
# _block_ is given, it will be passed the deployed exploit. If the
|
320
|
+
# exploit has not been previously built, an ExploitNotBuilt exception
|
321
|
+
# will be raised.
|
355
322
|
#
|
356
323
|
def deploy!(&block)
|
357
324
|
verify!
|
358
325
|
|
359
|
-
|
360
|
-
deploy()
|
326
|
+
@deployed = false
|
361
327
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
328
|
+
deploy()
|
329
|
+
|
330
|
+
@deployed = true
|
331
|
+
|
332
|
+
block.call(self) if block
|
333
|
+
return self
|
366
334
|
end
|
367
335
|
|
368
336
|
#
|
369
337
|
# Builds the exploit with the given _options_, then deploys the
|
370
338
|
# exploit with the given _block_.
|
371
339
|
#
|
372
|
-
def
|
340
|
+
def call(options={},&block)
|
373
341
|
build!(options)
|
374
342
|
|
375
343
|
return deploy!(&block)
|
@@ -382,6 +350,16 @@ module Ronin
|
|
382
350
|
"#{self.name} #{self.version}"
|
383
351
|
end
|
384
352
|
|
353
|
+
#
|
354
|
+
# Inspects the contents of the exploit.
|
355
|
+
#
|
356
|
+
def inspect
|
357
|
+
str = "#{self.class}: #{self}"
|
358
|
+
str << " #{self.params.inspect}" unless self.params.empty?
|
359
|
+
|
360
|
+
return "#<#{str}>"
|
361
|
+
end
|
362
|
+
|
385
363
|
protected
|
386
364
|
|
387
365
|
#
|
@@ -399,7 +377,9 @@ module Ronin
|
|
399
377
|
|
400
378
|
begin
|
401
379
|
require File.join('ronin','exploits','helpers',name)
|
402
|
-
rescue LoadError
|
380
|
+
rescue Gem::LoadError => e
|
381
|
+
raise(e)
|
382
|
+
rescue ::LoadError
|
403
383
|
raise(UnknownHelper,"unknown helper #{name.dump}",caller)
|
404
384
|
end
|
405
385
|
|
@@ -417,55 +397,6 @@ module Ronin
|
|
417
397
|
return true
|
418
398
|
end
|
419
399
|
|
420
|
-
#
|
421
|
-
# Verifies that a target has been selected. If a target has not been
|
422
|
-
# selected, a TargetUnspecified exception will be raised, otherwise
|
423
|
-
# +true+ will be returned.
|
424
|
-
#
|
425
|
-
def verify_target!
|
426
|
-
if target.nil?
|
427
|
-
raise(TargetUnspecified,"no suitable target provided",caller)
|
428
|
-
end
|
429
|
-
|
430
|
-
return true
|
431
|
-
end
|
432
|
-
|
433
|
-
#
|
434
|
-
# Verifies that the selected target has an arch property.
|
435
|
-
# If the selected target does not have an arch property, a
|
436
|
-
# TargetDataMissing exception will be raised, otherwise
|
437
|
-
# +true+ will be return.
|
438
|
-
#
|
439
|
-
def verify_arch!
|
440
|
-
if arch.nil?
|
441
|
-
raise(TargetDataMissing,"no suitable arch was provided",caller)
|
442
|
-
end
|
443
|
-
end
|
444
|
-
|
445
|
-
#
|
446
|
-
# Verifies that the selected target has an os property.
|
447
|
-
# If the selected target does not have an os property, a
|
448
|
-
# TargetDataMissing exception will be raised, otherwise
|
449
|
-
# +true+ will be return.
|
450
|
-
#
|
451
|
-
def verify_os!
|
452
|
-
if os.nil?
|
453
|
-
raise(TargetDataMissing,"no suitable os was provided",caller)
|
454
|
-
end
|
455
|
-
end
|
456
|
-
|
457
|
-
#
|
458
|
-
# Verifies that the selected target has an product property.
|
459
|
-
# If the selected target does not have an product property, a
|
460
|
-
# TargetDataMissing exception will be raised, otherwise
|
461
|
-
# +true+ will be return.
|
462
|
-
#
|
463
|
-
def verify_product!
|
464
|
-
if product.nil?
|
465
|
-
raise(TargetDataMissing,"no suitable product was provided",caller)
|
466
|
-
end
|
467
|
-
end
|
468
|
-
|
469
400
|
#
|
470
401
|
# Returns +true+ if the specified _text_ contains any restricted
|
471
402
|
# characters, returns +false+ otherwise.
|
@@ -478,22 +409,6 @@ module Ronin
|
|
478
409
|
return false
|
479
410
|
end
|
480
411
|
|
481
|
-
#
|
482
|
-
# Raises a RestrictedChar exception if the specified _text_ contains
|
483
|
-
# any restricted characters, returns +true+ otherwise.
|
484
|
-
#
|
485
|
-
def verify_restricted!(text)
|
486
|
-
found = @restricted_chars.select { |char|
|
487
|
-
text.include?(char)
|
488
|
-
}.map { |char| char.dump }
|
489
|
-
|
490
|
-
unless found.empty?
|
491
|
-
raise(RestrictedChar,"restricted characters #{found.join(', ')} was detected in #{text.dump}",caller)
|
492
|
-
end
|
493
|
-
|
494
|
-
return true
|
495
|
-
end
|
496
|
-
|
497
412
|
#
|
498
413
|
# Default build method.
|
499
414
|
#
|