Skip to content

Instantly share code, notes, and snippets.

@picatz
Created November 5, 2016 20:57
Show Gist options
  • Save picatz/92cb1147c636d1674a116362a994aa40 to your computer and use it in GitHub Desktop.
Save picatz/92cb1147c636d1674a116362a994aa40 to your computer and use it in GitHub Desktop.
A sample of how to use packetfu to capture traffic and parse packets to get a basic, readable summary in the terminal.
require 'packetfu'
# iface becomes the default routeable interface
iface = PacketFu::Utils.default_int
# cap starts capturing packets on iface
cap = PacketFu::Capture.new(:iface => iface, :start => true)
# will parse packets providing summary data of packet contents
cap.stream.each do | packet |
puts PacketFu::Packet.parse(packet).peek
end
# => example output ...
# T 126 10.0.0.2:49889 -> 10.0.0.5:443 [.AP...] S:d59c8b78|I:897c
# T 66 10.0.0.2:49889 -> 10.0.0.5:443 [.A....] S:d59c8bb4|I:f283
# T 54 10.0.0.2:50403 -> 10.0.0.33:443 [.A....] S:f4867c6e|I:b0e3
# T 66 10.0.0.33:443 -> 10.0.0.2:50403 [.A....] S:7db40753|I:6a1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment