scapy.contrib.stamp

STAMP (Simple Two-Way Active Measurement Protocol) - RFC 8762.

References

class scapy.contrib.stamp.ErrorEstimate(_pkt, /, *, S=0, Z=0, scale=0, multiplier=1)[source]

Bases: Packet

The Error Estimate specifies the estimate of the error and synchronization. The format of the Error Estimate field (defined in Section 4.1.2 of RFC 4656) is reported below:

0                   1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|S|Z|   Scale   |   Multiplier  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

S is interpreted as follows:

Value

Description

0

there is no notion of external synchronization for the time source

1

the party generating the timestamp has a clock that is synchronized to UTC using an external source

Z is interpreted as follows (defined in Section 2.3 of RFC 8186):

Value

Description

0

NTP 64-bit format of a timestamp

1

PTPv2 truncated format of a timestamp

Scale and Multiplier are linked by the following relationship:

ErrorEstimate = Multiplier*2^(-32)*2^Scale (in seconds)

References

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|S|Z|   SCALE   |   MULTIPLIER  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. ErrorEstimate                        
ErrorEstimate fields

S

BitEnumField

0

Z

BitEnumField

0

scale

BitField (6 bits)

0

multiplier

ByteField

1

guess_payload_class(payload: str) Packet_metaclass[source]
class scapy.contrib.stamp.STAMPSessionReflectorTestUnauthenticated(_pkt, /, *, seq=0, ts=None, err_estimate=<ErrorEstimate  |>, ssid=1, ts_rx=None, seq_sender=0, ts_sender=None, err_estimate_sender=<ErrorEstimate  |>, mbz1=0, ttl_sender=255, mbz2=0, tlv_objects=[])[source]

Bases: Packet

Extended STAMP Session-Reflector Test Packet in Unauthenticated Mode.

The format (defined in Section 3 of RFC 8972) is shown below:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Timestamp                            |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Error Estimate        |           SSID                |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Receive Timestamp                    |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                 Session-Sender Sequence Number                |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  Session-Sender Timestamp                     |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Session-Sender Error Estimate |           MBZ                 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ses-Sender TTL |                   MBZ                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                            TLVs                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

References

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              SEQ                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               TS                              |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          ERR ESTIMATE         |              SSID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             TS RX                             |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           SEQ SENDER                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           TS SENDER                           |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      ERR ESTIMATE SENDER      |              MBZ1             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   TTL SENDER  |                      MBZ2                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          TLV OBJECTS          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

          Fig. STAMPSessionReflectorTestUnauthenticated           
STAMPSessionReflectorTestUnauthenticated fields

seq

IntField

0

ts

MultipleTypeField (TimeStampField, UTCTimeField)

0

err_estimate

PacketField

<ErrorEstimate  |>

ssid

ShortField

1

ts_rx

MultipleTypeField (TimeStampField, UTCTimeField)

0

seq_sender

IntField

0

ts_sender

MultipleTypeField (TimeStampField, UTCTimeField)

0

err_estimate_sender

PacketField

<ErrorEstimate  |>

mbz1

ShortField

0

ttl_sender

ByteField

255

mbz2

NBytesField

0

tlv_objects

PacketListField

[]

class scapy.contrib.stamp.STAMPSessionSenderTestUnauthenticated(_pkt, /, *, seq=0, ts=None, err_estimate=<ErrorEstimate  |>, ssid=1, mbz=0, tlv_objects=[])[source]

Bases: Packet

Extended STAMP Session-Sender Test Packet in Unauthenticated Mode.

The format (defined in Section 3 of RFC 8972) is shown below:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          Timestamp                            |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Error Estimate        |             SSID              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                                                               |
|                         MBZ (28 octets)                       |
|                                                               |
|                                                               |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                            TLVs                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

References

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              SEQ                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                               TS                              |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          ERR ESTIMATE         |              SSID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              MBZ                              |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          TLV OBJECTS          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

            Fig. STAMPSessionSenderTestUnauthenticated            
STAMPSessionSenderTestUnauthenticated fields

seq

IntField

0

ts

MultipleTypeField (TimeStampField, UTCTimeField)

0

err_estimate

PacketField

<ErrorEstimate  |>

ssid

ShortField

1

mbz

NBytesField

0

tlv_objects

PacketListField

[]

class scapy.contrib.stamp.STAMPTestTLV(_pkt, /, *, flags=<Flag 0 ()>, type=None, len=0, value=b'')[source]

Bases: Packet

The STAMP Test TLV defined in Section 4 of [RFC 8972] provides a flexible extension mechanism for optional informational elements.

The TLV Format in a STAMP Test packet is reported below:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|STAMP TLV Flags|     Type      |           Length              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                            Value                              ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Field

Description

STAMP TLV Flags

8-bit field; for the details about the STAMP TLV Flags Format, see RFC 8972

Type

characterizes the interpretation of the Value field

Length

the length of the Value field in octets

Value

interpreted according to the value of the Type field

References

aliastypes
classmethod dispatch_hook(pkt=None, *args, **kargs)[source]
extract_padding(p)[source]
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     FLAGS     |      TYPE     |              LEN              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             VALUE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. STAMPTestTLV                         
STAMPTestTLV fields

flags

FlagsField

<Flag 0 ()>

type

ByteEnumField

None

len

ShortField

0

value

StrLenField

b''

classmethod register_variant()[source]
registered_stamp_tlv = {None: <class 'scapy.contrib.stamp.STAMPTestTLV'>}