mahdooglej

Untitled

Feb 8th, 2019
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.44 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'packetfu'
  4. require 'pry'
  5.  
  6. # iface becomes the default routeable interface
  7. #iface = PacketFu::Utils.default_int
  8. iface = "lo"
  9.  
  10. # cap starts capturing packets on iface
  11. cap = PacketFu::Capture.new(:iface => iface, :start => true)
  12. cap.bpf(:filter => "icmp")
  13. # will parse packets providing summary data of packet contents
  14. cap.stream.each do | packet |
  15.   binding.pry
  16.   puts PacketFu::Packet.parse(packet).peek
  17. end
Advertisement