diff options
Diffstat (limited to 'cucumber/features/step_definitions/dhcp.rb')
-rw-r--r-- | cucumber/features/step_definitions/dhcp.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cucumber/features/step_definitions/dhcp.rb b/cucumber/features/step_definitions/dhcp.rb new file mode 100644 index 00000000..ef4d9e15 --- /dev/null +++ b/cucumber/features/step_definitions/dhcp.rb @@ -0,0 +1,19 @@ +Then /^the hostname should not have been leaked on the network$/ do + hostname = $vm.execute("hostname").stdout.chomp + packets = PacketFu::PcapFile.new.file_to_array(:filename => @sniffer.pcap_file) + packets.each do |p| + # if PacketFu::TCPPacket.can_parse?(p) + # ipv4_tcp_packets << PacketFu::TCPPacket.parse(p) + if PacketFu::IPPacket.can_parse?(p) + payload = PacketFu::IPPacket.parse(p).payload + elsif PacketFu::IPv6Packet.can_parse?(p) + payload = PacketFu::IPv6Packet.parse(p).payload + else + @sniffer.save_pcap_file + raise "Found something in the pcap file that either is non-IP, or cannot be parsed" + end + if payload.match(hostname) + raise "Hostname leak detected" + end + end +end |