scapy.contrib.mqtt

class scapy.contrib.mqtt.MQTT(_pkt, /, *, type=1, DUP=0, QOS=0, RETAIN=0, len=None)[源代码]

基类:Packet

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 |D|QOS|R|              LEN              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                            Fig. MQTT                             
MQTT fields

type

BitEnumField

1

DUP

BitEnumField

0

QOS

BitEnumField

0

RETAIN

BitEnumField

0

len

VariableFieldLenField

None

payload_guess

Possible sublayers: MQTTConnack, MQTTConnect, MQTTDisconnect, MQTTPuback, MQTTPubcomp, MQTTPublish, MQTTPubrec, MQTTPubrel, MQTTSuback, MQTTSubscribe, MQTTUnsuback, MQTTUnsubscribe

class scapy.contrib.mqtt.MQTTConnack(_pkt, /, *, sessPresentFlag=0, retcode=0)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|SESSPRESENTFLAG|    RETCODE    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTConnack                         
MQTTConnack fields

sessPresentFlag

ByteField

0

retcode

ByteEnumField

0

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTConnect(_pkt, /, *, length=None, protoname=b'', protolevel=5, usernameflag=0, passwordflag=0, willretainflag=0, willQOSflag=0, willflag=0, cleansess=0, reserved=0, klive=0, clientIdlen=None, clientId=b'', wtoplen=None, willtopic=b'', wmsglen=None, willmsg=b'', userlen=None, username=b'', passlen=None, password=b'')[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |           PROTONAME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   PROTOLEVEL  |U|P|W|WIL|W|C|R|             KLIVE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          CLIENTIDLEN          |            CLIENTID           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            WTOPLEN            |           WILLTOPIC           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            WMSGLEN            |            WILLMSG            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            USERLEN            |            USERNAME           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            PASSLEN            |            PASSWORD           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTConnect                         
MQTTConnect fields

length

FieldLenField

None

protoname

StrLenField

b''

protolevel

ByteEnumField

5

usernameflag

BitEnumField

0

passwordflag

BitEnumField

0

willretainflag

BitEnumField

0

willQOSflag

BitEnumField

0

willflag

BitEnumField

0

cleansess

BitEnumField

0

reserved

BitEnumField

0

klive

ShortField

0

clientIdlen

FieldLenField

None

clientId

StrLenField

b''

wtoplen

FieldLenField (Cond)

None

willtopic

StrLenField (Cond)

b''

wmsglen

FieldLenField (Cond)

None

willmsg

StrLenField (Cond)

b''

userlen

FieldLenField (Cond)

None

username

StrLenField (Cond)

b''

passlen

FieldLenField (Cond)

None

password

StrLenField (Cond)

b''

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTDisconnect(_pkt, /)[源代码]

基类:Packet

aliastypes
fields_desc
payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTPuback(_pkt, /, *, msgid=None)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTPuback                          
MQTTPuback fields

msgid

ShortField

None

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTPubcomp(_pkt, /, *, msgid=None)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTPubcomp                         
MQTTPubcomp fields

msgid

ShortField

None

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTPublish(_pkt, /, *, length=None, topic=b'', msgid=None, value=b'')[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |             TOPIC             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |             VALUE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTPublish                         
MQTTPublish fields

length

FieldLenField

None

topic

StrLenField

b''

msgid

ShortField (Cond)

None

value

StrLenField

b''

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTPubrec(_pkt, /, *, msgid=None)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTPubrec                          
MQTTPubrec fields

msgid

ShortField

None

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTPubrel(_pkt, /, *, msgid=None)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTPubrel                          
MQTTPubrel fields

msgid

ShortField

None

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTSuback(_pkt, /, *, msgid=None, retcode=None)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |    RETCODE    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Fig. MQTTSuback                          
MQTTSuback fields

msgid

ShortField

None

retcode

ByteEnumField

None

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTSubscribe(_pkt, /, *, msgid=None, topics=[])[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |             TOPICS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. MQTTSubscribe                        
MQTTSubscribe fields

msgid

ShortField

None

topics

PacketListField

[]

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTTopic(_pkt, /, *, length=None, topic=b'')[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |             TOPIC             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Fig. MQTTTopic                          
MQTTTopic fields

length

FieldLenField

None

topic

StrLenField

b''

guess_payload_class(payload)[源代码]
class scapy.contrib.mqtt.MQTTTopicQOS(_pkt, /, *, length=None, topic=b'', QOS=0)[源代码]

基类:MQTTTopic

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             LENGTH            |             TOPIC             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      QOS      |
+-+-+-+-+-+-+-+-+

                        Fig. MQTTTopicQOS                         
MQTTTopicQOS fields

length

FieldLenField

None

topic

StrLenField

b''

QOS

ByteEnumField

0

class scapy.contrib.mqtt.MQTTUnsuback(_pkt, /, *, msgid=None)[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        Fig. MQTTUnsuback                         
MQTTUnsuback fields

msgid

ShortField

None

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.MQTTUnsubscribe(_pkt, /, *, msgid=None, topics=[])[源代码]

基类:Packet

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             MSGID             |             TOPICS            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                       Fig. MQTTUnsubscribe                       
MQTTUnsubscribe fields

msgid

ShortField

None

topics

PacketListField

[]

payload_guess

Possible sublayers: MQTT

class scapy.contrib.mqtt.RandVariableFieldLen[源代码]

基类:RandNum

class scapy.contrib.mqtt.VariableFieldLenField(name: str, default: Optional[Any], length_of: Optional[str] = None, fmt: str = 'H', count_of: Optional[str] = None, adjust: Callable[[Packet, int], int] = <function FieldLenField.<lambda>>)[源代码]

基类:FieldLenField

addfield(pkt, s, val)[源代码]
getfield(pkt, s)[源代码]
randval()[源代码]