From 51680b6ebb645d37ebdfcd122ca163b3a638aefa Mon Sep 17 00:00:00 2001 From: Tails developers Date: Fri, 19 Dec 2014 00:40:08 +0100 Subject: files copied from https://git-tails.immerda.ch/tails - many thanks to the tails developers for their nice work and documentation of it - these files have been released under the GNU General Public License version 3 or (at your option) any later version features/images has been omitted --- features/step_definitions/dhcp.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 features/step_definitions/dhcp.rb (limited to 'features/step_definitions/dhcp.rb') diff --git a/features/step_definitions/dhcp.rb b/features/step_definitions/dhcp.rb new file mode 100644 index 00000000..78ee8f2d --- /dev/null +++ b/features/step_definitions/dhcp.rb @@ -0,0 +1,20 @@ +Then /^the hostname should not have been leaked on the network$/ do + next if @skip_steps_while_restoring_background + 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 + 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 -- cgit v1.2.3-54-g00ecf