scapy.contrib.tzsp¶
TZSP - TaZmen Sniffer Protocol¶
- author
Thomas Tannhaeuser, hecke@naberius.de
- license
GPLv2
This module is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- description
This module provides Scapy layers for the TZSP protocol.
- NOTES
to allow Scapy to dissect this layer automatically, you need to bind the TZSP layer to UDP using # noqa: E501 the default TZSP port (0x9090), e.g.
bind_layers(UDP, TZSP, sport=TZSP_PORT_DEFAULT) bind_layers(UDP, TZSP, dport=TZSP_PORT_DEFAULT)
packet format definition from www.networkchemistry.com is different from the one given by wikipedia # noqa: E501
seems Wireshark implements the wikipedia protocol version (didn’t dive into their code) # noqa: E501
observed (miss)behavior of Wireshark (2.2.6) - fails to decode RSSI & SNR using short values - only one byte taken - SNR is labeled as silence - WlanRadioHdrSerial is labeled as Sensor MAC - doesn’t know the packet count tag (40 / 0x28)
-
class
scapy.contrib.tzsp.TZSP(*args, **kargs)¶ Bases:
scapy.packet.Packet-
ENCAPSULATED_ETHERNET= 1¶
-
ENCAPSULATED_IEEE_802_11= 18¶
-
ENCAPSULATED_PRISM_HEADER= 119¶
-
ENCAPSULATED_PROTOCOLS= {1: 'ETHERNET', 18: 'IEEE 802.11', 119: 'PRISM HEADER', 127: 'WLAN AVS'}¶
-
ENCAPSULATED_PROTOCOL_CLASSES= {1: <class 'scapy.layers.l2.Ether'>, 18: <class 'scapy.layers.dot11.Dot11'>, 119: <class 'scapy.layers.dot11.PrismHeader'>, 127: <class 'scapy.contrib.avs.AVSWLANHeader'>}¶
-
ENCAPSULATED_WLAN_AVS= 127¶
-
TYPES= {0: 'RX_PACKET', 1: 'TX_PACKET', 3: 'CONFIG', 4: 'KEEPALIVE/NULL', 5: 'PORT'}¶
-
TYPE_CONFIG= 3¶
-
TYPE_KEEPALIVE= 4¶
-
TYPE_NULL= 4¶
-
TYPE_PORT= 5¶
-
TYPE_RX_PACKET= 0¶
-
TYPE_TX_PACKET= 1¶
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VERSION | TYPE | ENCAPSULATED PROTOCOL | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTZSP fields¶ version
1type
0encapsulated_protocol
1
-
get_encapsulated_payload()¶
-
get_encapsulated_payload_class()¶ get the class that holds the encapsulated payload of the TZSP packet :return: class representing the payload, Raw() on error
-
guess_payload_class(payload)¶
-
-
exception
scapy.contrib.tzsp.TZSPStructureException¶ Bases:
scapy.error.Scapy_Exception
-
class
scapy.contrib.tzsp.TZSPTagContentionFree(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagpacket received in contention free period
-
NO= 0¶
-
YES= 1¶
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN |CONTENTION FREE| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagContentionFreeTZSPTagContentionFree fields¶ type
15len
1contention_free
0
-
-
class
scapy.contrib.tzsp.TZSPTagDataRate(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagwireless link data rate
-
DATA_RATES= {0: 'unknown', 2: '1 MB/s', 4: '2 MB/s', 10: '1 MB/s (legacy)', 11: '5.5 MB/s', 12: '6 MB/s', 18: '9 MB/s', 20: '2 MB/s (legacy)', 22: '11 MB/s', 24: '12 MB/s', 36: '18 MB/s', 44: '22 MB/s', 48: '24 MB/s', 55: '5.5 MB/s (legacy)', 66: '33 MB/s', 72: '36 MB/s', 96: '48 MB/s', 108: '54 MB/s', 110: '11 MB/s (legacy)'}¶
-
DATA_RATE_1= 2¶
-
DATA_RATE_11= 22¶
-
DATA_RATE_12= 24¶
-
DATA_RATE_18= 36¶
-
DATA_RATE_2= 4¶
-
DATA_RATE_22= 44¶
-
DATA_RATE_24= 48¶
-
DATA_RATE_33= 66¶
-
DATA_RATE_36= 72¶
-
DATA_RATE_48= 96¶
-
DATA_RATE_54= 108¶
-
DATA_RATE_5_5= 11¶
-
DATA_RATE_6= 12¶
-
DATA_RATE_9= 18¶
-
DATA_RATE_LEGACY_1= 10¶
-
DATA_RATE_LEGACY_11= 110¶
-
DATA_RATE_LEGACY_2= 20¶
-
DATA_RATE_LEGACY_5_5= 55¶
-
DATA_RATE_UNKNOWN= 0¶
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | DATA RATE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagDataRateTZSPTagDataRate fields¶ type
12len
1data_rate
0
-
-
class
scapy.contrib.tzsp.TZSPTagDecrypted(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagpacket was decrypted
-
NO= 1¶
-
YES= 0¶
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | DECRYPTED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagDecryptedTZSPTagDecrypted fields¶ type
16len
1decrypted
1
-
-
class
scapy.contrib.tzsp.TZSPTagEnd(*args, **kargs)¶ Bases:
scapy.packet.Packetlast tag
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | +-+-+-+-+-+-+-+-+ Fig. TZSPTagEndTZSPTagEnd fields¶ type
1
-
guess_payload_class(payload)¶ the type of the payload encapsulation is given be the outer TZSP layers attribute encapsulation_protocol # noqa: E501
-
-
class
scapy.contrib.tzsp.TZSPTagError(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagframe checksum error
-
NO= 0¶
-
YES= 1¶
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | FCS ERROR | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagErrorTZSPTagError fields¶ type
17len
1fcs_error
0
-
-
class
scapy.contrib.tzsp.TZSPTagPacketCount(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagpacket counter
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | PACKET COUNT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagPacketCountTZSPTagPacketCount fields¶ type
40len
4packet_count
0
-
-
class
scapy.contrib.tzsp.TZSPTagPadding(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagpadding tag (should be ignored)
-
aliastypes¶
-
-
class
scapy.contrib.tzsp.TZSPTagRXChannel(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagchannel the sensor was on while receiving the frame
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | RX CHANNEL | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagRXChannelTZSPTagRXChannel fields¶ type
18len
1rx_channel
0
-
-
class
scapy.contrib.tzsp.TZSPTagRXFrameLength(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagreceived packet length
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | RX FRAME LENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagRXFrameLengthTZSPTagRXFrameLength fields¶ type
41len
2rx_frame_length
0
-
-
class
scapy.contrib.tzsp.TZSPTagRawRSSIByte(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagrelative received signal strength - signed byte value
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | RAW RSSI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagRawRSSIByteTZSPTagRawRSSIByte fields¶ type
10len
1raw_rssi
0
-
-
class
scapy.contrib.tzsp.TZSPTagRawRSSIShort(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagrelative received signal strength - signed short value
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | RAW RSSI | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagRawRSSIShortTZSPTagRawRSSIShort fields¶ type
10len
2raw_rssi
0
-
-
class
scapy.contrib.tzsp.TZSPTagSNRByte(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagsignal noise ratio - signed byte value
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | SNR | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagSNRByteTZSPTagSNRByte fields¶ type
11len
1snr
0
-
-
class
scapy.contrib.tzsp.TZSPTagSNRShort(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagsignal noise ratio - signed short value
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | SNR | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagSNRShortTZSPTagSNRShort fields¶ type
11len
2snr
0
-
-
class
scapy.contrib.tzsp.TZSPTagTimestamp(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagMAC receive timestamp
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | TIMESTAMP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagTimestampTZSPTagTimestamp fields¶ type
13len
4timestamp
0
-
-
class
scapy.contrib.tzsp.TZSPTagUnknown(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTagunknown tag type dummy
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagUnknownTZSPTagUnknown fields¶ type
255len
Nonedata
b''
-
-
class
scapy.contrib.tzsp.TZSPTagWlanRadioHdrSerial(*args, **kargs)¶ Bases:
scapy.contrib.tzsp._TZSPTag(vendor specific) unique capture device (sensor/AP) identifier
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TYPE | LEN | SENSOR ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. TZSPTagWlanRadioHdrSerialTZSPTagWlanRadioHdrSerial fields¶ type
60len
Nonesensor_id
b''
-