scapy.contrib.stun

STUN (RFC 8489)

TLV code derived from the DTP implementation:
Thanks to Nicolas Bareil,

Arnaud Ebalard, Jochen Bartl.

class scapy.contrib.stun.STUN(_pkt, /, *, RESERVED=0, stun_message_type=None, length=None, magic_cookie=554869826, transaction_id=None, attributes=[])[source]

Bases: Packet

aliastypes = [<class 'scapy.contrib.stun.STUN'>, <class 'scapy.packet.Packet'>]
description = ''
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<BitField (STUN).RESERVED>, <BitEnumField (STUN).stun_message_type>, <LenField (STUN).length>, <XIntField (STUN).magic_cookie>, <XBitField (STUN).transaction_id>, <PacketListField (STUN).attributes>]
post_build(pkt, pay)[source]
class scapy.contrib.stun.STUNFingerprint(_pkt, /, *, type=32808, length=4, crc_32=None)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNFingerprint'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNFingerprint).type>, <ShortField (STUNFingerprint).length>, <XIntField (STUNFingerprint).crc_32>]
class scapy.contrib.stun.STUNGenericTlv(_pkt, /, *, type=0, length=None, value=b'')[source]

Bases: Packet

aliastypes = [<class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
classmethod dispatch_hook(_pkt=None, *args, **kwargs)[source]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNGenericTlv).type>, <FieldLenField (STUNGenericTlv).length>, <scapy.fields.PadField object>]
guess_payload_class(payload)[source]
class scapy.contrib.stun.STUNGoogNetworkInfo(_pkt, /, *, type=49239, length=4, network_id=0, network_cost=999)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNGoogNetworkInfo'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNGoogNetworkInfo).type>, <ShortField (STUNGoogNetworkInfo).length>, <ShortField (STUNGoogNetworkInfo).network_id>, <ShortField (STUNGoogNetworkInfo).network_cost>]
class scapy.contrib.stun.STUNIceControlling(_pkt, /, *, type=32810, length=8, tie_breaker=None)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNIceControlling'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNIceControlling).type>, <ShortField (STUNIceControlling).length>, <XLongField (STUNIceControlling).tie_breaker>]
class scapy.contrib.stun.STUNMappedAddress(_pkt, /, *, type=1, length=None, RESERVED=0, address_family=1, port=0, ip=None)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNMappedAddress'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNMappedAddress).type>, <FieldLenField (STUNMappedAddress).length>, <ByteField (STUNMappedAddress).RESERVED>, <ByteEnumField (STUNMappedAddress).address_family>, <ShortField (STUNMappedAddress).port>, <scapy.fields.MultipleTypeField object>]
class scapy.contrib.stun.STUNMessageIntegrity(_pkt, /, *, type=8, length=20, hmac_sha1=0)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNMessageIntegrity'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNMessageIntegrity).type>, <ShortField (STUNMessageIntegrity).length>, <XNBytesField (STUNMessageIntegrity).hmac_sha1>]
post_build(pkt, pay)[source]
class scapy.contrib.stun.STUNPriority(_pkt, /, *, type=36, length=4, priority=0)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNPriority'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNPriority).type>, <ShortField (STUNPriority).length>, <IntField (STUNPriority).priority>]
class scapy.contrib.stun.STUNUseCandidate(_pkt, /, *, type=37, length=0, value=b'')[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNUseCandidate'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNUseCandidate).type>, <FieldLenField (STUNUseCandidate).length>, <scapy.fields.PadField object>]
class scapy.contrib.stun.STUNUsername(_pkt, /, *, type=6, length=None, username=b'')[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNUsername'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNUsername).type>, <FieldLenField (STUNUsername).length>, <scapy.fields.PadField object>]
class scapy.contrib.stun.STUNXorMappedAddress(_pkt, /, *, type=32, length=None, RESERVED=0, address_family=1, xport=0, xip=None)[source]

Bases: STUNGenericTlv

aliastypes = [<class 'scapy.contrib.stun.STUNXorMappedAddress'>, <class 'scapy.contrib.stun.STUNGenericTlv'>, <class 'scapy.packet.Packet'>]
fields_desc: ClassVar[List[Field[Any, Any] | _FieldContainer]] = [<XShortField (STUNXorMappedAddress).type>, <FieldLenField (STUNXorMappedAddress).length>, <ByteField (STUNXorMappedAddress).RESERVED>, <ByteEnumField (STUNXorMappedAddress).address_family>, <XorPort (STUNXorMappedAddress).xport>, <scapy.fields.MultipleTypeField object>]
class scapy.contrib.stun.XorIp(name: str, default: str | None)[source]

Bases: IPField

i2m(pkt, x)[source]
m2i(pkt, x)[source]
class scapy.contrib.stun.XorIp6(name: str, default: str | None)[source]

Bases: IP6Field

i2m(pkt, x)[source]
m2i(pkt, x)[source]
class scapy.contrib.stun.XorPort(name: str, default: int | None)[source]

Bases: ShortField

i2m(pkt, x)[source]
m2i(pkt, x)[source]