expliot.plugins.internet.khijack

Module Contents

class expliot.plugins.internet.khijack.KHijack

Bases: expliot.core.tests.test.Test

cipher(self, str, encrypt=True)

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

Parameters:
  • str – string to encrypt or decrypt
  • encrypt – True means encrypt (default), false means decrypt
Returns:

The encrypted/decrypted string

send_recv(self, ip, port, m)

Send and then receive encrypted data to/from the smartplug

Parameters:
  • ip – IP address of the smartplug
  • port – Port number of the listening service
  • m – plaintext message
Returns:

The response received from the smartplug

createmsg(self, cmd, cid=None)

Create the command message to be sent to the the smartplug

Parameters:
  • cmd – the command to send - open/close/confirm
  • cid – confirmation id used in confirm command
Returns:

The command message

get_confirmid(self, m)

Extract the confirmation id from the response message :param self: :param m: The response message :return: The confirmation id

execute(self)