1PKT(3) pkt 1.4 PKT(3)
2
3
4
6 packet.pkt - Pkt module
7
9 Provides the object for a packet and the string representation of the
10 packet. This object has an attribute for each of the layers in the
11 packet so each layer can be accessed directly instead of going through
12 each layer. To access the nfs layer object you can use 'x.nfs' instead
13 of using 'x.ethernet.ip.tcp.rpc.nfs' which would be very cumbersome to
14 use. Also, since NFS can be used with either TCP or UDP it would be
15 harder to access the nfs object independently of the protocol.
16
17 Packet object attributes:
18 Pkt(
19 record = Record information (frame number, etc.)
20 ethernet = ETHERNET II (RFC 894) object
21 ip = IPv4 object
22 tcp = TCP object
23 rpc = RPC object
24 nfs = NFS object
25 )
26
28 class Pkt(baseobj.BaseObj)
29 Packet object
30
31 Usage:
32 from packet.pkt import Pkt
33
34 x = Pkt()
35
36 # Check if this is an NFS packet
37 if x == 'nfs':
38 print x.nfs
39
40
41 Methods defined here:
42 ---------------------
43
44 __eq__(self, other)
45 Comparison method used to determine if object has a given layer
46
47 __init__(self)
48 Constructor
49
50 Initialize object's private data according to the arguments given.
51 Arguments can be given as positional, named arguments or a
52 combination of both.
53
54 __ne__(self, other)
55 Comparison method used to determine if object does not have a given layer
56
57 __repr__(self)
58 Formal string representation of packet object
59
60 __str__(self)
61 String representation of object
62
63 The representation depends on the verbose level set by debug_repr().
64 If set to 0 the generic object representation is returned.
65 If set to 1 the representation of is condensed into a single line.
66 It contains, the frame number, IP source and destination and/or the
67 last layer:
68 '1 0.386615 192.168.0.62 -> 192.168.0.17 TCP 2049 -> 708, seq: 3395733180, ack: 3294169773, ACK,SYN'
69 '5 0.530957 00:0c:29:54:09:ef -> ff:ff:ff:ff:ff:ff, type: 0x806'
70 '19 0.434370 192.168.0.17 -> 192.168.0.62 NFS v4 COMPOUND4 call SEQUENCE;PUTFH;GETATTR'
71
72 If set to 2 the representation of the object is a line for each layer:
73 'Pkt(
74 RECORD: frame 19 @ 0.434370 secs, 238 bytes on wire, 238 bytes captured
75 ETHERNET: 00:0c:29:54:09:ef -> e4:ce:8f:58:9f:f4, type: 0x800(IPv4)
76 IP: 192.168.0.17 -> 192.168.0.62, protocol: 6(TCP), len: 224
77 TCP: src port 708 -> dst port 2049, seq: 3294170673, ack: 3395734137, len: 172, flags: ACK,PSH
78 RPC: CALL(0), program: 100003, version: 4, procedure: 1, xid: 0x1437d3d5
79 NFS: COMPOUND4args(tag='', minorversion=1, argarray=[nfs_argop4(argop=OP_SEQUENCE, ...), ...])
80 )'
81
82 add_layer(self, name, layer)
83 Add layer to name and object to the packet
84
85 get_layers(self)
86 Return the list of layers currently in the packet
87
89 baseobj(3)
90
91
93 No known bugs.
94
96 Jorge Mora (mora@netapp.com)
97
98
99
100NFStest 3.2 21 March 2023 PKT(3)