Class: PacketFu::IPv6Packet
- Includes:
- EthHeaderMixin, IPv6HeaderMixin
- Defined in:
- lib/packetfu/protos/ipv6.rb
Overview
IPv6Packet is used to construct IPv6 Packets. They contain an EthHeader and an IPv6Header, and in the distant, unknowable future, will take interesting IPv6ish payloads.
This mostly complete, but not very useful. It’s intended primarily as an example protocol.
Parameters
:eth
A pre-generated EthHeader object.
:ip
A pre-generated IPHeader object.
:flavor
TODO: Sets the "flavor" of the IPv6 packet. No idea what this will look like, haven't done much IPv6 fingerprinting.
:config
A hash of return address details, often the output of Utils.whoami?
Instance Attribute Summary collapse
-
#eth_header ⇒ Object
Returns the value of attribute eth_header.
-
#ipv6_header ⇒ Object
Returns the value of attribute ipv6_header.
Attributes inherited from Packet
#flavor, #headers, #iface, #inspect_style
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ IPv6Packet
constructor
A new instance of IPv6Packet.
-
#peek(args = {}) ⇒ Object
Peek provides summary data on packet contents.
Methods included from IPv6HeaderMixin
#ipv6?, #ipv6_calc_len, #ipv6_calc_sum_on_addr, #ipv6_class, #ipv6_class=, #ipv6_daddr, #ipv6_daddr=, #ipv6_dst, #ipv6_dst=, #ipv6_dst_readable, #ipv6_hop, #ipv6_hop=, #ipv6_label, #ipv6_label=, #ipv6_len, #ipv6_len=, #ipv6_next, #ipv6_next=, #ipv6_recalc, #ipv6_saddr, #ipv6_saddr=, #ipv6_src, #ipv6_src=, #ipv6_src_readable, #ipv6_v, #ipv6_v=
Methods included from EthHeaderMixin
#eth_daddr, #eth_daddr=, #eth_dst, #eth_dst=, #eth_dst_readable, #eth_proto, #eth_proto=, #eth_proto_readable, #eth_saddr, #eth_saddr=, #eth_src, #eth_src=, #eth_src_readable
Methods inherited from Packet
#==, #clone, #dissect, #dissection_table, force_binary, #handle_is_identity, #hexify, inherited, #inspect, #inspect_hex, #kind_of?, #layer, layer, #layer_symbol, layer_symbol, #method_missing, #orig_kind_of?, parse, #payload, #payload=, #peek_format, #proto, #read, #recalc, #respond_to?, #size, #to_f, #to_pcap, #to_s, #to_w, #write
Constructor Details
#initialize(args = {}) ⇒ IPv6Packet
Returns a new instance of IPv6Packet.
37 38 39 40 41 42 43 44 |
# File 'lib/packetfu/protos/ipv6.rb', line 37 def initialize(args={}) @eth_header = (args[:eth] || EthHeader.new) @ipv6_header = (args[:ipv6] || IPv6Header.new) @eth_header.eth_proto = 0x86dd @eth_header.body=@ipv6_header @headers = [@eth_header, @ipv6_header] super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PacketFu::Packet
Instance Attribute Details
#eth_header ⇒ Object
Returns the value of attribute eth_header.
28 29 30 |
# File 'lib/packetfu/protos/ipv6.rb', line 28 def eth_header @eth_header end |
#ipv6_header ⇒ Object
Returns the value of attribute ipv6_header.
28 29 30 |
# File 'lib/packetfu/protos/ipv6.rb', line 28 def ipv6_header @ipv6_header end |
Class Method Details
.can_parse?(str) ⇒ Boolean
30 31 32 33 34 35 |
# File 'lib/packetfu/protos/ipv6.rb', line 30 def self.can_parse?(str) return false unless EthPacket.can_parse? str return false unless str.size >= 54 return false unless str[12,2] == "\x86\xdd" true end |
Instance Method Details
#peek(args = {}) ⇒ Object
Peek provides summary data on packet contents.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/packetfu/protos/ipv6.rb', line 47 def peek(args={}) peek_data = ["6 "] peek_data << "%-5d" % self.to_s.size peek_data << "%-31s" % self.ipv6_saddr peek_data << "-> " peek_data << "%-31s" % self.ipv6_daddr peek_data << " N:" peek_data << self.ipv6_next.to_s(16) peek_data.join end |