Class: PacketFu::InvalidPacket
- Defined in:
- lib/packetfu/protos/invalid.rb
Overview
You probably don’t want to write invalid packets on purpose.
Instance Attribute Summary collapse
-
#invalid_header ⇒ Object
Returns the value of attribute invalid_header.
Attributes inherited from Packet
#flavor, #headers, #iface, #inspect_style
Class Method Summary collapse
-
.can_parse?(str) ⇒ Boolean
Any packet is potentially an invalid packet.
- .layer ⇒ Object
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ InvalidPacket
constructor
A new instance of InvalidPacket.
- #read(str = nil, args = {}) ⇒ Object
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_header ⇒ Object
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
35 36 37 |
# File 'lib/packetfu/protos/invalid.rb', line 35 def self.can_parse?(str) true end |
.layer ⇒ Object
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 |