-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for new WiFi configuration encryption #70
Labels
Comments
Closed
A code snippet to integrate into/instead of existing encryption: #!/usr/bin/env python3
import base64
import itertools
import struct
import sys
from arc4 import ARC4
import xled.security
if len(sys.argv) != 4:
print("Args: <mac-address> <ssid> <wifi-password>", file=sys.stderr)
sys.exit(1)
KEYv2 = [38, 128, 245, 135, 159, 238, 44, 117, 17, 170, 8, 21, 71, 68, 142, 4,
153, 205, 104, 7, 110, 9, 50, 98, 93, 196, 222, 124, 56, 152, 158, 136,
128, 238, 42, 183, 51, 103, 143, 162, 13, 204, 133, 216, 148, 205, 148,
79]
mac = xled.security.netaddr.EUI(sys.argv[1])
secret = b''.join([struct.pack("B", (x ^ y)) for x, y in zip(KEYv2, itertools.cycle(mac.packed))])
padded_ssid = sys.argv[2].ljust(64, "\x00")
padded_pass = sys.argv[3].ljust(64, "\x00")
arc4 = ARC4(secret)
cipher = arc4.encrypt(padded_ssid)
encrypted = base64.b64encode(cipher).decode("utf-8")
print("Encrypted SSID: {}".format(encrypted))
arc4 = ARC4(secret)
cipher = arc4.encrypt(padded_pass)
encrypted = base64.b64encode(cipher).decode("utf-8")
print("Encrypted password: {}".format(encrypted)) |
scrool
added a commit
that referenced
this issue
Mar 1, 2022
Required since firmware version 2.4.25. Fixes: #70
scrool
added a commit
that referenced
this issue
Mar 1, 2022
Required since firmware version 2.4.30. Fixes: #70
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/scrool/xled-docs/issues/17 . My preliminary tests looks like
cryptography
library needs to be replaced because it doesn't support 48 byte (384 bit) long encryption key.arc4
seems like a good candidate.The text was updated successfully, but these errors were encountered: