ronin-exploits 1.0.6 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/ChangeLog.md +18 -0
  4. data/Gemfile +6 -4
  5. data/README.md +32 -6
  6. data/Rakefile +10 -0
  7. data/data/completions/ronin-exploits +111 -0
  8. data/data/completions/ronin-exploits.yml +12 -0
  9. data/gemspec.yml +3 -1
  10. data/lib/ronin/exploits/advisory.rb +1 -1
  11. data/lib/ronin/exploits/cli/command.rb +1 -1
  12. data/lib/ronin/exploits/cli/commands/completion.rb +64 -0
  13. data/lib/ronin/exploits/cli/commands/irb.rb +1 -1
  14. data/lib/ronin/exploits/cli/commands/list.rb +1 -1
  15. data/lib/ronin/exploits/cli/commands/new.rb +14 -9
  16. data/lib/ronin/exploits/cli/commands/run.rb +33 -7
  17. data/lib/ronin/exploits/cli/commands/show.rb +44 -1
  18. data/lib/ronin/exploits/cli/exploit_command.rb +1 -1
  19. data/lib/ronin/exploits/cli/exploit_methods.rb +1 -1
  20. data/lib/ronin/exploits/cli/ruby_shell.rb +1 -1
  21. data/lib/ronin/exploits/cli.rb +3 -1
  22. data/lib/ronin/exploits/client_side_web_vuln.rb +1 -1
  23. data/lib/ronin/exploits/command_injection.rb +78 -0
  24. data/lib/ronin/exploits/exceptions.rb +1 -1
  25. data/lib/ronin/exploits/exploit.rb +4 -3
  26. data/lib/ronin/exploits/heap_overflow.rb +1 -1
  27. data/lib/ronin/exploits/lfi.rb +1 -1
  28. data/lib/ronin/exploits/loot/file.rb +1 -1
  29. data/lib/ronin/exploits/loot.rb +1 -1
  30. data/lib/ronin/exploits/memory_corruption.rb +1 -1
  31. data/lib/ronin/exploits/metadata/arch.rb +1 -1
  32. data/lib/ronin/exploits/metadata/cookie_param.rb +1 -1
  33. data/lib/ronin/exploits/metadata/default_filename.rb +1 -1
  34. data/lib/ronin/exploits/metadata/default_port.rb +1 -1
  35. data/lib/ronin/exploits/metadata/header_name.rb +1 -1
  36. data/lib/ronin/exploits/metadata/os.rb +1 -1
  37. data/lib/ronin/exploits/metadata/shouts.rb +1 -1
  38. data/lib/ronin/exploits/metadata/url_path.rb +1 -1
  39. data/lib/ronin/exploits/metadata/url_query_param.rb +1 -1
  40. data/lib/ronin/exploits/mixins/binary.rb +1 -1
  41. data/lib/ronin/exploits/mixins/build_dir.rb +1 -1
  42. data/lib/ronin/exploits/mixins/file_builder.rb +1 -1
  43. data/lib/ronin/exploits/mixins/format_string.rb +1 -1
  44. data/lib/ronin/exploits/mixins/has_payload.rb +1 -1
  45. data/lib/ronin/exploits/mixins/has_targets.rb +1 -1
  46. data/lib/ronin/exploits/mixins/html.rb +1 -1
  47. data/lib/ronin/exploits/mixins/http.rb +3 -3
  48. data/lib/ronin/exploits/mixins/loot.rb +1 -1
  49. data/lib/ronin/exploits/mixins/nops.rb +1 -1
  50. data/lib/ronin/exploits/mixins/remote_tcp.rb +1 -1
  51. data/lib/ronin/exploits/mixins/remote_udp.rb +1 -1
  52. data/lib/ronin/exploits/mixins/seh.rb +1 -1
  53. data/lib/ronin/exploits/mixins/stack_overflow.rb +1 -1
  54. data/lib/ronin/exploits/mixins/text.rb +1 -1
  55. data/lib/ronin/exploits/mixins.rb +1 -1
  56. data/lib/ronin/exploits/open_redirect.rb +1 -1
  57. data/lib/ronin/exploits/params/base_url.rb +1 -1
  58. data/lib/ronin/exploits/params/bind_host.rb +1 -1
  59. data/lib/ronin/exploits/params/bind_port.rb +1 -1
  60. data/lib/ronin/exploits/params/filename.rb +1 -1
  61. data/lib/ronin/exploits/params/host.rb +1 -1
  62. data/lib/ronin/exploits/params/port.rb +1 -1
  63. data/lib/ronin/exploits/registry.rb +1 -1
  64. data/lib/ronin/exploits/rfi.rb +1 -1
  65. data/lib/ronin/exploits/root.rb +1 -1
  66. data/lib/ronin/exploits/seh_overflow.rb +1 -1
  67. data/lib/ronin/exploits/sqli.rb +1 -1
  68. data/lib/ronin/exploits/ssti.rb +1 -1
  69. data/lib/ronin/exploits/stack_overflow.rb +1 -1
  70. data/lib/ronin/exploits/target.rb +1 -1
  71. data/lib/ronin/exploits/test_result.rb +1 -1
  72. data/lib/ronin/exploits/use_after_free.rb +1 -1
  73. data/lib/ronin/exploits/version.rb +2 -2
  74. data/lib/ronin/exploits/web.rb +1 -1
  75. data/lib/ronin/exploits/web_vuln.rb +1 -1
  76. data/lib/ronin/exploits/xss.rb +1 -1
  77. data/lib/ronin/exploits.rb +2 -1
  78. data/man/ronin-exploits-completion.1 +76 -0
  79. data/man/ronin-exploits-completion.1.md +78 -0
  80. data/man/ronin-exploits-irb.1 +10 -15
  81. data/man/ronin-exploits-irb.1.md +6 -2
  82. data/man/ronin-exploits-list.1 +8 -16
  83. data/man/ronin-exploits-list.1.md +7 -3
  84. data/man/ronin-exploits-new.1 +23 -46
  85. data/man/ronin-exploits-new.1.md +24 -20
  86. data/man/ronin-exploits-run.1 +32 -56
  87. data/man/ronin-exploits-run.1.md +30 -23
  88. data/man/ronin-exploits-show.1 +10 -20
  89. data/man/ronin-exploits-show.1.md +9 -5
  90. data/man/ronin-exploits.1 +11 -23
  91. data/man/ronin-exploits.1.md +11 -7
  92. data/scripts/setup +58 -0
  93. metadata +10 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4dda20bce8921145f78d25820e4a8cbeee9093e8bfa1ae2284e590b527be6c76
4
- data.tar.gz: b081649e7e59db4556ab4d889af42613d50eb2103ac390b0df7a7a4f86cb00a8
3
+ metadata.gz: 1ffd8a91a46c0ef7c6f51b67d888982105e70c89dd5426ef8618ab100ce7e85e
4
+ data.tar.gz: c606a18604302c7f7525c5e694a739aa9a8f27d7e27dd6ade459d7afe85493c4
5
5
  SHA512:
6
- metadata.gz: f140e2a3b0e00e2e0189958c121f1d9f27eaac216f57a102f8008f20ff5cd25524ff5886cd08152c539ae33e43912d3b8fd9c0044b651682b7c24a5606398f59
7
- data.tar.gz: fdbd1ec9d694ce1072f6aed1c6e88d53563eeab355c015ba1a918d4b3b9c9a582eb43831c0fa8ade0d07ff58090b214abf46eaf4fe41edcbda7f595dae5e34e0
6
+ metadata.gz: bb0f78b1aebef5d68bb442b89bd710a839e4d983718fcf86d3a77841351f6b5d068e3846e866cde1130562bb416a60fb7fbfa115ebe1a2693fac2d2367eab04b
7
+ data.tar.gz: b5164f3d77bc186c788dea751591d9a76469157b3d3fc390d37ef6c1c21343e24564ed4c7d0e84e878e4f56447acd5f21ae6f2161f1737e68c38a682c33be8c9
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /coverage
2
+ /data/completions/ronin-exploits
2
3
  /doc
3
4
  /man/*.[0-9]
4
5
  /pkg
data/ChangeLog.md CHANGED
@@ -1,3 +1,21 @@
1
+ ### 1.1.0 / 2024-XX-XX
2
+
3
+ * Added {Ronin::Exploits::CommandInjection}.
4
+ * Allow `:untested` as a value for {Ronin::Exploits::Exploit.quality}.
5
+ * Renamed the `raw_user_agent` param to `user_agent_string` in
6
+ {Ronin::Exploits::Mixins::HTTP}.
7
+
8
+ #### CLI
9
+
10
+ * Added the `-T,--test` option to `ronin-exploits run` which will only run the
11
+ exploits {Ronin::Exploits::Exploit#test test} method to determine if the
12
+ target is vulnerable or not.
13
+ * Added the `ronin-exploits completion` command to install shell completion
14
+ files for all `ronin-exploits` commands for Bash and Zsh shells.
15
+ * The `ronin-exploits show` command can now print an example
16
+ `ronin-exploits run` command for the given exploit.
17
+ * Use hyphenated values for `ronin-exploits new` options.
18
+
1
19
  ### 1.0.6 / 2024-06-28
2
20
 
3
21
  #### CLI
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ end
11
11
  # gem 'fake_io', '~> 0.1', github: 'postmodern/fake_io.rb',
12
12
  # branch: 'main'
13
13
 
14
- # gem 'command_kit', '~> 0.4', github: 'postmodern/command_kit.rb',
14
+ # gem 'command_kit', '~> 0.5', github: 'postmodern/command_kit.rb',
15
15
  # branch: 'main'
16
16
 
17
17
  # Ronin dependencies
@@ -23,8 +23,8 @@ end
23
23
  # branch: 'main'
24
24
  # gem 'ronin-post_ex', '~> 0.1', github: 'ronin-rb/ronin-post_ex',
25
25
  # branch: 'main'
26
- # gem 'ronin-core', '~> 0.1', github: 'ronin-rb/ronin-core',
27
- # branch: 'main'
26
+ # gem 'ronin-core', '~> 0.2', github: 'ronin-rb/ronin-core',
27
+ # branch: 'main'
28
28
  # gem 'ronin-repos', '~> 0.1', github: 'ronin-rb/ronin-repos',
29
29
  # branch: 'main'
30
30
  # gem 'ronin-code-asm', '~> 1.0', github: 'ronin-rb/ronin-code-asm',
@@ -40,7 +40,7 @@ group :development do
40
40
  gem 'simplecov', '~> 0.20'
41
41
 
42
42
  gem 'kramdown', '~> 2.0'
43
- gem 'kramdown-man', '~> 0.1'
43
+ gem 'kramdown-man', '~> 1.0'
44
44
 
45
45
  gem 'redcarpet', platform: :mri
46
46
  gem 'yard', '~> 0.9'
@@ -51,4 +51,6 @@ group :development do
51
51
  gem 'stackprof', require: false, platform: :mri
52
52
  gem 'rubocop', require: false, platform: :mri
53
53
  gem 'rubocop-ronin', '~> 0.2', require: false, platform: :mri
54
+
55
+ gem 'command_kit-completion', '~> 0.2', require: false
54
56
  end
data/README.md CHANGED
@@ -35,6 +35,7 @@ research and development.
35
35
  * [SEH Overflows][docs-seh-overflow]
36
36
  * [Heap Overflows][docs-heap-overflow]
37
37
  * [Use After Free (UAF)][docs-use-after-free]
38
+ * [Command Injection][docs-command-injection]
38
39
  * [Open Redirect][docs-open-redirect]
39
40
  * [Local File Inclusions (LFI)][docs-lfi]
40
41
  * [Remote File Inclusions (RFI)][docs-rfi]
@@ -54,6 +55,7 @@ research and development.
54
55
  [docs-seh-overflow]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/SEHOverflow.html
55
56
  [docs-heap-overflow]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/HeapOverflow.html
56
57
  [docs-use-after-free]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/UseAfterFree.html
58
+ [docs-command-injection]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/CommandInjection.html
57
59
  [docs-open-redirect]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/OpenRedirect.html
58
60
  [docs-lfi]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/LFI.html
59
61
  [docs-rfi]: https://ronin-rb.dev/docs/ronin-exploits/Ronin/Exploits/RFI.html
@@ -84,6 +86,7 @@ Arguments:
84
86
  [ARGS ...] Additional arguments for the command
85
87
 
86
88
  Commands:
89
+ completion
87
90
  help
88
91
  irb
89
92
  list, ls
@@ -95,7 +98,7 @@ Commands:
95
98
  Generate a new exploit file:
96
99
 
97
100
  ```shell
98
- $ ronin-exploits new example_exploit.rb --type stack_overflow \
101
+ $ ronin-exploits new example_exploit.rb --type stack-overflow \
99
102
  --arch x86 --os linux --software ExampleWare --software-version 1.2.3 \
100
103
  --author Postmodern --author-email "postmodern.mod3@gmail.com" \
101
104
  --summary "Example exploit" --description "This is an example."
@@ -157,7 +160,7 @@ Generate a ronin repository of your own exploits (and/or payloads):
157
160
  $ ronin-repos new my-repo
158
161
  $ cd my-repo/
159
162
  $ mkdir exploits
160
- $ ronin-exploits new exploits/my_exploit.rb --type stack_overflow \
163
+ $ ronin-exploits new exploits/my_exploit.rb --type stack-overflow \
161
164
  --arch x86 --os linux --software ExampleWare --software-version 1.2.3 \
162
165
  --author You --author-email "you@example.com" \
163
166
  --summary "My exploit" --description "This is my example."
@@ -283,6 +286,29 @@ module Ronin
283
286
  end
284
287
  ```
285
288
 
289
+ Define a Command Injection exploit:
290
+
291
+ ```ruby
292
+ require 'ronin/exploits/command_injection'
293
+ require 'ronin/exploits/mixins/http'
294
+
295
+ module Ronin
296
+ module Exploits
297
+ class MyExploit < CommandInjection
298
+
299
+ register 'my_exploit'
300
+
301
+ include Mixins::HTTP
302
+
303
+ def launch
304
+ http_post '/form.php', post_data: {var: "';#{payload}#"}
305
+ end
306
+
307
+ end
308
+ end
309
+ end
310
+ ```
311
+
286
312
  Define an Open Redirect exploit:
287
313
 
288
314
  ```ruby
@@ -410,7 +436,7 @@ For real-world example ronin exploits, see the [example-exploits] repository.
410
436
  * [uri-query_params] ~> 0.6
411
437
  * [ronin-support] ~> 1.0
412
438
  * [ronin-code-sql] ~> 2.0
413
- * [ronin-core] ~> 0.1
439
+ * [ronin-core] ~> 0.2
414
440
  * [ronin-repos] ~> 0.1
415
441
  * [ronin-payloads] ~> 0.1
416
442
  * [ronin-vulns] ~> 0.1
@@ -427,7 +453,7 @@ $ gem install ronin-exploits
427
453
  1. [Fork It!](https://github.com/ronin-rb/ronin-exploits/fork)
428
454
  2. Clone It!
429
455
  3. `cd ronin-exploits`
430
- 4. `bundle install`
456
+ 4. `./scripts/setup`
431
457
  5. `git checkout -b my_feature`
432
458
  6. Code It!
433
459
  7. `bundle exec rake spec`
@@ -445,7 +471,7 @@ to be malicious software (malware) or malicious in nature.
445
471
  ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
446
472
  payload crafting functionality.
447
473
 
448
- Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
474
+ Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
449
475
 
450
476
  ronin-exploits is free software: you can redistribute it and/or modify
451
477
  it under the terms of the GNU Lesser General Public License as published
@@ -470,4 +496,4 @@ along with ronin-exploits. If not, see <https://www.gnu.org/licenses/>.
470
496
  [ronin-repos]: https://github.com/ronin-rb/ronin-repos#readme
471
497
  [ronin-payloads]: https://github.com/ronin-rb/ronin-payloads#readme
472
498
  [ronin-post_ex]: https://github.com/ronin-rb/ronin-post_ex#readme
473
- [ronin-vulns]: https://github.com/ronin-rb/ronin-vulns#readme
499
+ [ronin-vulns]: https://github.com/ronin-rb/ronin-vulns#readm
data/Rakefile CHANGED
@@ -40,3 +40,13 @@ YARD::Rake::YardocTask.new
40
40
 
41
41
  require 'kramdown/man/task'
42
42
  Kramdown::Man::Task.new
43
+
44
+ require 'command_kit/completion/task'
45
+ CommandKit::Completion::Task.new(
46
+ class_file: 'ronin/exploits/cli',
47
+ class_name: 'Ronin::Exploits::CLI',
48
+ input_file: 'data/completions/ronin-exploits.yml',
49
+ output_file: 'data/completions/ronin-exploits'
50
+ )
51
+
52
+ task :setup => %w[man command_kit:completion]
@@ -0,0 +1,111 @@
1
+ # ronin-exploits completion -*- shell-script -*-
2
+
3
+ # This bash completions script was generated by
4
+ # completely (https://github.com/dannyben/completely)
5
+ # Modifying it manually is not recommended
6
+
7
+ _ronin-exploits_completions_filter() {
8
+ local words="$1"
9
+ local cur=${COMP_WORDS[COMP_CWORD]}
10
+ local result=()
11
+
12
+ if [[ "${cur:0:1}" == "-" ]]; then
13
+ echo "$words"
14
+
15
+ else
16
+ for word in $words; do
17
+ [[ "${word:0:1}" != "-" ]] && result+=("$word")
18
+ done
19
+
20
+ echo "${result[*]}"
21
+
22
+ fi
23
+ }
24
+
25
+ _ronin-exploits_completions() {
26
+ local cur=${COMP_WORDS[COMP_CWORD]}
27
+ local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
28
+ local compline="${compwords[*]}"
29
+
30
+ case "$compline" in
31
+ 'run'*'--payload-file')
32
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
33
+ ;;
34
+
35
+ 'run'*'--read-payload')
36
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
37
+ ;;
38
+
39
+ 'run'*'--encoder-file')
40
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
41
+ ;;
42
+
43
+ 'run'*'--save-loot')
44
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
45
+ ;;
46
+
47
+ 'run'*'--encoder')
48
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "$(ronin-payloads encoders)")" -- "$cur" )
49
+ ;;
50
+
51
+ 'run'*'--payload')
52
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "$(ronin-payloads list)")" -- "$cur" )
53
+ ;;
54
+
55
+ 'show'*'--file')
56
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
57
+ ;;
58
+
59
+ 'completion'*)
60
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "--print --install --uninstall")" -- "$cur" )
61
+ ;;
62
+
63
+ 'run'*'--file')
64
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
65
+ ;;
66
+
67
+ 'show'*'-f')
68
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
69
+ ;;
70
+
71
+ 'run'*'-f')
72
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -- "$cur" )
73
+ ;;
74
+
75
+ 'run'*'-L')
76
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -- "$cur" )
77
+ ;;
78
+
79
+ 'run'*'-E')
80
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "$(ronin-payloads encoders)")" -- "$cur" )
81
+ ;;
82
+
83
+ 'run'*'-P')
84
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "$(ronin-payloads list)")" -- "$cur" )
85
+ ;;
86
+
87
+ 'show'*)
88
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "--file -f --verbose -v $(ronin-exploits list)")" -- "$cur" )
89
+ ;;
90
+
91
+ 'info'*)
92
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "$(ronin-exploits list)")" -- "$cur" )
93
+ ;;
94
+
95
+ 'new'*)
96
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_ronin-exploits_completions_filter "--type -t --author -a --author-email -e --summary -S --description -D --advisory-id -I --reference -R --has-payload -P --networking -N --arch -A --os -O --os-version --software -S --software-version -V --loot -L")" -- "$cur" )
97
+ ;;
98
+
99
+ 'run'*)
100
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "--file -f --param -p --dry-run -D --test -T --payload-file --read-payload --payload-string --payload -P --payload-param --encoder-file --encoder -E --encoder-param --target -t --target-arch -A --target-os -O --target-os-version --target-software -S --target-version -V --save-loot -L --debug -d --irb $(ronin-exploits list)")" -- "$cur" )
101
+ ;;
102
+
103
+ *)
104
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_ronin-exploits_completions_filter "--version -V help completion irb list new run show ls info")" -- "$cur" )
105
+ ;;
106
+
107
+ esac
108
+ } &&
109
+ complete -F _ronin-exploits_completions ronin-exploits
110
+
111
+ # ex: filetype=sh
@@ -0,0 +1,12 @@
1
+ ---
2
+ ronin-exploits show: &show
3
+ - $(ronin-exploits list)
4
+ ronin-exploits info: *show
5
+ ronin-exploits run:
6
+ - $(ronin-exploits list)
7
+ ronin-exploits run*--encoder: &run_encoder
8
+ - $(ronin-payloads encoders)
9
+ ronin-exploits run*-E: *run_encoder
10
+ ronin-exploits run*--payload: &run_payload
11
+ - $(ronin-payloads list)
12
+ ronin-exploits run*-P: *run_payload
data/gemspec.yml CHANGED
@@ -24,7 +24,9 @@ metadata:
24
24
  rubygems_mfa_required: 'true'
25
25
 
26
26
  generated_files:
27
+ - data/completions/ronin-exploits
27
28
  - man/ronin-exploits.1
29
+ - man/ronin-exploits-completion.1
28
30
  - man/ronin-exploits-irb.1
29
31
  - man/ronin-exploits-list.1
30
32
  - man/ronin-exploits-new.1
@@ -39,7 +41,7 @@ dependencies:
39
41
  ronin-payloads: ~> 0.1, >= 0.1.1
40
42
  ronin-vulns: ~> 0.1, >= 0.1.1
41
43
  ronin-post_ex: ~> 0.1
42
- ronin-core: ~> 0.1
44
+ ronin-core: ~> 0.2.0.rc1
43
45
  ronin-repos: ~> 0.1
44
46
 
45
47
  development_dependencies:
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
+ # payload crafting functionality.
5
+ #
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # ronin-exploits is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published
10
+ # by the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # ronin-exploits is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with ronin-exploits. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ require 'ronin/exploits/root'
23
+ require 'ronin/core/cli/completion_command'
24
+
25
+ module Ronin
26
+ module Exploits
27
+ class CLI
28
+ module Commands
29
+ #
30
+ # Manages the shell completion rules for `ronin-exploits`.
31
+ #
32
+ # ## Usage
33
+ #
34
+ # ronin-exploits completion [options]
35
+ #
36
+ # ## Options
37
+ #
38
+ # --print Prints the shell completion file
39
+ # --install Installs the shell completion file
40
+ # --uninstall Uninstalls the shell completion file
41
+ # -h, --help Print help information
42
+ #
43
+ # ## Examples
44
+ #
45
+ # ronin-exploits completion --print
46
+ # ronin-exploits completion --install
47
+ # ronin-exploits completion --uninstall
48
+ #
49
+ # @since 1.1.0
50
+ #
51
+ class Completion < Core::CLI::CompletionCommand
52
+
53
+ completion_file File.join(ROOT,'data','completions','ronin-exploits')
54
+
55
+ man_dir File.join(ROOT,'man')
56
+ man_page 'ronin-exploits-completion.1'
57
+
58
+ description 'Manages the shell completion rules for ronin-exploits'
59
+
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -45,7 +45,7 @@ module Ronin
45
45
  #
46
46
  # ## Options
47
47
  #
48
- # -t exploit|heap_overflow|stack_overflow|web|open_redirect|lfi|rfi|sqli|ssti|xss,
48
+ # -t exploit|heap-overflow|stack-overflow|command-injection|web|open-redirect|lfi|rfi|sqli|ssti|xss,
49
49
  # --type The type for the new exploit
50
50
  # -a, --author NAME The name of the author
51
51
  # -e, --author-email EMAIL The email address of the author
@@ -84,32 +84,37 @@ module Ronin
84
84
  class: 'Exploit'
85
85
  },
86
86
 
87
- heap_overflow: {
87
+ "heap-overflow": {
88
88
  file: 'heap_overflow',
89
89
  class: 'HeapOverflow'
90
90
  },
91
91
 
92
- stack_overflow: {
92
+ "stack-overflow": {
93
93
  file: 'stack_overflow',
94
94
  class: 'StackOverflow'
95
95
  },
96
96
 
97
- seh_overflow: {
97
+ "seh-overflow": {
98
98
  file: 'seh_overflow',
99
99
  class: 'SEHOverflow'
100
100
  },
101
101
 
102
- user_after_free: {
102
+ "user-after-free": {
103
103
  file: 'use_after_free',
104
104
  class: 'UseAfterFree'
105
105
  },
106
106
 
107
+ "command-injection": {
108
+ file: 'command_injection',
109
+ class: 'CommandInjection'
110
+ },
111
+
107
112
  web: {
108
113
  file: 'web',
109
114
  class: 'Web'
110
115
  },
111
116
 
112
- open_redirect: {
117
+ "open-redirect": {
113
118
  file: 'open_redirect',
114
119
  class: 'OpenRedirect'
115
120
  },
@@ -142,12 +147,12 @@ module Ronin
142
147
 
143
148
  # Mapping of network mixins and their file/module names.
144
149
  NETWORKING_TYPES = {
145
- remote_tcp: {
150
+ "remote-tcp": {
146
151
  file: 'remote_tcp',
147
152
  module: 'RemoteTCP'
148
153
  },
149
154
 
150
- remote_udp: {
155
+ "remote-udp": {
151
156
  file: 'remote_udp',
152
157
  module: 'RemoteUDP'
153
158
  },
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -52,6 +52,7 @@ module Ronin
52
52
  # -f, --file FILE The exploit file to load
53
53
  # -p, --param NAME=VALUE Sets a param
54
54
  # -D, --dry-run Builds the exploit but does not launch it
55
+ # -T --test Runs only the exploit test
55
56
  # --payload-file FILE Load the payload from the given Ruby file
56
57
  # --read-payload FILE Reads the payload string from the file
57
58
  # --payload-string STRING Uses the raw payload string instead
@@ -85,11 +86,15 @@ module Ronin
85
86
  include Core::CLI::Options::Param
86
87
  include Core::CLI::Logging
87
88
  include CommandKit::Printing::Indent
89
+ include Support::CLI::Printing
88
90
 
89
91
  # Exploit options
90
92
  option :dry_run, short: '-D',
91
93
  desc: 'Builds the exploit but does not launch it'
92
94
 
95
+ option :test, short: '-T',
96
+ desc: 'Runs only the exploit test'
97
+
93
98
  # Payload options
94
99
  option :payload_file, value: {
95
100
  type: String,
@@ -273,15 +278,20 @@ module Ronin
273
278
  validate_payload
274
279
  initialize_exploit
275
280
  validate_exploit
276
- run_exploit
277
281
 
278
- if options[:irb]
279
- start_shell
282
+ if options[:test]
283
+ run_test
280
284
  else
281
- post_exploitation
282
- end
285
+ run_exploit
286
+
287
+ if options[:irb]
288
+ start_shell
289
+ else
290
+ post_exploitation
291
+ end
283
292
 
284
- perform_cleanup
293
+ perform_cleanup
294
+ end
285
295
  end
286
296
 
287
297
  #
@@ -382,6 +392,22 @@ module Ronin
382
392
  end
383
393
  end
384
394
 
395
+ #
396
+ # Run the exploit's test method, and print the result.
397
+ #
398
+ def run_test
399
+ case (result = @exploit.perform_test)
400
+ when TestResult::Vulnerable
401
+ print_positive "Vulnerable: #{result}"
402
+ when TestResult::NotVulnerable
403
+ print_negative "NotVulnerable: #{result}"
404
+ when TestResult::Unknown
405
+ print_warning "Unknown: #{result}"
406
+ else
407
+ print_error "Unexpected result: #{result.inspect}"
408
+ end
409
+ end
410
+
385
411
  #
386
412
  # Starts an interactive ruby shell within the exploit object.
387
413
  #
@@ -3,7 +3,7 @@
3
3
  # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
4
4
  # payload crafting functionality.
5
5
  #
6
- # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
7
  #
8
8
  # ronin-exploits is free software: you can redistribute it and/or modify
9
9
  # it under the terms of the GNU Lesser General Public License as published
@@ -110,6 +110,7 @@ module Ronin
110
110
  end
111
111
 
112
112
  print_params(exploit)
113
+ print_exploit_usage(exploit)
113
114
  end
114
115
 
115
116
  #
@@ -286,6 +287,48 @@ module Ronin
286
287
  puts
287
288
  end
288
289
 
290
+ #
291
+ # Prints an example `ronin-exploits run` command for the exploit.
292
+ #
293
+ # @param [Class<Exploit>] exploit
294
+ #
295
+ # @since 0.2.0
296
+ #
297
+ def print_exploit_usage(exploit)
298
+ puts "Usage:"
299
+ puts
300
+ puts " $ #{example_run_command(exploit)}"
301
+ puts
302
+ end
303
+
304
+ #
305
+ # Builds an example `ronin-exploits run` command for the exploit.
306
+ #
307
+ # @param [Class<Exploit>] exploit
308
+ #
309
+ # @return [String]
310
+ # The example `ronin-exploits run` command.
311
+ #
312
+ # @since 0.2.0
313
+ #
314
+ def example_run_command(exploit)
315
+ command = ['ronin-exploits', 'run']
316
+
317
+ if options[:file]
318
+ command << '-f' << options[:file]
319
+ else
320
+ command << exploit.id
321
+ end
322
+
323
+ exploit.params.each_value do |param|
324
+ if param.required? && !param.default
325
+ command << '-p' << "#{param.name}=#{param_usage(param)}"
326
+ end
327
+ end
328
+
329
+ return command.join(' ')
330
+ end
331
+
289
332
  end
290
333
  end
291
334
  end