classPkt(baseobj.BaseObj)
Packet object
Usage:
from packet.pkt import Pkt
x = Pkt()
# Check if this is an NFS packet
if x == 'nfs':
print x.nfs
Methodsdefinedhere:
---------------------
__eq__(self,other)
Comparison method used to determine if object has a given layer
__init__(self)
Constructor
Initialize object's private data according to the arguments given.
Arguments can be given as positional, named arguments or a
combination of both.
__ne__(self,other)
Comparison method used to determine if object does not have a given layer
__repr__(self)
Formal string representation of packet object
__str__(self)
String representation of object
The representation depends on the verbose level set by debug_repr().
If set to 0 the generic object representation is returned.
If set to 1 the representation of is condensed into a single line.
It contains, the frame number, IP source and destination and/or the
last layer:
'1 0.386615 192.168.0.62 -> 192.168.0.17 TCP 2049 -> 708, seq: 3395733180, ack: 3294169773, ACK,SYN'
'5 0.530957 00:0c:29:54:09:ef -> ff:ff:ff:ff:ff:ff, type: 0x806'
'19 0.434370 192.168.0.17 -> 192.168.0.62 NFS v4 COMPOUND4 call SEQUENCE;PUTFH;GETATTR'
If set to 2 the representation of the object is a line for each layer:
'Pkt(
RECORD: frame 19 @ 0.434370 secs, 238 bytes on wire, 238 bytes captured
ETHERNET: 00:0c:29:54:09:ef -> e4:ce:8f:58:9f:f4, type: 0x800(IPv4)
IP: 192.168.0.17 -> 192.168.0.62, protocol: 6(TCP), len: 224
TCP: src port 708 -> dst port 2049, seq: 3294170673, ack: 3395734137, len: 172, flags: ACK,PSH
RPC: CALL(0), program: 100003, version: 4, procedure: 1, xid: 0x1437d3d5
NFS: COMPOUND4args(tag='', minorversion=1, argarray=[nfs_argop4(argop=OP_SEQUENCE, ...), ...])
)'
add_layer(self,name,layer)
Add layer to name and object to the packet
get_layers(self)
Return the list of layers currently in the packet