Class: Nmunch::Dissectors::Base
- Inherits:
-
Object
- Object
- Nmunch::Dissectors::Base
- Defined in:
- lib/nmunch/dissectors/base.rb
Overview
Public: Base dissector class
Instance Attribute Summary collapse
-
#pcap_packet ⇒ Object
readonly
Returns the value of attribute pcap_packet.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Class Method Summary collapse
-
.factory(pcap_packet) ⇒ Object
Public: Dissector factory.
Instance Method Summary collapse
-
#initialize(pcap_packet) ⇒ Base
constructor
Public: Initializer.
Constructor Details
#initialize(pcap_packet) ⇒ Base
Public: Initializer
pcap_packet - An instance of Pcap::Packet
Stores the packet and extracts to raw packet data in a way that makes it easy to dissect
Returns nothing
16 17 18 19 |
# File 'lib/nmunch/dissectors/base.rb', line 16 def initialize(pcap_packet) @pcap_packet = pcap_packet extract_raw_packet_data end |
Instance Attribute Details
#pcap_packet ⇒ Object (readonly)
Returns the value of attribute pcap_packet.
6 7 8 |
# File 'lib/nmunch/dissectors/base.rb', line 6 def pcap_packet @pcap_packet end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
6 7 8 |
# File 'lib/nmunch/dissectors/base.rb', line 6 def raw_data @raw_data end |
Class Method Details
.factory(pcap_packet) ⇒ Object
Public: Dissector factory
pcap_packet - An instance of Pcap::Packet
Returns an instance of a dissector
26 27 28 29 30 31 32 |
# File 'lib/nmunch/dissectors/base.rb', line 26 def self.factory(pcap_packet) if pcap_packet.ip? Nmunch::Dissectors::Ip.new(pcap_packet) else Nmunch::Dissectors::Arp.new(pcap_packet) end end |