netzob.Import.PCAPImporter package¶
Submodules¶
netzob.Import.PCAPImporter.ImpactDecoder module¶
-
class
IPDecoderForICMP
[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactDecoder.Decoder
This class was added to parse the IP header of ICMP unreachables packets If you use the “standard” IPDecoder, it might crash (see bug #4870) ImpactPacket.py because the TCP header inside the IP header is incomplete
netzob.Import.PCAPImporter.ImpactPacket module¶
-
class
Data
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
This packet type can hold raw data. It’s normally employed to hold a packet’s innermost layer’s contents in those cases for which the protocol details are unknown, and there’s a copy of a valid packet available.
For instance, if all that’s known about a certain protocol is that a UDP packet with its contents set to “HELLO” initiate a new session, creating such packet is as simple as in the following code fragment: packet = UDP() packet.contains(‘HELLO’)
-
class
Ethernet
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
-
get_tag
(index)[source]¶ Returns an EthernetTag initialized from index-th VLAN tag. The tags are numbered from 0 to self.tag_cnt-1 as they appear in the frame. It is possible to use negative indexes as well.
-
pop_tag
(index=0)[source]¶ Removes the index-th VLAN tag and returns it as an EthernetTag object. Index defaults to 0 (the top of the stack).
-
-
class
EthernetTag
(value=2164260864)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.PacketBuffer
Represents a VLAN header specified in IEEE 802.1Q and 802.1ad. Provides methods for convenient manipulation with header fields.
-
class
Header
(length=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.PacketBuffer
,netzob.Import.PCAPImporter.ImpactPacket.ProtocolLayer
This is the base class from which all protocol definitions extend.
-
ethertype
= None¶
-
get_header_size
()[source]¶ Return the size of this header, that is, not counting neither the size of the children nor of the parents.
-
get_packet
()[source]¶ Returns the raw representation of this packet and its children as a string. The output from this method is a packet ready to be transmitted over the wire.
-
get_pseudo_header
()[source]¶ Pseudo headers can be used to limit over what content will the checksums be calculated.
-
load_header
(aBuffer)[source]¶ Properly set the state of this instance to reflect that of the raw packet passed as argument.
-
packet_printable
= '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '¶
-
protocol
= None¶
-
-
class
ICMP
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
-
ICMP_UNREACH
= 3¶
-
protocol
= 1¶
-
-
class
IP
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
-
ethertype
= 2048¶
-
-
class
IPOption
(opcode=0, size=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.PacketBuffer
-
IPOPT_EOL
= 0¶
-
IPOPT_LSRR
= 131¶
-
IPOPT_NOP
= 1¶
-
IPOPT_RR
= 7¶
-
IPOPT_SSRR
= 137¶
-
IPOPT_TS
= 68¶
-
-
class
LinuxSLL
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
-
type_descriptions
= ['sent to us by somebody else', 'broadcast by somebody else', 'multicast by somebody else', 'sent to somebody else to somebody else', 'sent by us']¶
-
-
class
PacketBuffer
(length=None)[source]¶ Bases:
object
Implement the basic operations utilized to operate on a packet’s raw buffer. All the packet classes derive from this one.
The byte, word, long and ip_address getters and setters accept negative indexes, having these the a similar effect as in a regular Python sequence slice.
-
compute_checksum
(anArray)[source]¶ Return the one’s complement of the one’s complement sum of all the 16-bit words in ‘anArray’
-
get_long
(index, order='!')[source]¶ Return 4-byte value at ‘index’. See struct module’s documentation to understand the meaning of ‘order’.
-
get_long_long
(index, order='!')[source]¶ Return 8-byte value at ‘index’. See struct module’s documentation to understand the meaning of ‘order’.
-
get_word
(index, order='!')[source]¶ Return 2-byte word at ‘index’. See struct module’s documentation to understand the meaning of ‘order’.
-
set_checksum_from_data
(index, data)[source]¶ Set 16-bit checksum at ‘index’ by calculating checksum of ‘data’
-
set_long
(index, value, order='!')[source]¶ Set 4-byte ‘value’ at ‘index’. See struct module’s documentation to understand the meaning of ‘order’.
-
-
class
ProtocolLayer
[source]¶ Bases:
object
Protocol Layer Manager for insertion and removal of protocol layers.
-
class
ProtocolPacket
(header_size, tail_size)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.ProtocolLayer
-
body
¶
-
body_string
¶
-
header
¶
-
load_body
(aBuffer)[source]¶ Load the packet body from string. WARNING: Using this function will break the hierarchy of preceding protocol layer
-
load_packet
(aBuffer)[source]¶ Load the whole packet from a stringWARNING: Using this function will break the hierarchy of preceding protocol layer
-
tail
¶
-
tail_string
¶
-
-
class
TCP
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
-
TCP_FLAGS_MASK
= 255¶
-
get_packet
()[source]¶ Returns entire packet including child data as a string. This is the function used to extract the final packet
-
protocol
= 6¶
-
-
class
TCPOption
(kind, data=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.PacketBuffer
-
TCPOPT_EOL
= 0¶
-
TCPOPT_MAXSEG
= 2¶
-
TCPOPT_NOP
= 1¶
-
TCPOPT_SACK
= 5¶
-
TCPOPT_SACK_PERMITTED
= 4¶
-
TCPOPT_SIGNATURE
= 19¶
-
TCPOPT_TIMESTAMP
= 8¶
-
TCPOPT_WINDOW
= 3¶
-
-
class
UDP
(aBuffer=None)[source]¶ Bases:
netzob.Import.PCAPImporter.ImpactPacket.Header
-
protocol
= 17¶
-