ronin-payloads 0.1.6 → 0.2.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/.gitignore +1 -0
  4. data/ChangeLog.md +45 -0
  5. data/Gemfile +6 -4
  6. data/README.md +42 -15
  7. data/Rakefile +10 -0
  8. data/data/completions/ronin-payloads +127 -0
  9. data/data/completions/ronin-payloads.yml +16 -0
  10. data/gemspec.yml +3 -1
  11. data/lib/ronin/payloads/asm_payload.rb +1 -1
  12. data/lib/ronin/payloads/binary_payload.rb +1 -1
  13. data/lib/ronin/payloads/builtin/bin/unix/reverse_shell.c +61 -0
  14. data/lib/ronin/payloads/builtin/bin/unix/reverse_shell.rb +84 -0
  15. data/lib/ronin/payloads/builtin/bin/windows/reverse_shell.c +63 -0
  16. data/lib/ronin/payloads/builtin/bin/windows/reverse_shell.rb +87 -0
  17. data/lib/ronin/payloads/builtin/cmd/awk/reverse_shell.rb +1 -1
  18. data/lib/ronin/payloads/builtin/cmd/bash/reverse_shell.rb +1 -1
  19. data/lib/ronin/payloads/builtin/cmd/lua/reverse_shell.rb +1 -1
  20. data/lib/ronin/payloads/builtin/cmd/netcat/bind_shell.rb +51 -0
  21. data/lib/ronin/payloads/builtin/cmd/node/reverse_shell.rb +1 -1
  22. data/lib/ronin/payloads/builtin/cmd/openssl/reverse_shell.rb +1 -1
  23. data/lib/ronin/payloads/builtin/cmd/perl/reverse_shell.rb +1 -1
  24. data/lib/ronin/payloads/builtin/cmd/php/reverse_shell.rb +1 -1
  25. data/lib/ronin/payloads/builtin/cmd/ping.rb +52 -0
  26. data/lib/ronin/payloads/builtin/cmd/powershell/reverse_shell.rb +1 -1
  27. data/lib/ronin/payloads/builtin/cmd/python/reverse_shell.rb +1 -1
  28. data/lib/ronin/payloads/builtin/cmd/ruby/reverse_shell.rb +1 -1
  29. data/lib/ronin/payloads/builtin/cmd/sleep.rb +49 -0
  30. data/lib/ronin/payloads/builtin/cmd/touch.rb +49 -0
  31. data/lib/ronin/payloads/builtin/cmd/windows/download.rb +70 -0
  32. data/lib/ronin/payloads/builtin/cmd/zsh/reverse_shell.rb +55 -0
  33. data/lib/ronin/payloads/builtin/groovy/reverse_shell.rb +54 -0
  34. data/lib/ronin/payloads/builtin/java/reverse_shell.rb +1 -1
  35. data/lib/ronin/payloads/builtin/js/nashorn/reverse_shell.rb +63 -0
  36. data/lib/ronin/payloads/builtin/js/node/reverse_shell.rb +55 -0
  37. data/lib/ronin/payloads/builtin/php/cmd_exec.rb +1 -1
  38. data/lib/ronin/payloads/builtin/php/download_exec.php.erb +96 -0
  39. data/lib/ronin/payloads/builtin/php/download_exec.rb +54 -0
  40. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/bind_shell.rb +1 -1
  41. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/exec_shell.rb +1 -1
  42. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/reverse_shell.rb +1 -1
  43. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86_64/exec_shell.rb +1 -1
  44. data/lib/ronin/payloads/builtin/shellcode/linux/arm/bind_shell.rb +1 -1
  45. data/lib/ronin/payloads/builtin/shellcode/linux/arm/exec_shell.rb +1 -1
  46. data/lib/ronin/payloads/builtin/shellcode/linux/arm/reverse_shell.rb +1 -1
  47. data/lib/ronin/payloads/builtin/shellcode/linux/mips/bind_shell.rb +1 -1
  48. data/lib/ronin/payloads/builtin/shellcode/linux/mips/exec_shell.rb +1 -1
  49. data/lib/ronin/payloads/builtin/shellcode/linux/mips/reverse_shell.rb +1 -1
  50. data/lib/ronin/payloads/builtin/shellcode/linux/ppc/exec_shell.rb +1 -1
  51. data/lib/ronin/payloads/builtin/shellcode/linux/ppc/reverse_shell.rb +1 -1
  52. data/lib/ronin/payloads/builtin/shellcode/linux/x86/bind_shell.rb +1 -1
  53. data/lib/ronin/payloads/builtin/shellcode/linux/x86/exec_shell.rb +1 -1
  54. data/lib/ronin/payloads/builtin/shellcode/linux/x86/reverse_shell.rb +1 -1
  55. data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/bind_shell.rb +1 -1
  56. data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/exec_shell.rb +1 -1
  57. data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/reverse_shell.rb +1 -1
  58. data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/exec_shell.rb +1 -1
  59. data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/reverse_shell.rb +1 -1
  60. data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/exec_shell.rb +1 -1
  61. data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/reverse_shell.rb +1 -1
  62. data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/bind_shell.rb +1 -1
  63. data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/exec_shell.rb +1 -1
  64. data/lib/ronin/payloads/builtin/shellcode/windows/x86_64/cmd.rb +1 -1
  65. data/lib/ronin/payloads/builtin/test/cmd.rb +53 -0
  66. data/lib/ronin/payloads/builtin/test/open_redirect.rb +5 -2
  67. data/lib/ronin/payloads/builtin/test/url.rb +53 -0
  68. data/lib/ronin/payloads/builtin/test/xss.rb +5 -2
  69. data/lib/ronin/payloads/c_payload.rb +4 -60
  70. data/lib/ronin/payloads/cli/command.rb +1 -1
  71. data/lib/ronin/payloads/cli/commands/build.rb +3 -3
  72. data/lib/ronin/payloads/cli/commands/completion.rb +64 -0
  73. data/lib/ronin/payloads/cli/commands/encode.rb +1 -1
  74. data/lib/ronin/payloads/cli/commands/encoder.rb +1 -1
  75. data/lib/ronin/payloads/cli/commands/encoders.rb +1 -1
  76. data/lib/ronin/payloads/cli/commands/irb.rb +1 -1
  77. data/lib/ronin/payloads/cli/commands/launch.rb +1 -1
  78. data/lib/ronin/payloads/cli/commands/list.rb +1 -1
  79. data/lib/ronin/payloads/cli/commands/show.rb +44 -1
  80. data/lib/ronin/payloads/cli/encoder_methods.rb +1 -1
  81. data/lib/ronin/payloads/cli/format_option.rb +1 -1
  82. data/lib/ronin/payloads/cli/payload_command.rb +1 -1
  83. data/lib/ronin/payloads/cli/payload_methods.rb +1 -1
  84. data/lib/ronin/payloads/cli/printing.rb +5 -2
  85. data/lib/ronin/payloads/cli/ruby_shell.rb +1 -1
  86. data/lib/ronin/payloads/cli.rb +3 -1
  87. data/lib/ronin/payloads/coldfusion_payload.rb +1 -1
  88. data/lib/ronin/payloads/command_payload.rb +1 -1
  89. data/lib/ronin/payloads/encoders/builtin/html/encode.rb +1 -1
  90. data/lib/ronin/payloads/encoders/builtin/js/encode.rb +1 -1
  91. data/lib/ronin/payloads/encoders/builtin/powershell/encode.rb +1 -1
  92. data/lib/ronin/payloads/encoders/builtin/shell/encode.rb +1 -1
  93. data/lib/ronin/payloads/encoders/builtin/sql/encode.rb +1 -1
  94. data/lib/ronin/payloads/encoders/builtin/xml/encode.rb +1 -1
  95. data/lib/ronin/payloads/encoders/encoder.rb +1 -1
  96. data/lib/ronin/payloads/encoders/exceptions.rb +1 -1
  97. data/lib/ronin/payloads/encoders/html_encoder.rb +1 -1
  98. data/lib/ronin/payloads/encoders/javascript_encoder.rb +1 -1
  99. data/lib/ronin/payloads/encoders/pipeline.rb +1 -1
  100. data/lib/ronin/payloads/encoders/powershell_encoder.rb +1 -1
  101. data/lib/ronin/payloads/encoders/registry.rb +1 -1
  102. data/lib/ronin/payloads/encoders/shell_encoder.rb +1 -1
  103. data/lib/ronin/payloads/encoders/sql_encoder.rb +1 -1
  104. data/lib/ronin/payloads/encoders/xml_encoder.rb +1 -1
  105. data/lib/ronin/payloads/encoders.rb +1 -1
  106. data/lib/ronin/payloads/exceptions.rb +1 -1
  107. data/lib/ronin/payloads/go_payload.rb +6 -2
  108. data/lib/ronin/payloads/groovy_payload.rb +49 -0
  109. data/lib/ronin/payloads/html_payload.rb +1 -1
  110. data/lib/ronin/payloads/java_payload.rb +6 -2
  111. data/lib/ronin/payloads/javascript_payload.rb +1 -1
  112. data/lib/ronin/payloads/jsp_payload.rb +1 -1
  113. data/lib/ronin/payloads/metadata/arch.rb +1 -1
  114. data/lib/ronin/payloads/metadata/os.rb +1 -1
  115. data/lib/ronin/payloads/mixins/binary.rb +1 -1
  116. data/lib/ronin/payloads/mixins/bind_shell.rb +1 -1
  117. data/lib/ronin/payloads/mixins/build_dir.rb +1 -1
  118. data/lib/ronin/payloads/mixins/c_compiler.rb +250 -0
  119. data/lib/ronin/payloads/mixins/erb.rb +1 -1
  120. data/lib/ronin/payloads/mixins/network.rb +1 -1
  121. data/lib/ronin/payloads/mixins/post_ex.rb +1 -1
  122. data/lib/ronin/payloads/mixins/resolve_host.rb +1 -1
  123. data/lib/ronin/payloads/mixins/reverse_shell.rb +3 -1
  124. data/lib/ronin/payloads/mixins/tempfile.rb +1 -1
  125. data/lib/ronin/payloads/mixins/typescript.rb +6 -2
  126. data/lib/ronin/payloads/nashorn_payload.rb +51 -0
  127. data/lib/ronin/payloads/node_js_payload.rb +1 -1
  128. data/lib/ronin/payloads/payload.rb +1 -1
  129. data/lib/ronin/payloads/php_payload.rb +1 -1
  130. data/lib/ronin/payloads/powershell_payload.rb +1 -1
  131. data/lib/ronin/payloads/python_payload.rb +1 -1
  132. data/lib/ronin/payloads/registry.rb +1 -1
  133. data/lib/ronin/payloads/root.rb +1 -1
  134. data/lib/ronin/payloads/ruby_payload.rb +1 -1
  135. data/lib/ronin/payloads/rust_payload.rb +6 -2
  136. data/lib/ronin/payloads/shell_payload.rb +1 -1
  137. data/lib/ronin/payloads/shellcode/bind_shell_payload.rb +1 -1
  138. data/lib/ronin/payloads/shellcode/exec_shell_payload.rb +1 -1
  139. data/lib/ronin/payloads/shellcode/reverse_shell_payload.rb +1 -1
  140. data/lib/ronin/payloads/shellcode_payload.rb +1 -1
  141. data/lib/ronin/payloads/sql_payload.rb +1 -1
  142. data/lib/ronin/payloads/url_payload.rb +1 -1
  143. data/lib/ronin/payloads/version.rb +2 -2
  144. data/lib/ronin/payloads/xml_payload.rb +1 -1
  145. data/lib/ronin/payloads.rb +1 -1
  146. data/man/ronin-payloads-build.1 +16 -30
  147. data/man/ronin-payloads-build.1.md +15 -11
  148. data/man/ronin-payloads-completion.1 +76 -0
  149. data/man/ronin-payloads-completion.1.md +78 -0
  150. data/man/ronin-payloads-encode.1 +12 -24
  151. data/man/ronin-payloads-encode.1.md +11 -7
  152. data/man/ronin-payloads-encoder.1 +9 -18
  153. data/man/ronin-payloads-encoder.1.md +8 -4
  154. data/man/ronin-payloads-encoders.1 +8 -16
  155. data/man/ronin-payloads-encoders.1.md +7 -3
  156. data/man/ronin-payloads-irb.1 +8 -15
  157. data/man/ronin-payloads-irb.1.md +6 -2
  158. data/man/ronin-payloads-launch.1 +11 -20
  159. data/man/ronin-payloads-launch.1.md +9 -5
  160. data/man/ronin-payloads-list.1 +9 -16
  161. data/man/ronin-payloads-list.1.md +7 -3
  162. data/man/ronin-payloads-new.1.md +13 -9
  163. data/man/ronin-payloads-show.1 +11 -20
  164. data/man/ronin-payloads-show.1.md +9 -5
  165. data/man/ronin-payloads.1 +18 -26
  166. data/man/ronin-payloads.1.md +17 -10
  167. data/scripts/setup +58 -0
  168. metadata +29 -3
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
+ # payloads.
5
+ #
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # ronin-payloads 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-payloads 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-payloads. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ require 'ronin/payloads/payload'
23
+
24
+ module Ronin
25
+ module Payloads
26
+ #
27
+ # A {Payload} class that represents all Groovy payloads.
28
+ #
29
+ # @since 0.2.0
30
+ #
31
+ class GroovyPayload < Payload
32
+
33
+ #
34
+ # Returns the type or kind of payload.
35
+ #
36
+ # @return [Symbol]
37
+ #
38
+ # @note
39
+ # This is used internally to map an payload class to a printable type.
40
+ #
41
+ # @api private
42
+ #
43
+ def self.payload_type
44
+ :groovy
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -3,7 +3,7 @@
3
3
  # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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
@@ -67,7 +67,9 @@ module Ronin
67
67
  # @raise [BuildFailed]
68
68
  # The `javac` command failed or is not installed.
69
69
  #
70
- def compile(*source_files, dest_dir: nil)
70
+ # @since 0.2.0
71
+ #
72
+ def compile_java(*source_files, dest_dir: nil)
71
73
  args = [params[:javac]]
72
74
  args << '-d' << dest_dir if dest_dir
73
75
  args.concat(source_files)
@@ -80,6 +82,8 @@ module Ronin
80
82
  end
81
83
  end
82
84
 
85
+ alias compile compile_java
86
+
83
87
  end
84
88
  end
85
89
  end
@@ -3,7 +3,7 @@
3
3
  # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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,250 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
+ # payloads.
5
+ #
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # ronin-payloads 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-payloads 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-payloads. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ module Ronin
23
+ module Payloads
24
+ module Mixins
25
+ #
26
+ # Mixin for using the C compiler.
27
+ #
28
+ # ## Features
29
+ #
30
+ # * Supports `gcc` and `clang`.
31
+ # * Supports automatically switching to a cross compiler to cross compile
32
+ # for different architectures and OSes.
33
+ # * Supports using `mingw32` to cross-compile for Windows.
34
+ #
35
+ # @since 0.2.0
36
+ #
37
+ module CCompiler
38
+ #
39
+ # The default C compiler.
40
+ #
41
+ # @return [String, nil]
42
+ #
43
+ # @api private
44
+ #
45
+ def self.cc
46
+ ENV['CC']
47
+ end
48
+
49
+ #
50
+ # Adds the `cc`, `c_compiler`, `arch`, `vendor`, and `os` params
51
+ # to the payload class that included {Mixins::CCompiler}.
52
+ #
53
+ # @param [Class<Payload>] payload_class
54
+ # The payload class including {Mixins::CCompiler}.
55
+ #
56
+ # @api private
57
+ #
58
+ def self.included(payload_class)
59
+ payload_class.param :cc, default: -> { cc },
60
+ desc: 'The C compiler command to use'
61
+
62
+ payload_class.param :c_compiler, Core::Params::Types::Enum[
63
+ :gcc,
64
+ :clang
65
+ ], default: :gcc,
66
+ desc: 'The C compiler to use'
67
+
68
+ payload_class.param :arch, Core::Params::Types::Enum[
69
+ :"x86-64",
70
+ :i686,
71
+ :aarch64,
72
+ :arm,
73
+ :arm64,
74
+ :armbe,
75
+ :armbe64,
76
+ :mips,
77
+ :mips64,
78
+ :ppc,
79
+ :ppc64
80
+ ], desc: 'The target architecture'
81
+
82
+ payload_class.param :vendor, Core::Params::Types::Enum[
83
+ :pc,
84
+ :unknown
85
+ ], desc: 'The target vendor'
86
+
87
+ payload_class.param :os, Core::Params::Types::Enum[
88
+ :linux,
89
+ :macos,
90
+ :freebsd,
91
+ :windows,
92
+ :"windows-gnu",
93
+ :"windows-msvc"
94
+ ], desc: 'The target OS'
95
+ end
96
+
97
+ #
98
+ # The target architecture to compile for.
99
+ #
100
+ # @return [String]
101
+ # The target architecture string.
102
+ #
103
+ # @api private
104
+ #
105
+ def target_arch
106
+ if params[:arch]
107
+ params[:arch].to_s.tr('-','_')
108
+ end
109
+ end
110
+
111
+ #
112
+ # The target vendor to compile for.
113
+ #
114
+ # @return [String]
115
+ # The target vendor string.
116
+ #
117
+ # @api private
118
+ #
119
+ def target_vendor
120
+ if params[:os] == :windows
121
+ 'w64'
122
+ elsif params[:vendor]
123
+ params[:vendor].to_s
124
+ end
125
+ end
126
+
127
+ #
128
+ # The target OS to compile for.
129
+ #
130
+ # @return [String]
131
+ # The target OS string.
132
+ #
133
+ # @api private
134
+ #
135
+ def target_os
136
+ case params[:os]
137
+ when :linux then 'linux-gnu'
138
+ when :windows then 'mingw32'
139
+ else params[:os].to_s
140
+ end
141
+ end
142
+
143
+ #
144
+ # The target platform to compile for.
145
+ #
146
+ # @return [String, nil]
147
+ # The target triple string, if the `arch` and `os` params are set.
148
+ #
149
+ # @api private
150
+ #
151
+ def target_platform
152
+ arch = target_arch
153
+ os = target_os
154
+
155
+ if arch && os
156
+ if (vendor = target_vendor)
157
+ "#{arch}-#{vendor}-#{os}"
158
+ else
159
+ "#{arch}-#{os}"
160
+ end
161
+ end
162
+ end
163
+
164
+ #
165
+ # The C compiler command to use.
166
+ #
167
+ # @return [String]
168
+ # The command name.
169
+ #
170
+ # @api private
171
+ #
172
+ def cc
173
+ params[:cc] || case params[:c_compiler]
174
+ when :gcc
175
+ if (target = target_platform)
176
+ "#{target}-gcc"
177
+ else
178
+ 'gcc'
179
+ end
180
+ when :clang then 'clang'
181
+ else 'cc'
182
+ end
183
+ end
184
+
185
+ #
186
+ # Compiles one or more source files using `cc`.
187
+ #
188
+ # @param [Array<String>] source_files
189
+ # The source file(s) to compile.
190
+ #
191
+ # @param [String] output
192
+ # The output file path.
193
+ #
194
+ # @param [Array<String>, Hash{Symbol,String => String}, nil] defs
195
+ # Additional macro definitions to pass to the compiler.
196
+ #
197
+ # @param [Array<String>] libs
198
+ # Libraries to link to.
199
+ #
200
+ # @raise [ArgumentError]
201
+ # `defs` was not an Array or a Hash.
202
+ #
203
+ # @raise [BuildFailed]
204
+ # The `cc` command failed or is not installed.
205
+ #
206
+ def compile_c(*source_files, output: , defs: nil, libs: nil)
207
+ target = target_platform
208
+ args = [cc]
209
+
210
+ if target && params[:c_compiler] == :clang
211
+ args << '-target' << target
212
+ end
213
+
214
+ if defs
215
+ case defs
216
+ when Array
217
+ defs.each do |value|
218
+ args << "-D#{value}"
219
+ end
220
+ when Hash
221
+ defs.each do |name,value|
222
+ args << "-D#{name}=#{value}"
223
+ end
224
+ else
225
+ raise(ArgumentError,"defs must be either an Array or a Hash: #{defs.inspect}")
226
+ end
227
+ end
228
+
229
+ args << '-o' << output
230
+ args.concat(source_files)
231
+
232
+ if libs
233
+ libs.each do |lib|
234
+ args << "-l#{lib}"
235
+ end
236
+ end
237
+
238
+ case system(*args)
239
+ when false
240
+ raise(BuildFailed,"cc command failed: #{args.join(' ')}")
241
+ when nil
242
+ raise(BuildFailed,"cc command not installed")
243
+ end
244
+ end
245
+
246
+ alias compile compile_c
247
+ end
248
+ end
249
+ end
250
+ end
@@ -3,7 +3,7 @@
3
3
  # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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
@@ -43,9 +43,11 @@ module Ronin
43
43
  #
44
44
  def self.included(payload)
45
45
  payload.param :host, String, required: true,
46
+ default: '0.0.0.0',
46
47
  desc: 'The host to connect back to'
47
48
 
48
49
  payload.param :port, Integer, required: true,
50
+ default: 4444,
49
51
  desc: 'The port to connect back to'
50
52
  end
51
53
 
@@ -3,7 +3,7 @@
3
3
  # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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
@@ -58,7 +58,9 @@ module Ronin
58
58
  # @raise [BuildFailed]
59
59
  # The `tsc` command failed or is not installed.
60
60
  #
61
- def compile(*source_files)
61
+ # @since 0.2.0
62
+ #
63
+ def compile_ts(*source_files)
62
64
  args = [params[:tsc]]
63
65
  args.concat(source_files)
64
66
 
@@ -69,6 +71,8 @@ module Ronin
69
71
  raise(BuildFailed,"tsc command not installed")
70
72
  end
71
73
  end
74
+
75
+ alias compile compile_ts
72
76
  end
73
77
  end
74
78
  end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
+ # payloads.
5
+ #
6
+ # Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com)
7
+ #
8
+ # ronin-payloads 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-payloads 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-payloads. If not, see <https://www.gnu.org/licenses/>.
20
+ #
21
+
22
+ require 'ronin/payloads/javascript_payload'
23
+
24
+ module Ronin
25
+ module Payloads
26
+ #
27
+ # A {Payload} class that represents all [Nashorn] JavaScript payloads.
28
+ #
29
+ # [Nashorn]: https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html
30
+ #
31
+ # @since 0.2.0
32
+ #
33
+ class NashornPayload < JavaScriptPayload
34
+
35
+ #
36
+ # Returns the type or kind of payload.
37
+ #
38
+ # @return [Symbol]
39
+ #
40
+ # @note
41
+ # This is used internally to map an payload class to a printable type.
42
+ #
43
+ # @api private
44
+ #
45
+ def self.payload_type
46
+ :nashorn
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -3,7 +3,7 @@
3
3
  # ronin-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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-payloads - A Ruby micro-framework for writing and running exploit
4
4
  # payloads.
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-payloads 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
@@ -63,7 +63,9 @@ module Ronin
63
63
  # @raise [BuildFailed]
64
64
  # The `rustc` command failed or is not installed.
65
65
  #
66
- def compile(*source_files, output: nil, target: nil, cfg: nil)
66
+ # @since 0.2.0
67
+ #
68
+ def compile_rust(*source_files, output: nil, target: nil, cfg: nil)
67
69
  args = ['rustc']
68
70
 
69
71
  if output
@@ -99,6 +101,8 @@ module Ronin
99
101
  end
100
102
  end
101
103
 
104
+ alias compile compile_rust
105
+
102
106
  end
103
107
  end
104
108
  end