Class PacketFu::IPPacket
In: lib/packetfu/ip.rb
Parent: Packet

IPPacket is used to construct IP packets. They contain an EthHeader, an IPHeader, and usually a transport-layer protocol such as UDPHeader, TCPHeader, or ICMPHeader.

Example

  require 'packetfu'
  ip_pkt = PacketFu::IPPacket.new
  ip_pkt.ip_saddr="10.20.30.40"
  ip_pkt.ip_daddr="192.168.1.1"
  ip_pkt.ip_proto=1
  ip_pkt.ip_ttl=64
  ip_pkt.ip_payload="\x00\x00\x12\x34\x00\x01\x00\x01"+
    "Lovingly hand-crafted echo responses delivered directly to your door."
  ip_pkt.recalc
  ip_pkt.to_f('/tmp/ip.pcap')

Parameters

  :eth
    A pre-generated EthHeader object.
  :ip
    A pre-generated IPHeader object.
  :flavor
    TODO: Sets the "flavor" of the IP packet. This might include known sets of IP options, and
    certainly known starting TTLs.
  :config
    A hash of return address details, often the output of Utils.whoami?

Methods

new   peek  

Attributes

eth_header  [RW] 
ip_header  [RW] 

Public Class methods

Creates a new IPPacket object.

Public Instance methods

Peek provides summary data on packet contents.

[Validate]