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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +16 -1
- data/.rubocop.yml +37 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +13 -1
- data/Gemfile +5 -2
- data/README.md +4 -3
- data/Rakefile +3 -1
- data/bin/ronin-payloads +7 -8
- data/examples/bin_sh.rb +4 -0
- data/gemspec.yml +8 -7
- data/lib/ronin/payloads/asm_payload.rb +2 -2
- data/lib/ronin/payloads/binary_payload.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/awk/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/bash/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/lua/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/node/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/openssl/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/perl/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/php/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/powershell/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/python/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/cmd/ruby/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/java/reverse_shell.rb +1 -1
- data/lib/ronin/payloads/builtin/php/cmd_exec.rb +5 -4
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/bind_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/freebsd/x86_64/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/arm/bind_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/arm/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/arm/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/mips/bind_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/mips/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/mips/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/ppc/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/ppc/reverse_shell.rb +3 -3
- data/lib/ronin/payloads/builtin/shellcode/linux/x86/bind_shell.rb +3 -3
- data/lib/ronin/payloads/builtin/shellcode/linux/x86/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/x86/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/bind_shell.rb +3 -3
- data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/linux/x86_64/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/macos/x86_64/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/netbsd/x86/reverse_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/bind_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/openbsd/x86/exec_shell.rb +2 -2
- data/lib/ronin/payloads/builtin/shellcode/windows/x86_64/cmd.rb +3 -3
- data/lib/ronin/payloads/builtin/test/open_redirect.rb +4 -4
- data/lib/ronin/payloads/builtin/test/xss.rb +4 -4
- data/lib/ronin/payloads/c_payload.rb +2 -2
- data/lib/ronin/payloads/cli/command.rb +1 -1
- data/lib/ronin/payloads/cli/commands/build.rb +11 -13
- data/lib/ronin/payloads/cli/commands/encode.rb +17 -21
- data/lib/ronin/payloads/cli/commands/encoder.rb +1 -1
- data/lib/ronin/payloads/cli/commands/encoders.rb +2 -2
- data/lib/ronin/payloads/cli/commands/irb.rb +1 -1
- data/lib/ronin/payloads/cli/commands/launch.rb +3 -3
- data/lib/ronin/payloads/cli/commands/list.rb +1 -1
- data/lib/ronin/payloads/cli/commands/new.rb +4 -4
- data/lib/ronin/payloads/cli/commands/show.rb +3 -2
- data/lib/ronin/payloads/cli/encoder_methods.rb +2 -1
- data/lib/ronin/payloads/cli/format_option.rb +1 -1
- data/lib/ronin/payloads/cli/generator/payload_types.rb +4 -3
- data/lib/ronin/payloads/cli/payload_command.rb +1 -1
- data/lib/ronin/payloads/cli/payload_methods.rb +1 -1
- data/lib/ronin/payloads/cli/printing.rb +1 -1
- data/lib/ronin/payloads/cli/ruby_shell.rb +1 -1
- data/lib/ronin/payloads/cli.rb +6 -1
- data/lib/ronin/payloads/coldfusion_payload.rb +1 -1
- data/lib/ronin/payloads/command_payload.rb +1 -1
- data/lib/ronin/payloads/encoders/builtin/html/encode.rb +2 -1
- data/lib/ronin/payloads/encoders/builtin/js/encode.rb +2 -1
- data/lib/ronin/payloads/encoders/builtin/powershell/encode.rb +2 -1
- data/lib/ronin/payloads/encoders/builtin/shell/encode.rb +2 -1
- data/lib/ronin/payloads/encoders/builtin/sql/encode.rb +2 -1
- data/lib/ronin/payloads/encoders/builtin/xml/encode.rb +2 -1
- data/lib/ronin/payloads/encoders/encoder.rb +3 -2
- data/lib/ronin/payloads/encoders/exceptions.rb +2 -1
- data/lib/ronin/payloads/encoders/html_encoder.rb +2 -1
- data/lib/ronin/payloads/encoders/javascript_encoder.rb +2 -1
- data/lib/ronin/payloads/encoders/pipeline.rb +3 -2
- data/lib/ronin/payloads/encoders/powershell_encoder.rb +2 -1
- data/lib/ronin/payloads/encoders/registry.rb +5 -1
- data/lib/ronin/payloads/encoders/shell_encoder.rb +2 -1
- data/lib/ronin/payloads/encoders/sql_encoder.rb +2 -1
- data/lib/ronin/payloads/encoders/xml_encoder.rb +2 -1
- data/lib/ronin/payloads/encoders.rb +1 -1
- data/lib/ronin/payloads/exceptions.rb +2 -1
- data/lib/ronin/payloads/go_payload.rb +2 -2
- data/lib/ronin/payloads/html_payload.rb +1 -1
- data/lib/ronin/payloads/java_payload.rb +2 -2
- data/lib/ronin/payloads/javascript_payload.rb +1 -1
- data/lib/ronin/payloads/jsp_payload.rb +1 -1
- data/lib/ronin/payloads/metadata/arch.rb +2 -1
- data/lib/ronin/payloads/metadata/os.rb +2 -1
- data/lib/ronin/payloads/mixins/binary.rb +1 -1
- data/lib/ronin/payloads/mixins/bind_shell.rb +3 -3
- data/lib/ronin/payloads/mixins/build_dir.rb +1 -1
- data/lib/ronin/payloads/mixins/erb.rb +1 -1
- data/lib/ronin/payloads/mixins/network.rb +1 -1
- data/lib/ronin/payloads/mixins/post_ex.rb +1 -2
- data/lib/ronin/payloads/mixins/resolve_host.rb +1 -1
- data/lib/ronin/payloads/mixins/reverse_shell.rb +1 -2
- data/lib/ronin/payloads/mixins/tempfile.rb +1 -1
- data/lib/ronin/payloads/mixins/typescript.rb +2 -3
- data/lib/ronin/payloads/node_js_payload.rb +1 -1
- data/lib/ronin/payloads/payload.rb +8 -8
- data/lib/ronin/payloads/php_payload.rb +1 -1
- data/lib/ronin/payloads/powershell_payload.rb +1 -1
- data/lib/ronin/payloads/python_payload.rb +1 -1
- data/lib/ronin/payloads/registry.rb +4 -1
- data/lib/ronin/payloads/root.rb +1 -1
- data/lib/ronin/payloads/ruby_payload.rb +1 -1
- data/lib/ronin/payloads/rust_payload.rb +2 -2
- data/lib/ronin/payloads/shell_payload.rb +1 -1
- data/lib/ronin/payloads/shellcode/bind_shell_payload.rb +1 -1
- data/lib/ronin/payloads/shellcode/exec_shell_payload.rb +1 -1
- data/lib/ronin/payloads/shellcode/reverse_shell_payload.rb +1 -1
- data/lib/ronin/payloads/shellcode_payload.rb +9 -9
- data/lib/ronin/payloads/sql_payload.rb +1 -1
- data/lib/ronin/payloads/url_payload.rb +3 -3
- data/lib/ronin/payloads/version.rb +2 -2
- data/lib/ronin/payloads/xml_payload.rb +1 -1
- data/lib/ronin/payloads.rb +2 -1
- data/man/ronin-payloads-build.1 +1 -1
- data/man/ronin-payloads-build.1.md +1 -1
- data/man/ronin-payloads-encode.1 +1 -1
- data/man/ronin-payloads-encode.1.md +1 -1
- data/man/ronin-payloads-encoder.1 +1 -1
- data/man/ronin-payloads-encoder.1.md +1 -1
- data/man/ronin-payloads-encoders.1 +1 -1
- data/man/ronin-payloads-encoders.1.md +1 -1
- data/man/ronin-payloads-irb.1 +1 -1
- data/man/ronin-payloads-irb.1.md +1 -1
- data/man/ronin-payloads-launch.1 +1 -1
- data/man/ronin-payloads-launch.1.md +1 -1
- data/man/ronin-payloads-list.1 +1 -1
- data/man/ronin-payloads-list.1.md +1 -1
- data/man/ronin-payloads.1 +1 -1
- data/man/ronin-payloads.1.md +1 -1
- data/ronin-payloads.gemspec +5 -5
- metadata +17 -215
- data/spec/asm_payload_spec.rb +0 -114
- data/spec/binary_payload_spec.rb +0 -8
- data/spec/builtin/cmd/awk/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/bash/reverse_shell_spec.rb +0 -36
- data/spec/builtin/cmd/lua/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/node/reverse_shell_spec.rb +0 -36
- data/spec/builtin/cmd/openssl/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/perl/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/php/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/powershell/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/python/reverse_shell_spec.rb +0 -38
- data/spec/builtin/cmd/ruby/reverse_shell_spec.rb +0 -38
- data/spec/builtin/java/reverse_shell_spec.rb +0 -103
- data/spec/builtin/php/cmd_exec.rb +0 -52
- data/spec/builtin/shellcode/freebsd/x86/bind_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/freebsd/x86/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/freebsd/x86/reverse_shell_spec.rb +0 -63
- data/spec/builtin/shellcode/freebsd/x86_64/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/linux/arm/bind_shell_spec.rb +0 -62
- data/spec/builtin/shellcode/linux/arm/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/linux/arm/reverse_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/linux/mips/bind_shell_spec.rb +0 -60
- data/spec/builtin/shellcode/linux/mips/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/linux/mips/reverse_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/linux/ppc/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/linux/ppc/reverse_shell_spec.rb +0 -87
- data/spec/builtin/shellcode/linux/x86/bind_shell_spec.rb +0 -60
- data/spec/builtin/shellcode/linux/x86/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/linux/x86/reverse_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/linux/x86_64/bind_shell_spec.rb +0 -60
- data/spec/builtin/shellcode/linux/x86_64/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/linux/x86_64/reverse_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/macos/x86_64/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/macos/x86_64/reverse_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/netbsd/x86/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/netbsd/x86/reverse_shell_spec.rb +0 -63
- data/spec/builtin/shellcode/openbsd/x86/bind_shell_spec.rb +0 -58
- data/spec/builtin/shellcode/openbsd/x86/exec_shell_spec.rb +0 -46
- data/spec/builtin/shellcode/windows/x86_64/cmd_spec.rb +0 -54
- data/spec/builtin/test/open_redirect_spec.rb +0 -24
- data/spec/builtin/test/xss_spec.rb +0 -24
- data/spec/c_payload_spec.rb +0 -139
- data/spec/cli/commands/show_spec.rb +0 -21
- data/spec/cli/encoder_methods_spec.rb +0 -275
- data/spec/cli/format_option_spec.rb +0 -187
- data/spec/cli/payload_command_spec.rb +0 -68
- data/spec/cli/payload_methods_spec.rb +0 -208
- data/spec/cli/printing_spec.rb +0 -65
- data/spec/cli/ruby_shell_spec.rb +0 -14
- data/spec/coldfusion_payload_spec.rb +0 -8
- data/spec/command_payload_spec.rb +0 -8
- data/spec/encoders/builtin/html/encode_spec.rb +0 -17
- data/spec/encoders/builtin/js/encode_spec.rb +0 -17
- data/spec/encoders/builtin/powershell/encode_spec.rb +0 -17
- data/spec/encoders/builtin/shell/encode_spec.rb +0 -17
- data/spec/encoders/builtin/sql/encode_spec.rb +0 -17
- data/spec/encoders/builtin/xml/encode_spec.rb +0 -17
- data/spec/encoders/encoder_spec.rb +0 -62
- data/spec/encoders/html_encoder_spec.rb +0 -8
- data/spec/encoders/javascript_encoder_spec.rb +0 -8
- data/spec/encoders/pipeline_spec.rb +0 -153
- data/spec/encoders/powershell_encoder_spec.rb +0 -8
- data/spec/encoders/shell_encoder_spec.rb +0 -8
- data/spec/encoders/sql_encoder_spec.rb +0 -8
- data/spec/encoders/xml_encoder_spec.rb +0 -8
- data/spec/encoders_spec.rb +0 -25
- data/spec/go_payload_spec.rb +0 -56
- data/spec/helpers/encoders.rb +0 -9
- data/spec/helpers/payloads.rb +0 -9
- data/spec/helpers/scripts/payloads/simple.rb +0 -22
- data/spec/html_payload_spec.rb +0 -12
- data/spec/java_payload_spec.rb +0 -97
- data/spec/javascript_payload_spec.rb +0 -12
- data/spec/jsp_payload_spec.rb +0 -8
- data/spec/metadata/arch_spec.rb +0 -82
- data/spec/metadata/os_spec.rb +0 -164
- data/spec/mixins/binary_spec.rb +0 -129
- data/spec/mixins/bind_shell_spec.rb +0 -73
- data/spec/mixins/build_dir.rb +0 -64
- data/spec/mixins/erb_spec.rb +0 -19
- data/spec/mixins/network_spec.rb +0 -75
- data/spec/mixins/post_ex_spec.rb +0 -40
- data/spec/mixins/resolve_host_spec.rb +0 -322
- data/spec/mixins/reverse_shell_spec.rb +0 -103
- data/spec/mixins/tempfile_spec.rb +0 -97
- data/spec/mixins/typescript_spec.rb +0 -92
- data/spec/node_js_payload_spec.rb +0 -8
- data/spec/payload_spec.rb +0 -288
- data/spec/payloads_spec.rb +0 -29
- data/spec/php_payload_spec.rb +0 -8
- data/spec/powershell_payload_spec.rb +0 -16
- data/spec/python_payload_spec.rb +0 -8
- data/spec/ruby_payload_spec.rb +0 -8
- data/spec/rust_payload_spec.rb +0 -116
- data/spec/shell_payload_spec.rb +0 -16
- data/spec/shellcode/bind_shell_payload_spec.rb +0 -42
- data/spec/shellcode/exec_shell_payload_spec.rb +0 -8
- data/spec/shellcode/reverse_shell_payload_spec.rb +0 -136
- data/spec/shellcode_payload_spec.rb +0 -38
- data/spec/spec_helper.rb +0 -7
- data/spec/sql_payload_spec.rb +0 -12
- data/spec/url_payload_spec.rb +0 -72
- data/spec/xml_payload_spec.rb +0 -12
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/shellcode/bind_shell_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::Shellcode::BindShellPayload do
|
5
|
-
module TestBindShellPayload
|
6
|
-
class TestBindShell < Ronin::Payloads::Shellcode::BindShellPayload
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:host) { 'example.com' }
|
11
|
-
let(:port) { 1337 }
|
12
|
-
|
13
|
-
let(:payload_class) { TestBindShellPayload::TestBindShell }
|
14
|
-
subject do
|
15
|
-
payload_class.new(
|
16
|
-
params: {
|
17
|
-
host: host,
|
18
|
-
port: port
|
19
|
-
}
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "must include Ronin::Payloads::Mixins::BindShell" do
|
24
|
-
expect(described_class).to include(Ronin::Payloads::Mixins::BindShell)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "must include Ronin::Payloads::Mixins::ResolveHost" do
|
28
|
-
expect(described_class).to include(Ronin::Payloads::Mixins::ResolveHost)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "must include Ronin::Payloads::Mixins::Network" do
|
32
|
-
expect(described_class).to include(Ronin::Payloads::Mixins::Network)
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "#packed_port" do
|
36
|
-
let(:port) { 0xff00 }
|
37
|
-
|
38
|
-
it "must return the packed port number as a 16bit integer in network byte-ordeR" do
|
39
|
-
expect(subject.packed_port).to eq("\xff\x00".b)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/shellcode/exec_shell_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::Shellcode::ExecShellPayload do
|
5
|
-
it "must inherit from Ronin::Payloads::ShellcodePayload " do
|
6
|
-
expect(described_class).to be < Ronin::Payloads::ShellcodePayload
|
7
|
-
end
|
8
|
-
end
|
@@ -1,136 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/shellcode/reverse_shell_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::Shellcode::ReverseShellPayload do
|
5
|
-
module TestReverseShellPayload
|
6
|
-
class TestReverseShell < Ronin::Payloads::Shellcode::ReverseShellPayload
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:host) { 'example.com' }
|
11
|
-
let(:port) { 1337 }
|
12
|
-
|
13
|
-
let(:payload_class) { TestReverseShellPayload::TestReverseShell }
|
14
|
-
subject do
|
15
|
-
payload_class.new(
|
16
|
-
params: {
|
17
|
-
host: host,
|
18
|
-
port: port
|
19
|
-
}
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "must include Ronin::Payloads::Mixins::ReverseShell" do
|
24
|
-
expect(described_class).to include(Ronin::Payloads::Mixins::ReverseShell)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "must include Ronin::Payloads::Mixins::ResolveHost" do
|
28
|
-
expect(described_class).to include(Ronin::Payloads::Mixins::ResolveHost)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "must include Ronin::Payloads::Mixins::Network" do
|
32
|
-
expect(described_class).to include(Ronin::Payloads::Mixins::Network)
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "#packed_ipv4" do
|
36
|
-
context "when the 'host' param has an IPv4 address" do
|
37
|
-
it "must return the packed IPv4 address in network byte-order" do
|
38
|
-
expect(subject.packed_ipv4).to eq(IPAddr.new('93.184.216.34').hton)
|
39
|
-
end
|
40
|
-
|
41
|
-
context "when given the `negate: true` keyword argument" do
|
42
|
-
it "must invert the bits of the packed IPv4 address" do
|
43
|
-
expect(subject.packed_ipv4(negate: true)).to eq(
|
44
|
-
(~IPAddr.new('93.184.216.34')).hton
|
45
|
-
)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context "when the 'host' param is an IPv4 address" do
|
51
|
-
let(:host) { '1.2.3.4' }
|
52
|
-
|
53
|
-
it "must return the packed IPv4 address in network byte-order" do
|
54
|
-
expect(subject.packed_ipv4).to eq("\x01\x02\x03\x04".b)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "when the 'host' param is an IPv6 address" do
|
59
|
-
let(:host) { '::1' }
|
60
|
-
|
61
|
-
it do
|
62
|
-
expect {
|
63
|
-
subject.packed_ipv4
|
64
|
-
}.to raise_error(Ronin::Payloads::ValidationError,"host must be a hostname or an IPv4 address, was an IPv6 address: #{host.inspect}")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "when the 'host' param has no IPv4 addresses" do
|
69
|
-
let(:host) { 'ipv6.wtfismyip.com' }
|
70
|
-
|
71
|
-
it do
|
72
|
-
expect {
|
73
|
-
subject.packed_ipv4
|
74
|
-
}.to raise_error(Ronin::Payloads::BuildFailed,"host name has no IPv4 addresses: #{host.inspect}")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "#packed_ipv6" do
|
80
|
-
context "when the 'host' param has an IPv6 address" do
|
81
|
-
let(:host) { 'icann.org' }
|
82
|
-
|
83
|
-
it "must return the packed IPv6 address in network byte-order" do
|
84
|
-
expect(subject.packed_ipv6).to eq(
|
85
|
-
IPAddr.new('2001:500:88:200::7').hton
|
86
|
-
)
|
87
|
-
end
|
88
|
-
|
89
|
-
context "when given the `negate: true` keyword argument" do
|
90
|
-
it "must invert the bits of the packed IPv4 address" do
|
91
|
-
expect(subject.packed_ipv6(negate: true)).to eq(
|
92
|
-
(~IPAddr.new('2001:500:88:200::7')).hton
|
93
|
-
)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context "when the 'host' param is an IPv4 address" do
|
99
|
-
let(:host) { '1.2.3.4' }
|
100
|
-
|
101
|
-
it "must return the packed IPv6-to-IPv4 address in network byte-order" do
|
102
|
-
expect(subject.packed_ipv6).to eq(
|
103
|
-
IPAddr.new("::ffff:#{host}").hton
|
104
|
-
)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context "when the 'host' param is an IPv6 address" do
|
109
|
-
let(:host) { '::1' }
|
110
|
-
|
111
|
-
it do
|
112
|
-
expect(subject.packed_ipv6).to eq(
|
113
|
-
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01".b
|
114
|
-
)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
context "when the 'host' param has no IPv6 addresses" do
|
119
|
-
let(:host) { 'a.resolvers.level3.net' }
|
120
|
-
|
121
|
-
it "must convert the IPv4 address to an IPv6-to-IPv4 address and return the packed IPv6-to-IPv4 address in network byte-order" do
|
122
|
-
expect(subject.packed_ipv6).to eq(
|
123
|
-
IPAddr.new("::ffff:4.2.2.1").hton
|
124
|
-
)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "#packed_port" do
|
130
|
-
let(:port) { 0xff00 }
|
131
|
-
|
132
|
-
it "must return the packed port number as a 16bit integer in network byte-ordeR" do
|
133
|
-
expect(subject.packed_port).to eq("\xff\x00".b)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/shellcode_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::ShellcodePayload do
|
5
|
-
module TestShellcodePayload
|
6
|
-
class TestPayload < Ronin::Payloads::ShellcodePayload
|
7
|
-
arch :x86
|
8
|
-
os :linux
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "must inherit from Ronin::Payloads::ASMPayload" do
|
13
|
-
expect(described_class.superclass).to be(Ronin::Payloads::ASMPayload)
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:payload_class) { TestShellcodePayload::TestPayload }
|
17
|
-
subject { payload_class.new }
|
18
|
-
|
19
|
-
describe "#shellcode" do
|
20
|
-
it "must return the assembled program" do
|
21
|
-
output = subject.shellcode do
|
22
|
-
mov al, syscalls[:exit]
|
23
|
-
int 0xb
|
24
|
-
end
|
25
|
-
|
26
|
-
expect(output).to_not be_empty
|
27
|
-
end
|
28
|
-
|
29
|
-
it "must set #payload" do
|
30
|
-
output = subject.shellcode do
|
31
|
-
mov al, syscalls[:exit]
|
32
|
-
int 0xb
|
33
|
-
end
|
34
|
-
|
35
|
-
expect(subject.payload).to be(output)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/sql_payload_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/sql_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::SQLPayload do
|
5
|
-
describe ".encoder_class" do
|
6
|
-
subject { described_class }
|
7
|
-
|
8
|
-
it do
|
9
|
-
expect(subject.encoder_class).to be(Ronin::Payloads::Encoders::SQLEncoder)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/spec/url_payload_spec.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/url_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::URLPayload do
|
5
|
-
it "must inherit from Ronin::Payloads::Payload" do
|
6
|
-
expect(described_class.superclass).to be(Ronin::Payloads::Payload)
|
7
|
-
end
|
8
|
-
|
9
|
-
describe ".url" do
|
10
|
-
subject { payload_class }
|
11
|
-
|
12
|
-
context "and when url is not set in the class" do
|
13
|
-
module TestMetadataURL
|
14
|
-
class WithNoURLSet < Ronin::Payloads::URLPayload
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:payload_class) { TestMetadataURL::WithNoURLSet }
|
19
|
-
|
20
|
-
it "must default to nil" do
|
21
|
-
expect(subject.url).to be(nil)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "and when url is set in the class" do
|
26
|
-
module TestMetadataURL
|
27
|
-
class WithURLSet < Ronin::Payloads::URLPayload
|
28
|
-
url 'test'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
let(:payload_class) { TestMetadataURL::WithURLSet }
|
33
|
-
|
34
|
-
it "must return the set url" do
|
35
|
-
expect(subject.url).to eq("test")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "but when the url was set in the superclass" do
|
40
|
-
module TestMetadataURL
|
41
|
-
class InheritsItsURL < WithURLSet
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
let(:payload_class) { TestMetadataURL::InheritsItsURL }
|
46
|
-
|
47
|
-
it "must return the url set in the superclass" do
|
48
|
-
expect(subject.url).to eq("test")
|
49
|
-
end
|
50
|
-
|
51
|
-
context "but the url is overridden in the sub-class" do
|
52
|
-
module TestMetadataURL
|
53
|
-
class OverridesItsInheritedURL < WithURLSet
|
54
|
-
url "test2"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
let(:payload_class) do
|
59
|
-
TestMetadataURL::OverridesItsInheritedURL
|
60
|
-
end
|
61
|
-
|
62
|
-
it "must return the url set in the sub-class" do
|
63
|
-
expect(subject.url).to eq("test2")
|
64
|
-
end
|
65
|
-
|
66
|
-
it "must not modify the superclass'es url" do
|
67
|
-
expect(subject.superclass.url).to eq('test')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
data/spec/xml_payload_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/payloads/xml_payload'
|
3
|
-
|
4
|
-
describe Ronin::Payloads::XMLPayload do
|
5
|
-
describe ".encoder_class" do
|
6
|
-
subject { described_class }
|
7
|
-
|
8
|
-
it do
|
9
|
-
expect(subject.encoder_class).to be(Ronin::Payloads::Encoders::XMLEncoder)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|