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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -0
- data/README.md +4 -0
- data/gemspec.yml +3 -1
- data/lib/ronin/exploits/cli/commands/run.rb +55 -5
- data/lib/ronin/exploits/version.rb +1 -1
- data/ronin-exploits.gemspec +2 -1
- metadata +10 -115
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 850efd0369626bc57a83bf7d51ab1d8fc471bfe1472feee5720c80d7f064fdb5
|
4
|
+
data.tar.gz: b185d3383dc0549dd4aa9aa5e9df990a9554081028fb4cf2e49fd47332ffba7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 958a1be608668de05fd28d2baeb44d1e7be1765cae684a4110a3183d92647582e6d51921ea24347a562685750717faf5e6e33d62102947f7f11afa3c9b8e7d3b
|
7
|
+
data.tar.gz: 8dbb0fc9782bced0ea57d49f9f65181ee752776c52ae31f437c368affecbb7a44e288c4e6568ea030d48ee1afde343b3c2cef56d9c9ad2e0c66af68519e216ab
|
data/.github/workflows/ruby.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://github.com/ronin-rb/ronin-exploits/actions/workflows/ruby.yml)
|
4
4
|
[](https://codeclimate.com/github/ronin-rb/ronin-exploits)
|
5
|
+
[](https://badge.fury.io/rb/ronin-exploits)
|
5
6
|
|
6
7
|
* [Source](https://github.com/ronin-rb/ronin-exploits)
|
7
8
|
* [Issues](https://github.com/ronin-rb/ronin-exploits/issues)
|
@@ -17,6 +18,9 @@ ronin-exploits allows one to write exploits as plain old Ruby classes.
|
|
17
18
|
ronin-exploits can be distributed as Ruby files or as git repositories that can
|
18
19
|
be installed using [ronin-repos].
|
19
20
|
|
21
|
+
**tl;dr** It's like a simpler version of
|
22
|
+
[Metasploit](https://www.metasploit.com/).
|
23
|
+
|
20
24
|
ronin-exploits is part of the [ronin-rb] project, a [Ruby] toolkit for security
|
21
25
|
research and development.
|
22
26
|
|
data/gemspec.yml
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
name: ronin-exploits
|
2
2
|
summary: A Ruby micro-framework for writing and running exploits and payloads.
|
3
|
-
description:
|
3
|
+
description: |
|
4
4
|
ronin-exploits is a Ruby micro-framework for writing and running exploits.
|
5
5
|
ronin-exploits allows one to write exploits as plain old Ruby classes.
|
6
6
|
ronin-exploits can be distributed as Ruby files or as git repositories that
|
7
7
|
can be installed using ronin-reps.
|
8
8
|
|
9
|
+
It's like a simpler version of Metasploit.
|
10
|
+
|
9
11
|
license: LGPL-3.0
|
10
12
|
authors: Postmodern
|
11
13
|
email: postmodern.mod3@gmail.com
|
@@ -118,7 +118,11 @@ module Ronin
|
|
118
118
|
type: /\A[^=\s]+=.+\z/,
|
119
119
|
usage: 'NAME=VALUE'
|
120
120
|
},
|
121
|
-
desc: 'Sets a param on the payload'
|
121
|
+
desc: 'Sets a param on the payload' do |param|
|
122
|
+
name, value = param.split('=',2)
|
123
|
+
|
124
|
+
@payload_params[name.to_sym] = value
|
125
|
+
end
|
122
126
|
|
123
127
|
# Encoder options
|
124
128
|
option :encoder_file, value: {
|
@@ -228,6 +232,7 @@ module Ronin
|
|
228
232
|
|
229
233
|
@load_encoders = []
|
230
234
|
@encoder_params = Hash.new { |hash,key| hash[key] = {} }
|
235
|
+
@payload_params = {}
|
231
236
|
@target_kwargs = {}
|
232
237
|
end
|
233
238
|
|
@@ -244,6 +249,7 @@ module Ronin
|
|
244
249
|
load_payload
|
245
250
|
initialize_encoders
|
246
251
|
initialize_payload
|
252
|
+
validate_payload
|
247
253
|
initialize_exploit
|
248
254
|
validate_exploit
|
249
255
|
run_exploit
|
@@ -257,6 +263,10 @@ module Ronin
|
|
257
263
|
perform_cleanup
|
258
264
|
end
|
259
265
|
|
266
|
+
#
|
267
|
+
# Loads the payload encoder classes specified by `--encoder` or
|
268
|
+
# `--encoder-file`.
|
269
|
+
#
|
260
270
|
def load_encoders
|
261
271
|
@encoder_classes = @load_encoders.map do |(type,value)|
|
262
272
|
case type
|
@@ -266,12 +276,20 @@ module Ronin
|
|
266
276
|
end
|
267
277
|
end
|
268
278
|
|
279
|
+
#
|
280
|
+
# Initializes the payload encoders specified by `--encoder` or
|
281
|
+
# `--encoder-file`.
|
282
|
+
#
|
269
283
|
def initialize_encoders
|
270
284
|
@encoders = @encoder_classes.map do |encoder_class|
|
271
285
|
encoder_class.new(params: @encoder_params[encoder_class.id])
|
272
286
|
end
|
273
287
|
end
|
274
288
|
|
289
|
+
#
|
290
|
+
# Loads the payload class specified by `--payload` or
|
291
|
+
# `--payload-file`.
|
292
|
+
#
|
275
293
|
def load_payload
|
276
294
|
@payload_class = if options[:payload]
|
277
295
|
super(options[:payload])
|
@@ -280,6 +298,10 @@ module Ronin
|
|
280
298
|
end
|
281
299
|
end
|
282
300
|
|
301
|
+
#
|
302
|
+
# Initializes the payload specified by `--payload`, `--payload-file`,
|
303
|
+
# `--read-payload`, or `--payload-string`.
|
304
|
+
#
|
283
305
|
def initialize_payload
|
284
306
|
@payload = if @payload_class
|
285
307
|
super(@payload_class, params: @payload_params,
|
@@ -291,6 +313,16 @@ module Ronin
|
|
291
313
|
end
|
292
314
|
end
|
293
315
|
|
316
|
+
#
|
317
|
+
# Validates the payload.
|
318
|
+
#
|
319
|
+
def validate_payload
|
320
|
+
super(@payload)
|
321
|
+
end
|
322
|
+
|
323
|
+
#
|
324
|
+
# Initializes the exploit.
|
325
|
+
#
|
294
326
|
def initialize_exploit
|
295
327
|
kwargs = {params: @params}
|
296
328
|
|
@@ -309,13 +341,16 @@ module Ronin
|
|
309
341
|
super(**kwargs)
|
310
342
|
end
|
311
343
|
|
344
|
+
#
|
345
|
+
# Runs the exploit.
|
346
|
+
#
|
312
347
|
def run_exploit
|
313
348
|
log_info "Running exploit #{@exploit.class_id} ..."
|
314
349
|
|
315
350
|
begin
|
316
351
|
@exploit.exploit(dry_run: options[:dry_run])
|
317
352
|
rescue ExploitError => error
|
318
|
-
print_error
|
353
|
+
print_error "failed to run exploit #{@exploit.class_id}: #{error.message}"
|
319
354
|
exit(1)
|
320
355
|
rescue => error
|
321
356
|
print_exception(error)
|
@@ -324,6 +359,9 @@ module Ronin
|
|
324
359
|
end
|
325
360
|
end
|
326
361
|
|
362
|
+
#
|
363
|
+
# Starts an interactive ruby shell within the exploit object.
|
364
|
+
#
|
327
365
|
def start_shell
|
328
366
|
log_info "Exploit #{@exploit.class_id} launched!"
|
329
367
|
log_info "Starting interactive Ruby shell ..."
|
@@ -331,12 +369,15 @@ module Ronin
|
|
331
369
|
RubyShell.start(name: @exploit_class.name, context: @exploit)
|
332
370
|
end
|
333
371
|
|
372
|
+
#
|
373
|
+
# Performs the post-exploitation stage.
|
374
|
+
#
|
334
375
|
def post_exploitation
|
335
376
|
if @exploit_class.include?(Mixins::HasPayload) &&
|
336
377
|
@exploit.payload.kind_of?(Ronin::Payloads::Payload) &&
|
337
|
-
@exploit.payload.kind_of?(Ronin::Payloads::Mixins::
|
378
|
+
@exploit.payload.kind_of?(Ronin::Payloads::Mixins::PostEx)
|
338
379
|
unless @exploit.payload.session
|
339
|
-
print_error
|
380
|
+
print_error "payload (#{@exploit.payload.class_id}) did not create a post-exploitation session"
|
340
381
|
|
341
382
|
perform_cleanup
|
342
383
|
eixt(1)
|
@@ -349,6 +390,9 @@ module Ronin
|
|
349
390
|
end
|
350
391
|
end
|
351
392
|
|
393
|
+
#
|
394
|
+
# Prints any loot collected by the exploit.
|
395
|
+
#
|
352
396
|
def print_loot
|
353
397
|
unless @exploit.loot.empty?
|
354
398
|
log_info "Exploit found the following loot:"
|
@@ -372,15 +416,21 @@ module Ronin
|
|
372
416
|
end
|
373
417
|
end
|
374
418
|
|
419
|
+
#
|
420
|
+
# Saves the collected loot to the `--save-loot` directory.
|
421
|
+
#
|
375
422
|
def save_loot
|
376
423
|
@exploit.loot.save(options.fetch(:save_loot))
|
377
424
|
end
|
378
425
|
|
426
|
+
#
|
427
|
+
# Performs the cleanup stage of the exploit.
|
428
|
+
#
|
379
429
|
def perform_cleanup
|
380
430
|
begin
|
381
431
|
@exploit.perform_cleanup
|
382
432
|
rescue ExploitError => error
|
383
|
-
print_error
|
433
|
+
print_error "failed to cleanup exploit #{@exploit.class_id}: #{error.message}"
|
384
434
|
exit(1)
|
385
435
|
rescue => error
|
386
436
|
print_exception(error)
|
data/ronin-exploits.gemspec
CHANGED
@@ -27,6 +27,8 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.files = `git ls-files`.split($/)
|
28
28
|
gem.files = glob[gemspec['files']] if gemspec['files']
|
29
29
|
gem.files += Array(gemspec['generated_files'])
|
30
|
+
# exclude test files from the packages gem
|
31
|
+
gem.files -= glob[gemspec['test_files'] || 'spec/{**/}*']
|
30
32
|
|
31
33
|
gem.executables = gemspec.fetch('executables') do
|
32
34
|
glob['bin/*'].map { |path| File.basename(path) }
|
@@ -34,7 +36,6 @@ Gem::Specification.new do |gem|
|
|
34
36
|
gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
|
35
37
|
|
36
38
|
gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
|
37
|
-
gem.test_files = glob[gemspec['test_files'] || 'spec/{**/}*_spec.rb']
|
38
39
|
gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
|
39
40
|
|
40
41
|
gem.require_paths = Array(gemspec.fetch('require_paths') {
|
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,61 +247,6 @@ 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
|
@@ -327,57 +275,4 @@ rubygems_version: 3.3.26
|
|
327
275
|
signing_key:
|
328
276
|
specification_version: 4
|
329
277
|
summary: A Ruby micro-framework for writing and running exploits and payloads.
|
330
|
-
test_files:
|
331
|
-
- spec/advisory_spec.rb
|
332
|
-
- spec/cli/exploit_command_spec.rb
|
333
|
-
- spec/cli/exploit_methods_spec.rb
|
334
|
-
- spec/cli/ruby_shell_spec.rb
|
335
|
-
- spec/client_side_web_vuln_spec.rb
|
336
|
-
- spec/exploit_spec.rb
|
337
|
-
- spec/exploits_spec.rb
|
338
|
-
- spec/heap_overflow_spec.rb
|
339
|
-
- spec/lfi_spec.rb
|
340
|
-
- spec/loot/file_spec.rb
|
341
|
-
- spec/loot_spec.rb
|
342
|
-
- spec/memory_corruption_spec.rb
|
343
|
-
- spec/metadata/arch_spec.rb
|
344
|
-
- spec/metadata/cookie_param_spec.rb
|
345
|
-
- spec/metadata/default_filename_spec.rb
|
346
|
-
- spec/metadata/default_port_spec.rb
|
347
|
-
- spec/metadata/header_name_spec.rb
|
348
|
-
- spec/metadata/os_spec.rb
|
349
|
-
- spec/metadata/shouts_spec.rb
|
350
|
-
- spec/metadata/url_path_spec.rb
|
351
|
-
- spec/metadata/url_query_param_spec.rb
|
352
|
-
- spec/mixins/binary_spec.rb
|
353
|
-
- spec/mixins/file_builder_spec.rb
|
354
|
-
- spec/mixins/format_string_spec.rb
|
355
|
-
- spec/mixins/has_payload_spec.rb
|
356
|
-
- spec/mixins/has_targets_spec.rb
|
357
|
-
- spec/mixins/html_spec.rb
|
358
|
-
- spec/mixins/http_spec.rb
|
359
|
-
- spec/mixins/loot_spec.rb
|
360
|
-
- spec/mixins/nops_spec.rb
|
361
|
-
- spec/mixins/remote_tcp_spec.rb
|
362
|
-
- spec/mixins/remote_udp_spec.rb
|
363
|
-
- spec/mixins/seh_spec.rb
|
364
|
-
- spec/mixins/stack_overflow_spec.rb
|
365
|
-
- spec/mixins/text_spec.rb
|
366
|
-
- spec/open_redirect_spec.rb
|
367
|
-
- spec/params/base_url_spec.rb
|
368
|
-
- spec/params/bind_host_spec.rb
|
369
|
-
- spec/params/bind_port_spec.rb
|
370
|
-
- spec/params/filename_spec.rb
|
371
|
-
- spec/params/host_spec.rb
|
372
|
-
- spec/params/port_spec.rb
|
373
|
-
- spec/rfi_spec.rb
|
374
|
-
- spec/seh_overflow_spec.rb
|
375
|
-
- spec/sqli_spec.rb
|
376
|
-
- spec/ssti_spec.rb
|
377
|
-
- spec/stack_overflow_spec.rb
|
378
|
-
- spec/target_spec.rb
|
379
|
-
- spec/test_result_spec.rb
|
380
|
-
- spec/use_after_free_spec.rb
|
381
|
-
- spec/web_spec.rb
|
382
|
-
- spec/web_vuln_spec.rb
|
383
|
-
- 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
|