expliot.plugins.udp.khijack

Support for hijacking a Kankun smart plug.

Module Contents

Classes

KHijack

Tests for Kankun smart plugs.

Attributes

DEFAULT_PORT

DEFAULT_PASS

AES_KEY

expliot.plugins.udp.khijack.DEFAULT_PORT = 27431
expliot.plugins.udp.khijack.DEFAULT_PASS = nopassword
expliot.plugins.udp.khijack.AES_KEY = b'fdsl;mewrjope456fds4fbvfnjwaugfo'
class expliot.plugins.udp.khijack.KHijack

Bases: expliot.core.tests.test.Test

Tests for Kankun smart plugs.

Output Format: [

{

“command”: “lan_phone%foobar…”, “response”: “lan_device%foorbar…confirmid#172345”, “received_confirmation_id”: 172345

}, {

“command2”: “lan_phone%foobar…”, “response2”: “lan_device%foorbar…,

}

]

static encrypt_decrypt(message, encrypt=True)

Encrypt/Decrypt a string using the known AES key of the smart plug.

Args:

message(bytes): The message to encrypt or decrypt encrypt(bool): True means encrypt (default), false means decrypt

Returns:

bytes: The encrypted/decrypted bytes

send_receive(ip_addr, port, message)

Send and then receive encrypted data to/from the smart plug.

Args:

ip_addr(str): The IP address of the smartplug port(int): Port number of the listening service message(str): The plaintext message

Returns:

bytes: The response received from the smart plug

create_message(cmd, cid=None)

Create the command message to be sent to the the smart plug

Args:

cmd(str): the command to send - open/close/confirm cid(str): confirmation id used in confirm command

Returns:

bytes: The command message

static get_confirm_id(message)

Extract the confirmation id from the response message

Args:

message(bytes): The response message from the smart plug

Returns:

str: The confirmation id, if found or None

execute()

Execute the test.