scapy.contrib.mqtt module

class scapy.contrib.mqtt.MQTT

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTT'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTT).type>, <Field (MQTT).DUP>, <Field (MQTT).QOS>, <Field (MQTT).RETAIN>, <Field (MQTT).len>]
payload_guess = [({'type': 1}, <class 'scapy.contrib.mqtt.MQTTConnect'>), ({'type': 2}, <class 'scapy.contrib.mqtt.MQTTConnack'>), ({'type': 3}, <class 'scapy.contrib.mqtt.MQTTPublish'>), ({'type': 4}, <class 'scapy.contrib.mqtt.MQTTPuback'>), ({'type': 5}, <class 'scapy.contrib.mqtt.MQTTPubrec'>), ({'type': 6}, <class 'scapy.contrib.mqtt.MQTTPubrel'>), ({'type': 7}, <class 'scapy.contrib.mqtt.MQTTPubcomp'>), ({'type': 8}, <class 'scapy.contrib.mqtt.MQTTSubscribe'>), ({'type': 9}, <class 'scapy.contrib.mqtt.MQTTSuback'>), ({'type': 10}, <class 'scapy.contrib.mqtt.MQTTUnsubscribe'>), ({'type': 11}, <class 'scapy.contrib.mqtt.MQTTUnsuback'>)]
class scapy.contrib.mqtt.MQTTConnack

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTConnack'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTConnack).sessPresentFlag>, <Field (MQTTConnack).retcode>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTConnect

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTConnect'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTConnect).length>, <Field (MQTTConnect).protoname>, <Field (MQTTConnect).protolevel>, <Field (MQTTConnect).usernameflag>, <Field (MQTTConnect).passwordflag>, <Field (MQTTConnect).willretainflag>, <Field (MQTTConnect).willQOSflag>, <Field (MQTTConnect).willflag>, <Field (MQTTConnect).cleansess>, <Field (MQTTConnect).reserved>, <Field (MQTTConnect).klive>, <Field (MQTTConnect).clientIdlen>, <Field (MQTTConnect).clientId>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTPuback

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTPuback'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTPuback).msgid>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTPubcomp

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTPubcomp'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTPubcomp).msgid>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTPublish

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTPublish'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTPublish).length>, <Field (MQTTPublish).topic>, <scapy.fields.ConditionalField object>, <Field (MQTTPublish).value>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTPubrec

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTPubrec'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTPubrec).msgid>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTPubrel

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTPubrel'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTPubrel).msgid>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTSuback

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTSuback'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTSuback).msgid>, <Field (MQTTSuback).retcode>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTSubscribe

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTSubscribe'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTSubscribe).msgid>, <Field (MQTTSubscribe).length>, <Field (MQTTSubscribe).topic>, <Field (MQTTSubscribe).QOS>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTTopic

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTTopic'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTTopic).len>, <Field (MQTTTopic).topic>]
guess_payload_class(payload)

DEV: Guesses the next payload class from layer bonds. Can be overloaded to use a different mechanism.

Parameters:payload (str) – the layer’s payload
Returns:the payload class
class scapy.contrib.mqtt.MQTTUnsuback

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTUnsuback'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTUnsuback).msgid>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.MQTTUnsubscribe

Bases: scapy.packet.Packet

aliastypes = [<class 'scapy.contrib.mqtt.MQTTUnsubscribe'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MQTTUnsubscribe).msgid>, <Field (MQTTUnsubscribe).topics>]
payload_guess = [({}, <class 'scapy.contrib.mqtt.MQTT'>)]
class scapy.contrib.mqtt.RandVariableFieldLen

Bases: scapy.volatile.RandNum

class scapy.contrib.mqtt.VariableFieldLenField(name, default, length_of=None, fmt='H', count_of=None, adjust=<function FieldLenField.<lambda>>, fld=None)

Bases: scapy.fields.FieldLenField

addfield(pkt, s, val)

Add an internal value to a string

Copy the network representation of field val (belonging to layer pkt) to the raw string packet s, and return the new string packet.

getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

randval()

Return a volatile object whose value is both random and suitable for this field

scapy.contrib.mqtt.cb_topic(pkt, lst, cur, remain)

Decode the remaining bytes as a MQTT topic