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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.yardopts +1 -1
  4. data/README.md +5 -1
  5. data/data/new/exploit.rb.erb +2 -2
  6. data/gemspec.yml +10 -1
  7. data/lib/ronin/exploits/advisory.rb +1 -1
  8. data/lib/ronin/exploits/cli/command.rb +1 -1
  9. data/lib/ronin/exploits/cli/commands/irb.rb +1 -1
  10. data/lib/ronin/exploits/cli/commands/list.rb +1 -1
  11. data/lib/ronin/exploits/cli/commands/new.rb +1 -1
  12. data/lib/ronin/exploits/cli/commands/run.rb +56 -6
  13. data/lib/ronin/exploits/cli/commands/show.rb +91 -65
  14. data/lib/ronin/exploits/cli/exploit_command.rb +1 -1
  15. data/lib/ronin/exploits/cli/exploit_methods.rb +1 -1
  16. data/lib/ronin/exploits/cli/ruby_shell.rb +1 -1
  17. data/lib/ronin/exploits/cli.rb +6 -1
  18. data/lib/ronin/exploits/client_side_web_vuln.rb +1 -1
  19. data/lib/ronin/exploits/exceptions.rb +1 -1
  20. data/lib/ronin/exploits/exploit.rb +1 -1
  21. data/lib/ronin/exploits/heap_overflow.rb +1 -1
  22. data/lib/ronin/exploits/lfi.rb +1 -1
  23. data/lib/ronin/exploits/loot/file.rb +1 -1
  24. data/lib/ronin/exploits/loot.rb +1 -1
  25. data/lib/ronin/exploits/memory_corruption.rb +1 -1
  26. data/lib/ronin/exploits/metadata/arch.rb +1 -1
  27. data/lib/ronin/exploits/metadata/cookie_param.rb +1 -1
  28. data/lib/ronin/exploits/metadata/default_filename.rb +1 -1
  29. data/lib/ronin/exploits/metadata/default_port.rb +1 -1
  30. data/lib/ronin/exploits/metadata/header_name.rb +1 -1
  31. data/lib/ronin/exploits/metadata/os.rb +1 -1
  32. data/lib/ronin/exploits/metadata/shouts.rb +1 -1
  33. data/lib/ronin/exploits/metadata/url_path.rb +1 -1
  34. data/lib/ronin/exploits/metadata/url_query_param.rb +1 -1
  35. data/lib/ronin/exploits/mixins/binary.rb +1 -1
  36. data/lib/ronin/exploits/mixins/build_dir.rb +1 -1
  37. data/lib/ronin/exploits/mixins/file_builder.rb +1 -1
  38. data/lib/ronin/exploits/mixins/format_string.rb +1 -1
  39. data/lib/ronin/exploits/mixins/has_payload.rb +1 -1
  40. data/lib/ronin/exploits/mixins/has_targets.rb +1 -1
  41. data/lib/ronin/exploits/mixins/html.rb +1 -1
  42. data/lib/ronin/exploits/mixins/http.rb +1 -1
  43. data/lib/ronin/exploits/mixins/loot.rb +1 -1
  44. data/lib/ronin/exploits/mixins/nops.rb +1 -1
  45. data/lib/ronin/exploits/mixins/remote_tcp.rb +1 -1
  46. data/lib/ronin/exploits/mixins/remote_udp.rb +1 -1
  47. data/lib/ronin/exploits/mixins/seh.rb +1 -1
  48. data/lib/ronin/exploits/mixins/stack_overflow.rb +1 -1
  49. data/lib/ronin/exploits/mixins/text.rb +1 -1
  50. data/lib/ronin/exploits/mixins.rb +1 -1
  51. data/lib/ronin/exploits/open_redirect.rb +1 -1
  52. data/lib/ronin/exploits/params/base_url.rb +1 -1
  53. data/lib/ronin/exploits/params/bind_host.rb +1 -1
  54. data/lib/ronin/exploits/params/bind_port.rb +1 -1
  55. data/lib/ronin/exploits/params/filename.rb +1 -1
  56. data/lib/ronin/exploits/params/host.rb +1 -1
  57. data/lib/ronin/exploits/params/port.rb +1 -1
  58. data/lib/ronin/exploits/registry.rb +1 -1
  59. data/lib/ronin/exploits/rfi.rb +1 -1
  60. data/lib/ronin/exploits/root.rb +1 -1
  61. data/lib/ronin/exploits/seh_overflow.rb +1 -1
  62. data/lib/ronin/exploits/sqli.rb +1 -1
  63. data/lib/ronin/exploits/ssti.rb +1 -1
  64. data/lib/ronin/exploits/stack_overflow.rb +1 -1
  65. data/lib/ronin/exploits/target.rb +1 -1
  66. data/lib/ronin/exploits/test_result.rb +1 -1
  67. data/lib/ronin/exploits/use_after_free.rb +1 -1
  68. data/lib/ronin/exploits/version.rb +2 -2
  69. data/lib/ronin/exploits/web.rb +1 -1
  70. data/lib/ronin/exploits/web_vuln.rb +1 -1
  71. data/lib/ronin/exploits/xss.rb +1 -1
  72. data/lib/ronin/exploits.rb +1 -1
  73. data/ronin-exploits.gemspec +2 -1
  74. metadata +16 -116
  75. data/spec/advisory_spec.rb +0 -71
  76. data/spec/cli/exploit_command_spec.rb +0 -68
  77. data/spec/cli/exploit_methods_spec.rb +0 -208
  78. data/spec/cli/ruby_shell_spec.rb +0 -14
  79. data/spec/client_side_web_vuln_spec.rb +0 -117
  80. data/spec/exploit_spec.rb +0 -538
  81. data/spec/exploits_spec.rb +0 -8
  82. data/spec/heap_overflow_spec.rb +0 -14
  83. data/spec/lfi_spec.rb +0 -162
  84. data/spec/loot/file_spec.rb +0 -131
  85. data/spec/loot_spec.rb +0 -138
  86. data/spec/memory_corruption_spec.rb +0 -22
  87. data/spec/metadata/arch_spec.rb +0 -82
  88. data/spec/metadata/cookie_param_spec.rb +0 -67
  89. data/spec/metadata/default_filename_spec.rb +0 -62
  90. data/spec/metadata/default_port_spec.rb +0 -62
  91. data/spec/metadata/header_name_spec.rb +0 -67
  92. data/spec/metadata/os_spec.rb +0 -164
  93. data/spec/metadata/shouts_spec.rb +0 -100
  94. data/spec/metadata/url_path_spec.rb +0 -67
  95. data/spec/metadata/url_query_param_spec.rb +0 -67
  96. data/spec/mixins/binary_spec.rb +0 -129
  97. data/spec/mixins/build_dir.rb +0 -66
  98. data/spec/mixins/file_builder_spec.rb +0 -67
  99. data/spec/mixins/format_string_spec.rb +0 -44
  100. data/spec/mixins/has_payload_spec.rb +0 -333
  101. data/spec/mixins/has_targets_spec.rb +0 -434
  102. data/spec/mixins/html_spec.rb +0 -772
  103. data/spec/mixins/http_spec.rb +0 -1227
  104. data/spec/mixins/loot_spec.rb +0 -20
  105. data/spec/mixins/nops_spec.rb +0 -165
  106. data/spec/mixins/remote_tcp_spec.rb +0 -217
  107. data/spec/mixins/remote_udp_spec.rb +0 -217
  108. data/spec/mixins/seh_spec.rb +0 -89
  109. data/spec/mixins/stack_overflow_spec.rb +0 -87
  110. data/spec/mixins/text_spec.rb +0 -43
  111. data/spec/open_redirect_spec.rb +0 -71
  112. data/spec/params/base_url_spec.rb +0 -71
  113. data/spec/params/bind_host_spec.rb +0 -34
  114. data/spec/params/bind_port_spec.rb +0 -35
  115. data/spec/params/filename_spec.rb +0 -77
  116. data/spec/params/host_spec.rb +0 -34
  117. data/spec/params/port_spec.rb +0 -77
  118. data/spec/rfi_spec.rb +0 -107
  119. data/spec/seh_overflow_spec.rb +0 -18
  120. data/spec/spec_helper.rb +0 -8
  121. data/spec/sqli_spec.rb +0 -306
  122. data/spec/ssti_spec.rb +0 -121
  123. data/spec/stack_overflow_spec.rb +0 -18
  124. data/spec/target_spec.rb +0 -92
  125. data/spec/test_result_spec.rb +0 -32
  126. data/spec/use_after_free_spec.rb +0 -14
  127. data/spec/web_spec.rb +0 -12
  128. data/spec/web_vuln_spec.rb +0 -854
  129. data/spec/xss_spec.rb +0 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b98396194d34d0062e3fffa780a4e04c0e51d92f27b6cd71ea6fec0817b76c89
4
- data.tar.gz: 38e5cd54542aec074ecfbed0b48b5267d51d53e1d4b04e31bf9bace5df5bc034
3
+ metadata.gz: 850efd0369626bc57a83bf7d51ab1d8fc471bfe1472feee5720c80d7f064fdb5
4
+ data.tar.gz: b185d3383dc0549dd4aa9aa5e9df990a9554081028fb4cf2e49fd47332ffba7a
5
5
  SHA512:
6
- metadata.gz: a69a4edcf064bfd92e3a5f05373247fe97ab0f127b6c768ea58f7cb02a183b877ebf0aab19039450f85e06e2f758e0d70eccc032b6b00b8b9ef62a97bc9997c2
7
- data.tar.gz: 005e63f4dd85c88ca6597f576c95ab1bc812a8ad9258bc54e9c38cb6a14cb3704eec3af0e1a86f3400d623eb51c798adfd4d07241da69e827340bb6971a9fb79
6
+ metadata.gz: 958a1be608668de05fd28d2baeb44d1e7be1765cae684a4110a3183d92647582e6d51921ea24347a562685750717faf5e6e33d62102947f7f11afa3c9b8e7d3b
7
+ data.tar.gz: 8dbb0fc9782bced0ea57d49f9f65181ee752776c52ae31f437c368affecbb7a44e288c4e6568ea030d48ee1afde343b3c2cef56d9c9ad2e0c66af68519e216ab
@@ -21,6 +21,7 @@ jobs:
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
23
23
  ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true
24
25
  - name: Install libsqlite3
25
26
  run: |
26
27
  sudo apt update -y && \
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --markup markdown --title 'ronin-exploits Documentation' --protected
1
+ --markup markdown --title 'Ronin::Exploits Documentation' --protected
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/ronin-rb/ronin-exploits/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-exploits/actions/workflows/ruby.yml)
4
4
  [![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-exploits.svg)](https://codeclimate.com/github/ronin-rb/ronin-exploits)
5
+ [![Gem Version](https://badge.fury.io/rb/ronin-exploits.svg)](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
 
@@ -426,7 +430,7 @@ to be malicious software (malware) or malicious in nature.
426
430
  ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
427
431
  payload crafting functionality.
428
432
 
429
- Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
433
+ Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
430
434
 
431
435
  ronin-exploits is free software: you can redistribute it and/or modify
432
436
  it under the terms of the GNU Lesser General Public License as published
@@ -75,8 +75,8 @@ module Ronin
75
75
  ]
76
76
  <%- else -%>
77
77
  # references [
78
- # "https:/...",
79
- # "https:/..."
78
+ # "https://...",
79
+ # "https://..."
80
80
  # ]
81
81
  <%- end -%>
82
82
  <%- if web_vuln_exploit? -%>
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
@@ -14,6 +16,13 @@ has_yard: true
14
16
 
15
17
  required_ruby_version: ">= 3.0.0"
16
18
 
19
+ metadata:
20
+ documentation_uri: https://ronin-rb.dev/docs/ronin-exploits
21
+ source_code_uri: https://github.com/ronin-rb/ronin-exploits
22
+ bug_tracker_uri: https://github.com/ronin-rb/ronin-exploits/issues
23
+ changelog_uri: https://github.com/ronin-rb/ronin-exploits/blob/main/ChangeLog.md
24
+ rubygems_mfa_required: 'true'
25
+
17
26
  generated_files:
18
27
  - man/ronin-exploits.1
19
28
  - man/ronin-exploits-irb.1
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -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("failed to run exploit #{@exploit.class_id}: #{error.message}")
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::PostExt)
378
+ @exploit.payload.kind_of?(Ronin::Payloads::Mixins::PostEx)
338
379
  unless @exploit.payload.session
339
- print_error("payload (#{@exploit.payload.class_id}) did not create a post-exploitation session")
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("failed to cleanup exploit #{@exploit.class_id}: #{error.message}")
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)
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -87,91 +87,117 @@ module Ronin
87
87
  puts
88
88
 
89
89
  indent do
90
- fields = {}
90
+ print_metadata(exploit)
91
+ print_advisories(exploit)
92
+ print_authors(exploit)
93
+ print_description(exploit)
94
+ print_references(exploit)
91
95
 
92
- fields['Type'] = exploit_type(exploit)
96
+ if defined?(Mixins::HasTargets) &&
97
+ exploit.include?(Mixins::HasTargets)
98
+ unless exploit.targets.empty?
99
+ exploit.targets.each_with_index do |target,index|
100
+ puts "[ Target ##{index+1} ]"
101
+ puts
93
102
 
94
- if defined?(Core::Metadata::Version) &&
95
- exploit.include?(Core::Metadata::Version)
96
- fields['Version'] = exploit.version if exploit.version
103
+ indent { print_target(target) }
104
+ end
105
+ end
97
106
  end
98
107
 
99
- fields['Quality'] = exploit.quality if exploit.quality
100
- fields['Released'] = exploit.release_date if exploit.release_date
101
- fields['Disclosed'] = exploit.disclosure_date if exploit.disclosure_date
108
+ print_shouts(exploit)
109
+ end
102
110
 
103
- if defined?(Metadata::Arch) && exploit.include?(Metadata::Arch)
104
- if (arch = target.arch)
105
- fields['Arch'] = arch
106
- end
107
- end
111
+ print_params(exploit)
112
+ end
108
113
 
109
- if defined?(Metadata::OS) && exploit.include?(Metadata::OS)
110
- if (os = exploit.os)
111
- fields['OS'] = if (os_version = exploit.os_version)
112
- "#{os} #{os_version}"
113
- else
114
- os
115
- end
116
- end
117
- end
114
+ #
115
+ # Print the main metadata fields for the exploit.
116
+ #
117
+ # @param [Class<Exploit>] exploit
118
+ # The loaded exploit class.
119
+ #
120
+ def print_metadata(exploit)
121
+ fields = {}
122
+ fields['Type'] = exploit_type(exploit)
118
123
 
119
- if (software = exploit.software)
120
- fields['Software'] = software
121
- end
124
+ if defined?(Core::Metadata::Version) &&
125
+ exploit.include?(Core::Metadata::Version)
126
+ fields['Version'] = exploit.version if exploit.version
127
+ end
122
128
 
123
- if (versions = exploit.software_versions)
124
- case versions
125
- when Array
126
- fields['Software Versions'] = versions.join(', ')
127
- when Range
128
- fields['Software Versions'] = "#{versions.begin} - #{versions.end}"
129
- end
130
- end
129
+ fields['Quality'] = exploit.quality if exploit.quality
130
+ fields['Released'] = exploit.release_date if exploit.release_date
131
+ fields['Disclosed'] = exploit.disclosure_date if exploit.disclosure_date
131
132
 
132
- if defined?(Mixins::HasPayload) &&
133
- exploit.include?(Mixins::HasPayload)
134
- fields['Payload Type'] = payload_type(exploit.payload_class)
133
+ if defined?(Metadata::Arch) && exploit.include?(Metadata::Arch)
134
+ if (arch = target.arch)
135
+ fields['Arch'] = arch
135
136
  end
137
+ end
136
138
 
137
- fields['Summary'] = exploit.summary if exploit.summary
138
- print_fields(fields)
139
+ if defined?(Metadata::OS) && exploit.include?(Metadata::OS)
140
+ if (os = exploit.os)
141
+ fields['OS'] = if (os_version = exploit.os_version)
142
+ "#{os} #{os_version}"
143
+ else
144
+ os
145
+ end
146
+ end
147
+ end
139
148
 
140
- unless exploit.advisories.empty?
141
- puts "Advisories:"
142
- puts
149
+ if (software = exploit.software)
150
+ fields['Software'] = software
151
+ end
143
152
 
144
- indent do
145
- exploit.advisories.each do |advisory|
146
- print_advisory(advisory)
147
- end
148
- end
149
- puts
153
+ if (versions = exploit.software_versions)
154
+ case versions
155
+ when Array
156
+ fields['Software Versions'] = versions.join(', ')
157
+ when Range
158
+ fields['Software Versions'] = "#{versions.begin} - #{versions.end}"
150
159
  end
160
+ end
151
161
 
152
- print_authors(exploit)
153
- print_description(exploit)
154
- print_references(exploit)
162
+ if defined?(Mixins::HasPayload) &&
163
+ exploit.include?(Mixins::HasPayload)
164
+ fields['Payload Type'] = payload_type(exploit.payload_class)
165
+ end
155
166
 
156
- if defined?(Mixins::HasTargets) &&
157
- exploit.include?(Mixins::HasTargets)
158
- unless exploit.targets.empty?
159
- exploit.targets.each_with_index do |target,index|
160
- puts "[ Target ##{index+1} ]"
161
- puts
167
+ fields['Summary'] = exploit.summary if exploit.summary
168
+ print_fields(fields)
169
+ end
162
170
 
163
- indent { print_target(target) }
164
- end
171
+ #
172
+ # Prints any advisories defined by an exploit class.
173
+ #
174
+ # @param [Class<Exploit>] exploit
175
+ # The loaded exploit class.
176
+ #
177
+ def print_advisories(exploit)
178
+ unless exploit.advisories.empty?
179
+ puts "Advisories:"
180
+ puts
181
+
182
+ indent do
183
+ exploit.advisories.each do |advisory|
184
+ print_advisory(advisory)
165
185
  end
166
186
  end
167
-
168
- if defined?(Metadata::Shouts) &&
169
- exploit.include?(Metadata::Shouts)
170
- puts "Shouts: #{exploit.shouts.join(', ')}"
171
- end
187
+ puts
172
188
  end
189
+ end
173
190
 
174
- print_params(exploit)
191
+ #
192
+ # Prints the shouts section.
193
+ #
194
+ # @param [Class<Exploit>] exploit
195
+ # The loaded exploit class.
196
+ #
197
+ def print_shouts(exploit)
198
+ if defined?(Metadata::Shouts) && exploit.include?(Metadata::Shouts)
199
+ puts "Shouts: #{exploit.shouts.join(', ')}"
200
+ end
175
201
  end
176
202
 
177
203
  # Known exploit types and their printable names.
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -18,8 +18,11 @@
18
18
  # along with ronin-exploits. If not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
 
21
+ require 'ronin/exploits/version'
22
+
21
23
  require 'command_kit/commands'
22
24
  require 'command_kit/commands/auto_load'
25
+ require 'command_kit/options/version'
23
26
 
24
27
  module Ronin
25
28
  module Exploits
@@ -35,8 +38,10 @@ module Ronin
35
38
  dir: "#{__dir__}/cli/commands",
36
39
  namespace: "#{self}::Commands"
37
40
  )
41
+ include CommandKit::Options::Version
38
42
 
39
43
  command_name 'ronin-exploits'
44
+ version Ronin::Exploits::VERSION
40
45
 
41
46
  command_aliases['ls'] = 'list'
42
47
  command_aliases['info'] = 'show'
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published
@@ -2,7 +2,7 @@
2
2
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
3
3
  # payload crafting functionality.
4
4
  #
5
- # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
6
  #
7
7
  # ronin-exploits is free software: you can redistribute it and/or modify
8
8
  # it under the terms of the GNU Lesser General Public License as published