scapy.contrib.tzsp

TZSP - TaZmen Sniffer Protocol

author

Thomas Tannhaeuser, hecke @ naberius .

license

GPLv2

该模块是免费软件; 您可以根据自由软件基金会发布的GNU通用公共许可证的条款重新分发和/或修改它; 许可的版本2,或(由您选择)任何更高的版本.

分发该模块是希望它会有用,但是没有任何保证; 甚至没有对适销性或特定用途适用性的暗示保证. 有关更多详细信息,请参见GNU通用公共许可证.

description

该模块为TZSP协议提供Scapy层.

references:
NOTES
  • 要允许Scapy自动解剖该层,您需要使用#noqa:E501默认TZSP端口(0x9090)将TZSP层绑定到UDP,例如

    bind_layers(UDP,TZSP,sport = TZSP_PORT_DEFAULT)bind_layers(UDP,TZSP,dport = TZSP_PORT_DEFAULT)

  • 来自www.networkchemistry.com的数据包格式定义与Wikipedia#noqa:E501给出的定义不同

  • 似乎Wireshark实现了Wikipedia协议版本(未深入其代码)#noqa:E501

  • Wireshark(2.2.6)的观察到的(miss)行为-无法使用短值解码RSSI和SNR-仅占用一个字节-SNR被标记为静音-WlanRadioHdrSerial被标记为Sensor MAC-不知道数据包计数标签( 40 / 0x28)

class scapy.contrib.tzsp.TZSP

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
TZSP字段

version

ByteField

1

type

ByteEnumField

0

encapsulated_protocol

ShortEnumField

1

get_encapsulated_payload()
get_encapsulated_payload_class()

获取保存TZSP数据包的封装有效负载的类:return:表示有效负载的类,发生错误时的Raw()

guess_payload_class(payload)
exception scapy.contrib.tzsp.TZSPStructureException

Bases: scapy.error.Scapy_Exception

class scapy.contrib.tzsp.TZSPTagContentionFree

Bases: scapy.contrib.tzsp._TZSPTag

在无竞争期间收到的数据包

NO = 0
YES = 1
aliastypes
fields_desc
TZSPTagContentionFree字段

type

ByteEnumField

15

len

ByteField

1

contention_free

YesNoByteField

0

class scapy.contrib.tzsp.TZSPTagDataRate

Bases: scapy.contrib.tzsp._TZSPTag

无线链接数据速率

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
TZSPTagDataRate字段

type

ByteEnumField

12

len

ByteField

1

data_rate

ByteEnumField

0

class scapy.contrib.tzsp.TZSPTagDecrypted

Bases: scapy.contrib.tzsp._TZSPTag

数据包被解密

NO = 1
YES = 0
aliastypes
fields_desc
TZSPTagDecrypted字段

type

ByteEnumField

16

len

ByteField

1

decrypted

YesNoByteField

1

class scapy.contrib.tzsp.TZSPTagEnd

Bases: scapy.packet.Packet

最后一天

aliastypes
fields_desc
TZSPTagEnd字段

type

ByteEnumField

1

guess_payload_class(payload)

有效载荷封装的类型由外部TZSP层给出属性encapsulation_protocol#noqa:E501

class scapy.contrib.tzsp.TZSPTagError

Bases: scapy.contrib.tzsp._TZSPTag

帧校验和错误

NO = 0
YES = 1
aliastypes
fields_desc
TZSPTagError字段

type

ByteEnumField

17

len

ByteField

1

fcs_error

YesNoByteField

0

class scapy.contrib.tzsp.TZSPTagPacketCount

Bases: scapy.contrib.tzsp._TZSPTag

包计数器

aliastypes
fields_desc
TZSPTagPacketCount字段

type

ByteEnumField

40

len

ByteField

4

packet_count

IntField

0

class scapy.contrib.tzsp.TZSPTagPadding

Bases: scapy.contrib.tzsp._TZSPTag

填充标签(应忽略)

aliastypes
fields_desc
TZSPTagPadding字段

type

ByteEnumField

0

class scapy.contrib.tzsp.TZSPTagRXChannel

Bases: scapy.contrib.tzsp._TZSPTag

接收框架时引导传感器打开

aliastypes
fields_desc
TZSPTagRXChannel字段

type

ByteEnumField

18

len

ByteField

1

rx_channel

ByteField

0

class scapy.contrib.tzsp.TZSPTagRXFrameLength

Bases: scapy.contrib.tzsp._TZSPTag

接收报文长度

aliastypes
fields_desc
TZSPTagRXFrameLength字段

type

ByteEnumField

41

len

ByteField

2

rx_frame_length

ShortField

0

class scapy.contrib.tzsp.TZSPTagRawRSSIByte

Bases: scapy.contrib.tzsp._TZSPTag

相对接收信号强度-有符号字节值

aliastypes
fields_desc
TZSPTagRawRSSIByte字段

type

ByteEnumField

10

len

ByteField

1

raw_rssi

ByteField

0

class scapy.contrib.tzsp.TZSPTagRawRSSIShort

Bases: scapy.contrib.tzsp._TZSPTag

相对接收信号强度-带符号的短值

aliastypes
fields_desc
TZSPTagRawRSSIShort字段

type

ByteEnumField

10

len

ByteField

2

raw_rssi

ShortField

0

class scapy.contrib.tzsp.TZSPTagSNRByte

Bases: scapy.contrib.tzsp._TZSPTag

信号噪声比-有符号字节值

aliastypes
fields_desc
TZSPTagSNRByte字段

type

ByteEnumField

11

len

ByteField

1

snr

ByteField

0

class scapy.contrib.tzsp.TZSPTagSNRShort

Bases: scapy.contrib.tzsp._TZSPTag

信号噪声比-带符号的短值

aliastypes
fields_desc
TZSPTagSNRShort字段

type

ByteEnumField

11

len

ByteField

2

snr

ShortField

0

class scapy.contrib.tzsp.TZSPTagTimestamp

Bases: scapy.contrib.tzsp._TZSPTag

MAC接收时间戳

aliastypes
fields_desc
TZSPTagTimestamp字段

type

ByteEnumField

13

len

ByteField

4

timestamp

IntField

0

class scapy.contrib.tzsp.TZSPTagUnknown

Bases: scapy.contrib.tzsp._TZSPTag

未知标签类型的假人

aliastypes
fields_desc
TZSPTag未知字段

type

ByteField

255

len

FieldLenField

None

data

XStrLenField

b''

class scapy.contrib.tzsp.TZSPTagWlanRadioHdrSerial

Bases: scapy.contrib.tzsp._TZSPTag

(特定于供应商的)唯一捕获设备(传感器/ AP)标识符

aliastypes
fields_desc
TZSPTagWlanRadioHdrSerial字段

type

ByteEnumField

60

len

FieldLenField

None

sensor_id

StrLenField

b''