ronin-exploits 1.0.0.beta1 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -0
- data/.yardopts +1 -1
- data/README.md +5 -1
- data/data/new/exploit.rb.erb +2 -2
- data/gemspec.yml +10 -1
- data/lib/ronin/exploits/advisory.rb +1 -1
- data/lib/ronin/exploits/cli/command.rb +1 -1
- data/lib/ronin/exploits/cli/commands/irb.rb +1 -1
- data/lib/ronin/exploits/cli/commands/list.rb +1 -1
- data/lib/ronin/exploits/cli/commands/new.rb +1 -1
- data/lib/ronin/exploits/cli/commands/run.rb +56 -6
- data/lib/ronin/exploits/cli/commands/show.rb +91 -65
- data/lib/ronin/exploits/cli/exploit_command.rb +1 -1
- data/lib/ronin/exploits/cli/exploit_methods.rb +1 -1
- data/lib/ronin/exploits/cli/ruby_shell.rb +1 -1
- data/lib/ronin/exploits/cli.rb +6 -1
- data/lib/ronin/exploits/client_side_web_vuln.rb +1 -1
- data/lib/ronin/exploits/exceptions.rb +1 -1
- data/lib/ronin/exploits/exploit.rb +1 -1
- data/lib/ronin/exploits/heap_overflow.rb +1 -1
- data/lib/ronin/exploits/lfi.rb +1 -1
- data/lib/ronin/exploits/loot/file.rb +1 -1
- data/lib/ronin/exploits/loot.rb +1 -1
- data/lib/ronin/exploits/memory_corruption.rb +1 -1
- data/lib/ronin/exploits/metadata/arch.rb +1 -1
- data/lib/ronin/exploits/metadata/cookie_param.rb +1 -1
- data/lib/ronin/exploits/metadata/default_filename.rb +1 -1
- data/lib/ronin/exploits/metadata/default_port.rb +1 -1
- data/lib/ronin/exploits/metadata/header_name.rb +1 -1
- data/lib/ronin/exploits/metadata/os.rb +1 -1
- data/lib/ronin/exploits/metadata/shouts.rb +1 -1
- data/lib/ronin/exploits/metadata/url_path.rb +1 -1
- data/lib/ronin/exploits/metadata/url_query_param.rb +1 -1
- data/lib/ronin/exploits/mixins/binary.rb +1 -1
- data/lib/ronin/exploits/mixins/build_dir.rb +1 -1
- data/lib/ronin/exploits/mixins/file_builder.rb +1 -1
- data/lib/ronin/exploits/mixins/format_string.rb +1 -1
- data/lib/ronin/exploits/mixins/has_payload.rb +1 -1
- data/lib/ronin/exploits/mixins/has_targets.rb +1 -1
- data/lib/ronin/exploits/mixins/html.rb +1 -1
- data/lib/ronin/exploits/mixins/http.rb +1 -1
- data/lib/ronin/exploits/mixins/loot.rb +1 -1
- data/lib/ronin/exploits/mixins/nops.rb +1 -1
- data/lib/ronin/exploits/mixins/remote_tcp.rb +1 -1
- data/lib/ronin/exploits/mixins/remote_udp.rb +1 -1
- data/lib/ronin/exploits/mixins/seh.rb +1 -1
- data/lib/ronin/exploits/mixins/stack_overflow.rb +1 -1
- data/lib/ronin/exploits/mixins/text.rb +1 -1
- data/lib/ronin/exploits/mixins.rb +1 -1
- data/lib/ronin/exploits/open_redirect.rb +1 -1
- data/lib/ronin/exploits/params/base_url.rb +1 -1
- data/lib/ronin/exploits/params/bind_host.rb +1 -1
- data/lib/ronin/exploits/params/bind_port.rb +1 -1
- data/lib/ronin/exploits/params/filename.rb +1 -1
- data/lib/ronin/exploits/params/host.rb +1 -1
- data/lib/ronin/exploits/params/port.rb +1 -1
- data/lib/ronin/exploits/registry.rb +1 -1
- data/lib/ronin/exploits/rfi.rb +1 -1
- data/lib/ronin/exploits/root.rb +1 -1
- data/lib/ronin/exploits/seh_overflow.rb +1 -1
- data/lib/ronin/exploits/sqli.rb +1 -1
- data/lib/ronin/exploits/ssti.rb +1 -1
- data/lib/ronin/exploits/stack_overflow.rb +1 -1
- data/lib/ronin/exploits/target.rb +1 -1
- data/lib/ronin/exploits/test_result.rb +1 -1
- data/lib/ronin/exploits/use_after_free.rb +1 -1
- data/lib/ronin/exploits/version.rb +2 -2
- data/lib/ronin/exploits/web.rb +1 -1
- data/lib/ronin/exploits/web_vuln.rb +1 -1
- data/lib/ronin/exploits/xss.rb +1 -1
- data/lib/ronin/exploits.rb +1 -1
- data/ronin-exploits.gemspec +2 -1
- metadata +16 -116
- data/spec/advisory_spec.rb +0 -71
- data/spec/cli/exploit_command_spec.rb +0 -68
- data/spec/cli/exploit_methods_spec.rb +0 -208
- data/spec/cli/ruby_shell_spec.rb +0 -14
- data/spec/client_side_web_vuln_spec.rb +0 -117
- data/spec/exploit_spec.rb +0 -538
- data/spec/exploits_spec.rb +0 -8
- data/spec/heap_overflow_spec.rb +0 -14
- data/spec/lfi_spec.rb +0 -162
- data/spec/loot/file_spec.rb +0 -131
- data/spec/loot_spec.rb +0 -138
- data/spec/memory_corruption_spec.rb +0 -22
- data/spec/metadata/arch_spec.rb +0 -82
- data/spec/metadata/cookie_param_spec.rb +0 -67
- data/spec/metadata/default_filename_spec.rb +0 -62
- data/spec/metadata/default_port_spec.rb +0 -62
- data/spec/metadata/header_name_spec.rb +0 -67
- data/spec/metadata/os_spec.rb +0 -164
- data/spec/metadata/shouts_spec.rb +0 -100
- data/spec/metadata/url_path_spec.rb +0 -67
- data/spec/metadata/url_query_param_spec.rb +0 -67
- data/spec/mixins/binary_spec.rb +0 -129
- data/spec/mixins/build_dir.rb +0 -66
- data/spec/mixins/file_builder_spec.rb +0 -67
- data/spec/mixins/format_string_spec.rb +0 -44
- data/spec/mixins/has_payload_spec.rb +0 -333
- data/spec/mixins/has_targets_spec.rb +0 -434
- data/spec/mixins/html_spec.rb +0 -772
- data/spec/mixins/http_spec.rb +0 -1227
- data/spec/mixins/loot_spec.rb +0 -20
- data/spec/mixins/nops_spec.rb +0 -165
- data/spec/mixins/remote_tcp_spec.rb +0 -217
- data/spec/mixins/remote_udp_spec.rb +0 -217
- data/spec/mixins/seh_spec.rb +0 -89
- data/spec/mixins/stack_overflow_spec.rb +0 -87
- data/spec/mixins/text_spec.rb +0 -43
- data/spec/open_redirect_spec.rb +0 -71
- data/spec/params/base_url_spec.rb +0 -71
- data/spec/params/bind_host_spec.rb +0 -34
- data/spec/params/bind_port_spec.rb +0 -35
- data/spec/params/filename_spec.rb +0 -77
- data/spec/params/host_spec.rb +0 -34
- data/spec/params/port_spec.rb +0 -77
- data/spec/rfi_spec.rb +0 -107
- data/spec/seh_overflow_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -8
- data/spec/sqli_spec.rb +0 -306
- data/spec/ssti_spec.rb +0 -121
- data/spec/stack_overflow_spec.rb +0 -18
- data/spec/target_spec.rb +0 -92
- data/spec/test_result_spec.rb +0 -32
- data/spec/use_after_free_spec.rb +0 -14
- data/spec/web_spec.rb +0 -12
- data/spec/web_vuln_spec.rb +0 -854
- data/spec/xss_spec.rb +0 -69
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-exploits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uri-query_params
|
@@ -136,10 +136,13 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.0'
|
139
|
-
description:
|
140
|
-
ronin-exploits
|
141
|
-
|
142
|
-
ronin-
|
139
|
+
description: |
|
140
|
+
ronin-exploits is a Ruby micro-framework for writing and running exploits.
|
141
|
+
ronin-exploits allows one to write exploits as plain old Ruby classes.
|
142
|
+
ronin-exploits can be distributed as Ruby files or as git repositories that
|
143
|
+
can be installed using ronin-reps.
|
144
|
+
|
145
|
+
It's like a simpler version of Metasploit.
|
143
146
|
email: postmodern.mod3@gmail.com
|
144
147
|
executables:
|
145
148
|
- ronin-exploits
|
@@ -244,65 +247,15 @@ files:
|
|
244
247
|
- man/ronin-exploits.1
|
245
248
|
- man/ronin-exploits.1.md
|
246
249
|
- ronin-exploits.gemspec
|
247
|
-
- spec/advisory_spec.rb
|
248
|
-
- spec/cli/exploit_command_spec.rb
|
249
|
-
- spec/cli/exploit_methods_spec.rb
|
250
|
-
- spec/cli/ruby_shell_spec.rb
|
251
|
-
- spec/client_side_web_vuln_spec.rb
|
252
|
-
- spec/exploit_spec.rb
|
253
|
-
- spec/exploits_spec.rb
|
254
|
-
- spec/heap_overflow_spec.rb
|
255
|
-
- spec/lfi_spec.rb
|
256
|
-
- spec/loot/file_spec.rb
|
257
|
-
- spec/loot_spec.rb
|
258
|
-
- spec/memory_corruption_spec.rb
|
259
|
-
- spec/metadata/arch_spec.rb
|
260
|
-
- spec/metadata/cookie_param_spec.rb
|
261
|
-
- spec/metadata/default_filename_spec.rb
|
262
|
-
- spec/metadata/default_port_spec.rb
|
263
|
-
- spec/metadata/header_name_spec.rb
|
264
|
-
- spec/metadata/os_spec.rb
|
265
|
-
- spec/metadata/shouts_spec.rb
|
266
|
-
- spec/metadata/url_path_spec.rb
|
267
|
-
- spec/metadata/url_query_param_spec.rb
|
268
|
-
- spec/mixins/binary_spec.rb
|
269
|
-
- spec/mixins/build_dir.rb
|
270
|
-
- spec/mixins/file_builder_spec.rb
|
271
|
-
- spec/mixins/format_string_spec.rb
|
272
|
-
- spec/mixins/has_payload_spec.rb
|
273
|
-
- spec/mixins/has_targets_spec.rb
|
274
|
-
- spec/mixins/html_spec.rb
|
275
|
-
- spec/mixins/http_spec.rb
|
276
|
-
- spec/mixins/loot_spec.rb
|
277
|
-
- spec/mixins/nops_spec.rb
|
278
|
-
- spec/mixins/remote_tcp_spec.rb
|
279
|
-
- spec/mixins/remote_udp_spec.rb
|
280
|
-
- spec/mixins/seh_spec.rb
|
281
|
-
- spec/mixins/stack_overflow_spec.rb
|
282
|
-
- spec/mixins/text_spec.rb
|
283
|
-
- spec/open_redirect_spec.rb
|
284
|
-
- spec/params/base_url_spec.rb
|
285
|
-
- spec/params/bind_host_spec.rb
|
286
|
-
- spec/params/bind_port_spec.rb
|
287
|
-
- spec/params/filename_spec.rb
|
288
|
-
- spec/params/host_spec.rb
|
289
|
-
- spec/params/port_spec.rb
|
290
|
-
- spec/rfi_spec.rb
|
291
|
-
- spec/seh_overflow_spec.rb
|
292
|
-
- spec/spec_helper.rb
|
293
|
-
- spec/sqli_spec.rb
|
294
|
-
- spec/ssti_spec.rb
|
295
|
-
- spec/stack_overflow_spec.rb
|
296
|
-
- spec/target_spec.rb
|
297
|
-
- spec/test_result_spec.rb
|
298
|
-
- spec/use_after_free_spec.rb
|
299
|
-
- spec/web_spec.rb
|
300
|
-
- spec/web_vuln_spec.rb
|
301
|
-
- spec/xss_spec.rb
|
302
250
|
homepage: https://ronin-rb.dev/exploits/
|
303
251
|
licenses:
|
304
252
|
- LGPL-3.0
|
305
|
-
metadata:
|
253
|
+
metadata:
|
254
|
+
documentation_uri: https://ronin-rb.dev/docs/ronin-exploits
|
255
|
+
source_code_uri: https://github.com/ronin-rb/ronin-exploits
|
256
|
+
bug_tracker_uri: https://github.com/ronin-rb/ronin-exploits/issues
|
257
|
+
changelog_uri: https://github.com/ronin-rb/ronin-exploits/blob/main/ChangeLog.md
|
258
|
+
rubygems_mfa_required: 'true'
|
306
259
|
post_install_message:
|
307
260
|
rdoc_options: []
|
308
261
|
require_paths:
|
@@ -322,57 +275,4 @@ rubygems_version: 3.3.26
|
|
322
275
|
signing_key:
|
323
276
|
specification_version: 4
|
324
277
|
summary: A Ruby micro-framework for writing and running exploits and payloads.
|
325
|
-
test_files:
|
326
|
-
- spec/advisory_spec.rb
|
327
|
-
- spec/cli/exploit_command_spec.rb
|
328
|
-
- spec/cli/exploit_methods_spec.rb
|
329
|
-
- spec/cli/ruby_shell_spec.rb
|
330
|
-
- spec/client_side_web_vuln_spec.rb
|
331
|
-
- spec/exploit_spec.rb
|
332
|
-
- spec/exploits_spec.rb
|
333
|
-
- spec/heap_overflow_spec.rb
|
334
|
-
- spec/lfi_spec.rb
|
335
|
-
- spec/loot/file_spec.rb
|
336
|
-
- spec/loot_spec.rb
|
337
|
-
- spec/memory_corruption_spec.rb
|
338
|
-
- spec/metadata/arch_spec.rb
|
339
|
-
- spec/metadata/cookie_param_spec.rb
|
340
|
-
- spec/metadata/default_filename_spec.rb
|
341
|
-
- spec/metadata/default_port_spec.rb
|
342
|
-
- spec/metadata/header_name_spec.rb
|
343
|
-
- spec/metadata/os_spec.rb
|
344
|
-
- spec/metadata/shouts_spec.rb
|
345
|
-
- spec/metadata/url_path_spec.rb
|
346
|
-
- spec/metadata/url_query_param_spec.rb
|
347
|
-
- spec/mixins/binary_spec.rb
|
348
|
-
- spec/mixins/file_builder_spec.rb
|
349
|
-
- spec/mixins/format_string_spec.rb
|
350
|
-
- spec/mixins/has_payload_spec.rb
|
351
|
-
- spec/mixins/has_targets_spec.rb
|
352
|
-
- spec/mixins/html_spec.rb
|
353
|
-
- spec/mixins/http_spec.rb
|
354
|
-
- spec/mixins/loot_spec.rb
|
355
|
-
- spec/mixins/nops_spec.rb
|
356
|
-
- spec/mixins/remote_tcp_spec.rb
|
357
|
-
- spec/mixins/remote_udp_spec.rb
|
358
|
-
- spec/mixins/seh_spec.rb
|
359
|
-
- spec/mixins/stack_overflow_spec.rb
|
360
|
-
- spec/mixins/text_spec.rb
|
361
|
-
- spec/open_redirect_spec.rb
|
362
|
-
- spec/params/base_url_spec.rb
|
363
|
-
- spec/params/bind_host_spec.rb
|
364
|
-
- spec/params/bind_port_spec.rb
|
365
|
-
- spec/params/filename_spec.rb
|
366
|
-
- spec/params/host_spec.rb
|
367
|
-
- spec/params/port_spec.rb
|
368
|
-
- spec/rfi_spec.rb
|
369
|
-
- spec/seh_overflow_spec.rb
|
370
|
-
- spec/sqli_spec.rb
|
371
|
-
- spec/ssti_spec.rb
|
372
|
-
- spec/stack_overflow_spec.rb
|
373
|
-
- spec/target_spec.rb
|
374
|
-
- spec/test_result_spec.rb
|
375
|
-
- spec/use_after_free_spec.rb
|
376
|
-
- spec/web_spec.rb
|
377
|
-
- spec/web_vuln_spec.rb
|
378
|
-
- spec/xss_spec.rb
|
278
|
+
test_files: []
|
data/spec/advisory_spec.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/exploits/advisory'
|
3
|
-
|
4
|
-
describe Ronin::Exploits::Advisory do
|
5
|
-
let(:id) { 'CVE-2022-1234' }
|
6
|
-
let(:url) { "https://nvd.nist.gov/vuln/detail/#{id}" }
|
7
|
-
|
8
|
-
subject { described_class.new(id,url) }
|
9
|
-
|
10
|
-
describe "#initialize" do
|
11
|
-
context "when given only an id" do
|
12
|
-
subject { described_class.new(id) }
|
13
|
-
|
14
|
-
it "must set #id" do
|
15
|
-
expect(subject.id).to eq(id)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "must default #url to .url_for(id)" do
|
19
|
-
expect(subject.url).to eq(described_class.url_for(id))
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when given an id and a url" do
|
24
|
-
subject { described_class.new(id,url) }
|
25
|
-
|
26
|
-
it "must set #id" do
|
27
|
-
expect(subject.id).to eq(id)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "must set #url" do
|
31
|
-
expect(subject.url).to eq(url)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe ".url_for" do
|
37
|
-
subject { described_class }
|
38
|
-
|
39
|
-
context "when given a CVE-YYYY-NNNN id" do
|
40
|
-
let(:id) { 'CVE-2022-1234' }
|
41
|
-
|
42
|
-
it "must return 'https://nvd.nist.gov/vuln/detail/CVE-YYYY-NNNN'" do
|
43
|
-
expect(subject.url_for(id)).to eq(
|
44
|
-
"https://nvd.nist.gov/vuln/detail/#{id}"
|
45
|
-
)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "when given a GHSA-XXXX id" do
|
50
|
-
let(:id) { 'GHSA-1234abcd' }
|
51
|
-
|
52
|
-
it "must return 'https://github.com/advisories/GHSA-XXXX'" do
|
53
|
-
expect(subject.url_for(id)).to eq("https://github.com/advisories/#{id}")
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "when given any other kind of id" do
|
58
|
-
let(:id) { 'XYZ-123' }
|
59
|
-
|
60
|
-
it "must return nil" do
|
61
|
-
expect(subject.url_for(id)).to be(nil)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "#to_s" do
|
67
|
-
it "must return the advisory #id" do
|
68
|
-
expect(subject.to_s).to eq(id)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/exploits/cli/exploit_command'
|
3
|
-
require 'ronin/exploits/exploit'
|
4
|
-
|
5
|
-
describe Ronin::Exploits::CLI::ExploitCommand do
|
6
|
-
module TestExploitCommand
|
7
|
-
class TestExploit < Ronin::Exploits::Exploit
|
8
|
-
register 'test_exploit_command'
|
9
|
-
end
|
10
|
-
|
11
|
-
class TestCommand < Ronin::Exploits::CLI::ExploitCommand
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:exploit_class) { TestExploitCommand::TestExploit }
|
16
|
-
let(:command_class) { TestExploitCommand::TestCommand }
|
17
|
-
subject { command_class.new }
|
18
|
-
|
19
|
-
describe "#load_exploit" do
|
20
|
-
let(:id) { exploit_class.id }
|
21
|
-
|
22
|
-
before do
|
23
|
-
expect(Ronin::Exploits).to receive(:load_class).with(id).and_return(exploit_class)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "must load the exploit class and return the exploit class" do
|
27
|
-
expect(subject.load_exploit(id)).to be(exploit_class)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "must also set #exploit_class" do
|
31
|
-
subject.load_exploit(id)
|
32
|
-
|
33
|
-
expect(subject.exploit_class).to be(exploit_class)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "#load_exploit_from" do
|
38
|
-
let(:file) { "path/to/exploit/file.rb" }
|
39
|
-
|
40
|
-
before do
|
41
|
-
expect(Ronin::Exploits).to receive(:load_class_from_file).with(file).and_return(exploit_class)
|
42
|
-
end
|
43
|
-
|
44
|
-
it "must load the exploit class and return the exploit class" do
|
45
|
-
expect(subject.load_exploit_from(file)).to be(exploit_class)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "must also set #exploit_class" do
|
49
|
-
subject.load_exploit_from(file)
|
50
|
-
|
51
|
-
expect(subject.exploit_class).to be(exploit_class)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "#initialize_exploit" do
|
56
|
-
before { subject.load_exploit(exploit_class.id) }
|
57
|
-
|
58
|
-
it "must initialize a new exploit object using #exploit_class" do
|
59
|
-
expect(subject.initialize_exploit).to be_kind_of(exploit_class)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "must also set #exploit" do
|
63
|
-
subject.initialize_exploit
|
64
|
-
|
65
|
-
expect(subject.exploit).to be_kind_of(exploit_class)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,208 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/exploits/cli/exploit_methods'
|
3
|
-
require 'ronin/exploits/cli/command'
|
4
|
-
|
5
|
-
describe Ronin::Exploits::CLI::ExploitMethods do
|
6
|
-
module TestExploitMethods
|
7
|
-
class TestCommand < Ronin::Exploits::CLI::Command
|
8
|
-
include Ronin::Exploits::CLI::ExploitMethods
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:command_class) { TestExploitMethods::TestCommand }
|
13
|
-
subject { command_class.new }
|
14
|
-
|
15
|
-
describe "#load_exploit" do
|
16
|
-
let(:exploit_id) { 'html/encode' }
|
17
|
-
|
18
|
-
it "must call Exploits.load_class with the given ID" do
|
19
|
-
expect(Ronin::Exploits).to receive(:load_class).with(exploit_id)
|
20
|
-
expect(subject).to_not receive(:exit)
|
21
|
-
|
22
|
-
subject.load_exploit(exploit_id)
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when Ronin::Exploits::ClassNotfound is raised" do
|
26
|
-
let(:message) { "class not found" }
|
27
|
-
let(:exception) do
|
28
|
-
Ronin::Exploits::ClassNotFound.new(message)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "must print an error message and exit with an error code" do
|
32
|
-
expect(Ronin::Exploits).to receive(:load_class).with(exploit_id).and_raise(exception)
|
33
|
-
expect(subject).to receive(:exit).with(1)
|
34
|
-
|
35
|
-
expect {
|
36
|
-
subject.load_exploit(exploit_id)
|
37
|
-
}.to output("#{subject.command_name}: #{message}#{$/}").to_stderr
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when another type of exception is raised" do
|
42
|
-
let(:message) { "unexpected error" }
|
43
|
-
let(:exception) { RuntimeError.new(message) }
|
44
|
-
|
45
|
-
it "must print the exception, an error message, and exit with -1" do
|
46
|
-
expect(Ronin::Exploits).to receive(:load_class).with(exploit_id).and_raise(exception)
|
47
|
-
expect(subject).to receive(:print_exception).with(exception)
|
48
|
-
expect(subject).to receive(:exit).with(-1)
|
49
|
-
|
50
|
-
expect {
|
51
|
-
subject.load_exploit(exploit_id)
|
52
|
-
}.to output("#{subject.command_name}: an unhandled exception occurred while loading exploit #{exploit_id}#{$/}").to_stderr
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "#load_exploit_from" do
|
58
|
-
let(:file) { '/path/to/html/encode.rb' }
|
59
|
-
|
60
|
-
it "must call Exploits.load_class with the given ID and file" do
|
61
|
-
expect(Ronin::Exploits).to receive(:load_class_from_file).with(file)
|
62
|
-
expect(subject).to_not receive(:exit)
|
63
|
-
|
64
|
-
subject.load_exploit_from(file)
|
65
|
-
end
|
66
|
-
|
67
|
-
context "when Ronin::Exploits::ClassNotfound is raised" do
|
68
|
-
let(:message) { "class not found" }
|
69
|
-
let(:exception) do
|
70
|
-
Ronin::Exploits::ClassNotFound.new(message)
|
71
|
-
end
|
72
|
-
|
73
|
-
it "must print an error message and exit with an error code" do
|
74
|
-
expect(Ronin::Exploits).to receive(:load_class_from_file).with(file).and_raise(exception)
|
75
|
-
expect(subject).to receive(:exit).with(1)
|
76
|
-
|
77
|
-
expect {
|
78
|
-
subject.load_exploit_from(file)
|
79
|
-
}.to output("#{subject.command_name}: #{message}#{$/}").to_stderr
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "when another type of exception is raised" do
|
84
|
-
let(:message) { "unexpected error" }
|
85
|
-
let(:exception) { RuntimeError.new(message) }
|
86
|
-
|
87
|
-
it "must print the exception, an error message, and exit with -1" do
|
88
|
-
expect(Ronin::Exploits).to receive(:load_class_from_file).with(file).and_raise(exception)
|
89
|
-
expect(subject).to receive(:print_exception).with(exception)
|
90
|
-
expect(subject).to receive(:exit).with(-1)
|
91
|
-
|
92
|
-
expect {
|
93
|
-
subject.load_exploit_from(file)
|
94
|
-
}.to output(
|
95
|
-
"#{subject.command_name}: an unhandled exception occurred while loading exploit from file #{file}#{$/}"
|
96
|
-
).to_stderr
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe "#initialie_exploit" do
|
102
|
-
let(:exploit_id) { 'test' }
|
103
|
-
let(:exploit_class) { double('Encoder class', id: exploit_id) }
|
104
|
-
|
105
|
-
it "must return a new instance of the given exploit class" do
|
106
|
-
expect(exploit_class).to receive(:new)
|
107
|
-
|
108
|
-
subject.initialize_exploit(exploit_class)
|
109
|
-
end
|
110
|
-
|
111
|
-
context "when additional keyword arguments are given" do
|
112
|
-
let(:kwargs) do
|
113
|
-
{foo: 1, bar: 2}
|
114
|
-
end
|
115
|
-
|
116
|
-
it "must pass them to new()" do
|
117
|
-
expect(exploit_class).to receive(:new).with(**kwargs)
|
118
|
-
|
119
|
-
subject.initialize_exploit(exploit_class,**kwargs)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context "when a Core::Params::ParamError is raised" do
|
124
|
-
let(:message) { "param foo was not set" }
|
125
|
-
let(:exception) { Ronin::Core::Params::RequiredParam.new(message) }
|
126
|
-
|
127
|
-
it "must print an error message and exit with 1" do
|
128
|
-
expect(exploit_class).to receive(:new).and_raise(exception)
|
129
|
-
expect(subject).to receive(:exit).with(1)
|
130
|
-
|
131
|
-
expect {
|
132
|
-
subject.initialize_exploit(exploit_class)
|
133
|
-
}.to output("#{subject.command_name}: #{message}#{$/}").to_stderr
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context "when another type of exception is raised" do
|
138
|
-
let(:message) { "unexpected error" }
|
139
|
-
let(:exception) { RuntimeError.new(message) }
|
140
|
-
|
141
|
-
it "must print the exception, an error message, and exit with -1" do
|
142
|
-
expect(exploit_class).to receive(:new).and_raise(exception)
|
143
|
-
expect(subject).to receive(:print_exception).with(exception)
|
144
|
-
expect(subject).to receive(:exit).with(-1)
|
145
|
-
|
146
|
-
expect {
|
147
|
-
subject.initialize_exploit(exploit_class)
|
148
|
-
}.to output("#{subject.command_name}: an unhandled exception occurred while initializing exploit #{exploit_id}#{$/}").to_stderr
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
describe "#validate_exploit" do
|
154
|
-
let(:exploit_id) { 'test' }
|
155
|
-
let(:exploit) { double('Encoder instance', class_id: exploit_id) }
|
156
|
-
|
157
|
-
it "must call #perform_validate on #exploit" do
|
158
|
-
expect(exploit).to receive(:perform_validate)
|
159
|
-
|
160
|
-
subject.validate_exploit(exploit)
|
161
|
-
end
|
162
|
-
|
163
|
-
context "when a Core::Params::ParamError is raised" do
|
164
|
-
let(:message) { "param foo was not set" }
|
165
|
-
let(:exception) { Ronin::Core::Params::RequiredParam.new(message) }
|
166
|
-
|
167
|
-
it "must print an error message and exit with 1" do
|
168
|
-
expect(exploit).to receive(:perform_validate).and_raise(exception)
|
169
|
-
expect(subject).to receive(:exit).with(1)
|
170
|
-
|
171
|
-
expect {
|
172
|
-
subject.validate_exploit(exploit)
|
173
|
-
}.to output("#{subject.command_name}: failed to validate the exploit #{exploit_id}: #{message}#{$/}").to_stderr
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
context "when a Ronin::Exploits::ValidationError is raised" do
|
178
|
-
let(:message) { "param foo was not set" }
|
179
|
-
let(:exception) do
|
180
|
-
Ronin::Exploits::ValidationError.new(message)
|
181
|
-
end
|
182
|
-
|
183
|
-
it "must print an error message and exit with 1" do
|
184
|
-
expect(exploit).to receive(:perform_validate).and_raise(exception)
|
185
|
-
expect(subject).to receive(:exit).with(1)
|
186
|
-
|
187
|
-
expect {
|
188
|
-
subject.validate_exploit(exploit)
|
189
|
-
}.to output("#{subject.command_name}: failed to validate the exploit #{exploit_id}: #{message}#{$/}").to_stderr
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
context "when another type of exception is raised" do
|
194
|
-
let(:message) { "unexpected error" }
|
195
|
-
let(:exception) { RuntimeError.new(message) }
|
196
|
-
|
197
|
-
it "must print the exception, an error message, and exit with -1" do
|
198
|
-
expect(exploit).to receive(:perform_validate).and_raise(exception)
|
199
|
-
expect(subject).to receive(:print_exception).with(exception)
|
200
|
-
expect(subject).to receive(:exit).with(-1)
|
201
|
-
|
202
|
-
expect {
|
203
|
-
subject.validate_exploit(exploit)
|
204
|
-
}.to output("#{subject.command_name}: an unhandled exception occurred while validating the exploit #{exploit_id}#{$/}").to_stderr
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
data/spec/cli/ruby_shell_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/exploits/cli/ruby_shell'
|
3
|
-
|
4
|
-
describe Ronin::Exploits::CLI::RubyShell do
|
5
|
-
describe "#initialize" do
|
6
|
-
it "must default #name to 'ronin-exploits'" do
|
7
|
-
expect(subject.name).to eq('ronin-exploits')
|
8
|
-
end
|
9
|
-
|
10
|
-
it "must default #context to Ronin::Exploits" do
|
11
|
-
expect(subject.context).to be(Ronin::Exploits)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/exploits/client_side_web_vuln'
|
3
|
-
require 'ronin/vulns/web_vuln'
|
4
|
-
|
5
|
-
describe Ronin::Exploits::ClientSideWebVuln do
|
6
|
-
module TestClientSideWebVuln
|
7
|
-
class TestExploit < Ronin::Exploits::ClientSideWebVuln
|
8
|
-
base_path '/Templatize.asp'
|
9
|
-
query_param 'item'
|
10
|
-
|
11
|
-
def vuln
|
12
|
-
@vuln ||= Ronin::Vulns::WebVuln.new(url, **web_vuln_kwargs)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:exploit_class) { TestClientSideWebVuln::TestExploit }
|
18
|
-
let(:base_url) { 'http://testasp.vulnweb.com/' }
|
19
|
-
let(:query) { 'item=html/about.html' }
|
20
|
-
let(:query_param) { 'item' }
|
21
|
-
let(:payload) { 'test payload' }
|
22
|
-
|
23
|
-
subject do
|
24
|
-
exploit_class.new(
|
25
|
-
payload: payload,
|
26
|
-
params: {
|
27
|
-
base_url: base_url
|
28
|
-
}
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "must define a 'format' param" do
|
33
|
-
expect(described_class.params[:format]).to_not be(nil)
|
34
|
-
expect(described_class.params[:format].type).to be_kind_of(Ronin::Core::Params::Types::Enum)
|
35
|
-
expect(described_class.params[:format].type.values).to eq([:http, :curl])
|
36
|
-
expect(described_class.params[:format].desc).to eq('Output format')
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#format_exploit" do
|
40
|
-
context "when the 'format' param is :http" do
|
41
|
-
subject do
|
42
|
-
exploit_class.new(
|
43
|
-
payload: payload,
|
44
|
-
params: {
|
45
|
-
base_url: base_url,
|
46
|
-
format: :http
|
47
|
-
}
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "must call #to_http on the #vuln object" do
|
52
|
-
expect(subject.format_exploit).to eq(subject.vuln.to_http(payload))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context "when the 'format' param is :curl" do
|
57
|
-
subject do
|
58
|
-
exploit_class.new(
|
59
|
-
payload: payload,
|
60
|
-
params: {
|
61
|
-
base_url: base_url,
|
62
|
-
format: :curl
|
63
|
-
}
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "must call #to_curl on the #vuln object" do
|
68
|
-
expect(subject.format_exploit).to eq(subject.vuln.to_curl(payload))
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "#launch" do
|
74
|
-
context "when the 'format' param is :http" do
|
75
|
-
subject do
|
76
|
-
exploit_class.new(
|
77
|
-
payload: payload,
|
78
|
-
params: {
|
79
|
-
base_url: base_url,
|
80
|
-
format: :http
|
81
|
-
}
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "must print out a message and the exploit formatted as an HTTP request" do
|
86
|
-
expect(subject).to receive(:print_info).with("Copy and paste the following exploit:")
|
87
|
-
expect(subject).to receive(:puts)
|
88
|
-
expect(subject).to receive(:puts).with(subject.vuln.to_http(payload))
|
89
|
-
expect(subject).to receive(:puts)
|
90
|
-
|
91
|
-
subject.launch
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context "when the 'format' param is :curl" do
|
96
|
-
subject do
|
97
|
-
exploit_class.new(
|
98
|
-
payload: payload,
|
99
|
-
params: {
|
100
|
-
base_url: base_url,
|
101
|
-
format: :curl
|
102
|
-
}
|
103
|
-
)
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
it "must print out a message and the exploit formatted as an HTTP request" do
|
108
|
-
expect(subject).to receive(:print_info).with("Copy and paste the following exploit:")
|
109
|
-
expect(subject).to receive(:puts)
|
110
|
-
expect(subject).to receive(:puts).with(subject.vuln.to_curl(payload))
|
111
|
-
expect(subject).to receive(:puts)
|
112
|
-
|
113
|
-
subject.launch
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|