File: ethernet.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 (16 lines) | stat: -rw-r--r-- 451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: binary -*-

# Usage:
# ruby examples/ethernet.rb

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

eth_pkt = PacketFu::EthPacket.new
eth_pkt.eth_saddr="01:02:03:04:05:06"
eth_pkt.eth_daddr="0a:0b:0c:0d:0e:0f"
eth_pkt.payload="I'm a lonely little eth packet with no real protocol information to speak of."
eth_pkt.recalc
puts eth_pkt.inspect
puts eth_pkt.to_f('/tmp/ethernet.pcap').inspect