### Home Classes Methods

### In Files

- lib/packetfu/pcap.rb

### Parent

Object

### Methods

- ::f2a
- ::file_to_array
- ::get_byte_order
- ::set_byte_order

### Files

- .document
- README.rdoc

### Class/Module Index

Quicksearch

- PacketFu
- PacketFu::ARPHeader
- PacketFu::ARPHeaderMixin
- PacketFu::ARPPacket
- PacketFu::AddrIpv6
- PacketFu::Capture
- PacketFu::Config
- PacketFu::EthHeader
- PacketFu::EthHeaderMixin
- PacketFu::EthMac
- PacketFu::EthNic
- PacketFu::EthOui
- PacketFu::EthPacket
- PacketFu::HSRPHeader
- PacketFu::HSRPHeaderMixin
- PacketFu::HSRPPacket
- PacketFu::ICMPHeader
- PacketFu::ICMPHeaderMixin
- PacketFu::ICMPPacket
- PacketFu::IPHeader
- PacketFu::IPHeaderMixin
- PacketFu::IPPacket
- PacketFu::IPv6Header
- PacketFu::IPv6HeaderMixin
- PacketFu::IPv6Packet
- PacketFu::Inject
- PacketFu::InvalidHeader
- PacketFu::InvalidPacket
- PacketFu::LLDPHeader
- PacketFu::LLDPHeaderMixin
- PacketFu::LLDPPacket
- PacketFu::Octets
- PacketFu::Packet
- PacketFu::PcapFile
- PacketFu::PcapHeader
- PacketFu::PcapPacket
- PacketFu::PcapPackets
- PacketFu::Read
- PacketFu::TCPHeader
- PacketFu::TCPHeaderMixin
- PacketFu::TCPPacket
- PacketFu::TcpEcn
- PacketFu::TcpFlags
- PacketFu::TcpHlen
- PacketFu::TcpOption
- PacketFu::TcpOption::ECHO
- PacketFu::TcpOption::ECHOREPLY
- PacketFu::TcpOption::EOL
- PacketFu::TcpOption::MSS
- PacketFu::TcpOption::NOP
- PacketFu::TcpOption::SACK
- PacketFu::TcpOption::SACKOK
- PacketFu::TcpOption::TS
- PacketFu::TcpOption::WS
- PacketFu::TcpOptions
- PacketFu::TcpReserved
- PacketFu::Timestamp
- PacketFu::UDPHeader
- PacketFu::UDPHeaderMixin
- PacketFu::UDPPacket
- PacketFu::Utils
- PacketFu::Write
- StructFu
- StructFu::Int
- StructFu::Int16
- StructFu::Int16be
- StructFu::Int16le
- StructFu::Int32
- StructFu::Int32be
- StructFu::Int32le
- StructFu::Int8
- StructFu::IntString
- StructFu::String
- Struct

No matching classes.

# PacketFu::Read

Read is largely deprecated. It was current in PacketFu 0.2.0, but isn't all that useful in 0.3.0 and beyond. Expect it to go away completely by version 1.0. So, the main use of this class is to learn how to do exactly the same things using the PcapFile object.

### Public Class Methods

f2a(args={}) click to toggle source
Alias for: file_to_array
file_to_array(args={}) click to toggle source

A wrapper for PcapFile#file_to_array, but only returns the array. Actually using the PcapFile object is going to be more useful.

    # File lib/packetfu/pcap.rb, line 532
    def file_to_array(args={})
      filename = args[:filename] || args[:file] || args[:out]
      raise ArgumentError, "Need a :filename in string form to read from." if (filename.nil? || filename.class != String)
      PcapFile.new.file_to_array(args)
    end

Also aliased as: f2a
get_byte_order(pcap_file) click to toggle source

Reads the magic string of a pcap file, and determines if it's :little or :big endian.

    # File lib/packetfu/pcap.rb, line 519
    def get_byte_order(pcap_file)
      byte_order = ((pcap_file[0,4] == PcapHeader::MAGIC_LITTLE) ? :little : :big)
      return byte_order
    end

set_byte_order(byte_order) click to toggle source

set_byte_order is pretty much totally deprecated.

    # File lib/packetfu/pcap.rb, line 525
    def set_byte_order(byte_order)
      PacketFu.instance_variable_set(:@byte_order,byte_order)
      return true
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.