Merge pull request #43 from fork-as-backup/enhance_commands
feature / Enhance commands
This commit is contained in:
commit
2cbe0cfe70
@ -40,6 +40,7 @@ Provide the target IP using `-t` and a command to send using either `-c` or `-j`
|
|||||||
| antitheft | Lists configured antitheft rules |
|
| antitheft | Lists configured antitheft rules |
|
||||||
| reboot | Reboot the device |
|
| reboot | Reboot the device |
|
||||||
| reset | Reset the device to factory settings |
|
| reset | Reset the device to factory settings |
|
||||||
|
| energy | Return realtime voltage/current/power|
|
||||||
|
|
||||||
More advanced commands such as creating or editing rules can be issued using the `-j` flag by providing the full JSON string for the command. Please consult [tplink-smarthome-commands.txt](tplink-smarthome-commands.txt) for a comprehensive list of commands.
|
More advanced commands such as creating or editing rules can be issued using the `-j` flag by providing the full JSON string for the command. Please consult [tplink-smarthome-commands.txt](tplink-smarthome-commands.txt) for a comprehensive list of commands.
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#
|
#
|
||||||
import socket
|
import socket
|
||||||
import argparse
|
import argparse
|
||||||
|
from struct import pack
|
||||||
|
|
||||||
version = 0.1
|
version = 0.1
|
||||||
|
|
||||||
@ -44,14 +45,15 @@ commands = {'info' : '{"system":{"get_sysinfo":{}}}',
|
|||||||
'countdown': '{"count_down":{"get_rules":{}}}',
|
'countdown': '{"count_down":{"get_rules":{}}}',
|
||||||
'antitheft': '{"anti_theft":{"get_rules":{}}}',
|
'antitheft': '{"anti_theft":{"get_rules":{}}}',
|
||||||
'reboot' : '{"system":{"reboot":{"delay":1}}}',
|
'reboot' : '{"system":{"reboot":{"delay":1}}}',
|
||||||
'reset' : '{"system":{"reset":{"delay":1}}}'
|
'reset' : '{"system":{"reset":{"delay":1}}}',
|
||||||
|
'energy' : '{"emeter":{"get_realtime":{}}}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Encryption and Decryption of TP-Link Smart Home Protocol
|
# Encryption and Decryption of TP-Link Smart Home Protocol
|
||||||
# XOR Autokey Cipher with starting key = 171
|
# XOR Autokey Cipher with starting key = 171
|
||||||
def encrypt(string):
|
def encrypt(string):
|
||||||
key = 171
|
key = 171
|
||||||
result = "\0\0\0\0"
|
result = pack('>I', len(string))
|
||||||
for i in string:
|
for i in string:
|
||||||
a = key ^ ord(i)
|
a = key ^ ord(i)
|
||||||
key = a
|
key = a
|
||||||
|
Loading…
Reference in New Issue
Block a user