File: dissect_thinger.rb

package info (click to toggle)
ruby-packetfu 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,520 kB
  • sloc: ruby: 8,344; makefile: 2
file content (26 lines) | stat: -rwxr-xr-x 600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env ruby
# -*- coding: binary -*-
# This just allows you to eyeball the dissection stuff to make sure it's all right.

# Usage:
# ruby examples/ethernet.rb

# Path setting slight of hand:
$: << File.expand_path("../../lib", __FILE__)
require 'packetfu'
include PacketFu

fname = ARGV[0] || "test/sample.pcap"
sleep_interval = ARGV[1] || 1

puts "Loaded: PacketFu v#{PacketFu.version}"

packets = PacketFu::PcapFile.file_to_array fname
packets.each do |packet|
  puts "_" * 75
  puts packet.inspect
  puts "_" * 75
  pkt = Packet.parse(packet)
  puts pkt.dissect
  sleep sleep_interval
end