Skip to content

Commit

Permalink
A few bits of tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsaxon committed Jan 3, 2020
1 parent 3833251 commit 9a7b00b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 2 additions & 7 deletions debug/Decrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,5 @@ def Decrypt(self, encoded, iv):

return plaintext

device = SonoffR3(b'b5b46dce-d365-4f2e-b507-b09269c4ddb6')
print(device.Decrypt(b'oCKuglULSEok8/xaS8ZMS9HPjpK/0WYgFrzaSnTnJSpbmKz2NCIee7Mhzvf9GU+/', b'"MDQ2OTgyMTAyMjcxODU3Ng=="'))

device = SonoffR3(b'b5b46dce-d365-4f2e-b507-b09269c4ddb6')
print(device.Decrypt(b'2BqVsSYoQxFP43zTKxZfc1i2CYDhTX6pYp4tGySiczMDnpYAb6/UTGhKt3kbhm+P', b'HwQWNfMgpBRjODqTUcH1+A=='))


device = SonoffR3(b'apikey')
print(device.Decrypt(b'ciphertext', b'iv'))
2 changes: 1 addition & 1 deletion pysonofflan/sonoffcrypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

def format_encryption_msg(payload, api_key, data):

payload["selfApikey"] = "cb0ff096-2a9d-4250-93ec-362fc1fe6f40" # This field needs to exist, but no idea what it is used for (https://github.com/itead/Sonoff_Devices_DIY_Tools/issues/5)
payload["selfApikey"] = "123" # This field needs to exist, but no idea what it is used for (https://github.com/itead/Sonoff_Devices_DIY_Tools/issues/5)
iv = generate_iv()
payload["iv"] = b64encode(iv).decode("utf-8")
payload["encrypt"] = True
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_cli_on(self):

"""Test the CLI."""
runner = CliRunner()
result = runner.invoke(cli.cli, ['--device_id', 'PlugOnMock', '-l', 'DEBUG', 'on'])
result = runner.invoke(cli.cli, ['--device_id', 'PlugOnMock', 'on'])

print(result.output)

Expand Down Expand Up @@ -119,7 +119,7 @@ def test_cli_off_strip(self):

def test_cli_on_encrypt(self):

start_device("PlugEncrypt", "plug")
start_device("PlugEncrypt", "plug", "testkey")

"""Test the CLI."""
runner = CliRunner()
Expand All @@ -131,7 +131,7 @@ def test_cli_on_encrypt(self):

def test_cli_on_strip_encrypt(self):

start_device("StripEncrypt", "strip")
start_device("StripEncrypt", "strip", "testkey")

"""Test the CLI."""
runner = CliRunner()
Expand Down

0 comments on commit 9a7b00b

Please sign in to comment.