:py:mod:`expliot.plugins.udp.khijack` ===================================== .. py:module:: expliot.plugins.udp.khijack .. autoapi-nested-parse:: Support for hijacking a Kankun smart plug. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: expliot.plugins.udp.khijack.KHijack Attributes ~~~~~~~~~~ .. autoapisummary:: expliot.plugins.udp.khijack.DEFAULT_PORT expliot.plugins.udp.khijack.DEFAULT_PASS expliot.plugins.udp.khijack.AES_KEY .. py:data:: DEFAULT_PORT :annotation: = 27431 .. py:data:: DEFAULT_PASS :annotation: = nopassword .. py:data:: AES_KEY :annotation: = b'fdsl;mewrjope456fds4fbvfnjwaugfo' .. py:class:: KHijack Bases: :py:obj:`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..., } ] .. py:method:: encrypt_decrypt(message, encrypt=True) :staticmethod: 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 .. py:method:: 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 .. py:method:: 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 .. py:method:: get_confirm_id(message) :staticmethod: 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 .. py:method:: execute() Execute the test.