mqtt_pwn.connection package


mqtt_pwn.connection.active_scanner module

class mqtt_pwn.connection.active_scanner.ActiveScanner(client_id=None, host='', port=1883, timeout=60, topics=None, listen_timeout=60, scan_instance=None, cli=None)[source]

Bases: object


Checks if we should stop the loop based on self.listen_timeout

mqtt_on_message(mqtt_client, obj, msg)[source]

Handles when a new message arrives


The Scanner driver function

static start(cli, scan_instance, listen_timeout, topics)[source]

Start A specific active scan - topic discovery

static start_async(cli, scan_instance, listen_timeout, topics)[source]

Starts an active scan asynchronously

mqtt_pwn.connection.brute_forcer module

class mqtt_pwn.connection.brute_forcer.AuthBruteForce(cli, host, port, usernames, passwords)[source]

Bases: object

The class responsible from brute force a broker


A wrapper for the _brute method, mainly to catch keyboard interrupts

valid_criterias = ('usernames', 'passwords')
class mqtt_pwn.connection.brute_forcer.ConnectionResult[source]

Bases: object

Represents a connection result (success/fail)


A property that contains data whether the connection has succeeded


Sets the return code field

mqtt_pwn.connection.mqtt_client module

class mqtt_pwn.connection.mqtt_client.MqttClient(client_id=None, host='', port=1883, timeout=60, cli=None, username=None, password=None)[source]

Bases: object

Represents a MQTT Client connection handler class

mqtt_on_connect(mqtt_client, userdata, flags, result)[source]

A callback function that is responsible to being triggered when a connection was established

mqtt_on_message(mqtt_client, obj, msg)[source]

Handles when a new message arrives

publish(topic, payload)[source]

Publishes a message to a victim


Run the MQTT client

send_command(victim, command)[source]

Sends a command to a victim


Stops the mqtt connection loop

mqtt_pwn.connection.system_info module

class mqtt_pwn.connection.system_info.SystemInfo[source]

Bases: object

Represents System Info of the broker


Converts the data property to a prettytable table


A property that contains only the topic names

topics = {('$SYS/broker/subscriptions/count', 0), ('$SYS/broker/timestamp', 0), ('$SYS/broker/clients/connected', 0), ('$SYS/broker/clients/total', 0), ('$SYS/broker/clients/maximum', 0), ('$SYS/broker/version', 0), ('$SYS/broker/clients/disconnected', 0), ('$SYS/broker/uptime', 0), ('$SYS/broker/clients/expired', 0)}
update(topic, payload)[source]

Updates the system info data dict accordingly

Module contents