Skip to content

Commit

Permalink
Fixed specs due to example.com IP address changes.
Browse files Browse the repository at this point in the history
* Switch to using `icann.org`, who's IP addresses do not seem to change.
  • Loading branch information
postmodern committed Apr 27, 2024
1 parent a74a7ff commit 5221cd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions spec/mixins/resolve_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class TestPayload < Ronin::Payloads::Payload
end
end

let(:host) { 'example.com' }
let(:ipv4_addresses) { %w[93.184.216.34] }
let(:ipv6_addresses) { %w[2606:2800:220:1:248:1893:25c8:1946] }
let(:host) { 'icann.org' }
let(:ipv4_addresses) { %w[192.0.43.7] }
let(:ipv6_addresses) { %w[2001:500:88:200::7] }
let(:ip_addresses) { ipv4_addresses + ipv6_addresses }
let(:addresses) { Resolv.getaddresses(host) }

Expand Down
22 changes: 11 additions & 11 deletions spec/shellcode/reverse_shell_payload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ class TestReverseShell < Ronin::Payloads::Shellcode::ReverseShellPayload
end

describe "#packed_ipv4" do
let(:host) { 'icann.org' }
let(:address) { '192.0.43.7' }
let(:ipaddr) { IPAddr.new(address) }

context "when the 'host' param has an IPv4 address" do
it "must return the packed IPv4 address in network byte-order" do
expect(subject.packed_ipv4).to eq(IPAddr.new('93.184.216.34').hton)
expect(subject.packed_ipv4).to eq(ipaddr.hton)
end

context "when given the `negate: true` keyword argument" do
it "must invert the bits of the packed IPv4 address" do
expect(subject.packed_ipv4(negate: true)).to eq(
(~IPAddr.new('93.184.216.34')).hton
)
expect(subject.packed_ipv4(negate: true)).to eq((~ipaddr).hton)
end
end
end
Expand Down Expand Up @@ -78,19 +80,17 @@ class TestReverseShell < Ronin::Payloads::Shellcode::ReverseShellPayload

describe "#packed_ipv6" do
context "when the 'host' param has an IPv6 address" do
let(:host) { 'icann.org' }
let(:host) { 'icann.org' }
let(:address) { '2001:500:88:200::7' }
let(:ipaddr) { IPAddr.new(address) }

it "must return the packed IPv6 address in network byte-order" do
expect(subject.packed_ipv6).to eq(
IPAddr.new('2001:500:88:200::7').hton
)
expect(subject.packed_ipv6).to eq(ipaddr.hton)
end

context "when given the `negate: true` keyword argument" do
it "must invert the bits of the packed IPv4 address" do
expect(subject.packed_ipv6(negate: true)).to eq(
(~IPAddr.new('2001:500:88:200::7')).hton
)
expect(subject.packed_ipv6(negate: true)).to eq((~ipaddr).hton)
end
end
end
Expand Down

0 comments on commit 5221cd8

Please sign in to comment.