ronin-exploits 1.0.0.beta2 → 1.0.0.beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/README.md +4 -0
  4. data/gemspec.yml +3 -1
  5. data/lib/ronin/exploits/cli/commands/run.rb +55 -5
  6. data/lib/ronin/exploits/version.rb +1 -1
  7. data/ronin-exploits.gemspec +2 -1
  8. metadata +10 -115
  9. data/spec/advisory_spec.rb +0 -71
  10. data/spec/cli/exploit_command_spec.rb +0 -68
  11. data/spec/cli/exploit_methods_spec.rb +0 -208
  12. data/spec/cli/ruby_shell_spec.rb +0 -14
  13. data/spec/client_side_web_vuln_spec.rb +0 -117
  14. data/spec/exploit_spec.rb +0 -538
  15. data/spec/exploits_spec.rb +0 -8
  16. data/spec/heap_overflow_spec.rb +0 -14
  17. data/spec/lfi_spec.rb +0 -162
  18. data/spec/loot/file_spec.rb +0 -131
  19. data/spec/loot_spec.rb +0 -138
  20. data/spec/memory_corruption_spec.rb +0 -22
  21. data/spec/metadata/arch_spec.rb +0 -82
  22. data/spec/metadata/cookie_param_spec.rb +0 -67
  23. data/spec/metadata/default_filename_spec.rb +0 -62
  24. data/spec/metadata/default_port_spec.rb +0 -62
  25. data/spec/metadata/header_name_spec.rb +0 -67
  26. data/spec/metadata/os_spec.rb +0 -164
  27. data/spec/metadata/shouts_spec.rb +0 -100
  28. data/spec/metadata/url_path_spec.rb +0 -67
  29. data/spec/metadata/url_query_param_spec.rb +0 -67
  30. data/spec/mixins/binary_spec.rb +0 -129
  31. data/spec/mixins/build_dir.rb +0 -66
  32. data/spec/mixins/file_builder_spec.rb +0 -67
  33. data/spec/mixins/format_string_spec.rb +0 -44
  34. data/spec/mixins/has_payload_spec.rb +0 -333
  35. data/spec/mixins/has_targets_spec.rb +0 -434
  36. data/spec/mixins/html_spec.rb +0 -772
  37. data/spec/mixins/http_spec.rb +0 -1227
  38. data/spec/mixins/loot_spec.rb +0 -20
  39. data/spec/mixins/nops_spec.rb +0 -165
  40. data/spec/mixins/remote_tcp_spec.rb +0 -217
  41. data/spec/mixins/remote_udp_spec.rb +0 -217
  42. data/spec/mixins/seh_spec.rb +0 -89
  43. data/spec/mixins/stack_overflow_spec.rb +0 -87
  44. data/spec/mixins/text_spec.rb +0 -43
  45. data/spec/open_redirect_spec.rb +0 -71
  46. data/spec/params/base_url_spec.rb +0 -71
  47. data/spec/params/bind_host_spec.rb +0 -34
  48. data/spec/params/bind_port_spec.rb +0 -35
  49. data/spec/params/filename_spec.rb +0 -77
  50. data/spec/params/host_spec.rb +0 -34
  51. data/spec/params/port_spec.rb +0 -77
  52. data/spec/rfi_spec.rb +0 -107
  53. data/spec/seh_overflow_spec.rb +0 -18
  54. data/spec/spec_helper.rb +0 -8
  55. data/spec/sqli_spec.rb +0 -306
  56. data/spec/ssti_spec.rb +0 -121
  57. data/spec/stack_overflow_spec.rb +0 -18
  58. data/spec/target_spec.rb +0 -92
  59. data/spec/test_result_spec.rb +0 -32
  60. data/spec/use_after_free_spec.rb +0 -14
  61. data/spec/web_spec.rb +0 -12
  62. data/spec/web_vuln_spec.rb +0 -854
  63. data/spec/xss_spec.rb +0 -69
@@ -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
@@ -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