Class: PacketFu::InvalidPacket

Inherits:
Packet
  • Object
show all
Defined in:
lib/packetfu/protos/invalid.rb

Overview

You probably don't want to write invalid packets on purpose.

Instance Attribute Summary collapse

Attributes inherited from Packet

#flavor, #headers, #iface, #inspect_style

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Packet

#==, #clone, #dissect, #dissection_table, force_binary, #handle_is_identity, #hexify, inherited, #inspect, #inspect_hex, #kind_of?, #layer, layer_symbol, #layer_symbol, #method_missing, #orig_kind_of?, parse, #payload, #payload=, #peek, #peek_format, #proto, #recalc, #respond_to?, #size, #to_f, #to_pcap, #to_s, #to_w, #write

Constructor Details

#initialize(args = {}) ⇒ InvalidPacket

Returns a new instance of InvalidPacket


48
49
50
51
# File 'lib/packetfu/protos/invalid.rb', line 48

def initialize(args={})
  @invalid_header = 	(args[:invalid] || InvalidHeader.new)
  @headers = [@invalid_header]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PacketFu::Packet

Instance Attribute Details

#invalid_headerObject

Returns the value of attribute invalid_header


32
33
34
# File 'lib/packetfu/protos/invalid.rb', line 32

def invalid_header
  @invalid_header
end

Class Method Details

.can_parse?(str) ⇒ Boolean

Any packet is potentially an invalid packet

Returns:

  • (Boolean)

35
36
37
# File 'lib/packetfu/protos/invalid.rb', line 35

def self.can_parse?(str)
  true
end

.layerObject


39
40
41
# File 'lib/packetfu/protos/invalid.rb', line 39

def self.layer
  0
end

Instance Method Details

#read(str = nil, args = {}) ⇒ Object


43
44
45
46
# File 'lib/packetfu/protos/invalid.rb', line 43

def read(str=nil,args={})
  @invalid_header.read(str)
  self
end