Last active
October 14, 2022 17:45
-
-
Save lts-rad/ae48b239e083258a588c8f4bcd059898 to your computer and use it in GitHub Desktop.
restore passwords from wpa files for SPR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
dev = {} | |
sae=open("sae_passwords").read() | |
wpa2=open("wpa2pskfile").read() | |
def make(mac, password, t): | |
if mac in dev: | |
return | |
d = {} | |
d["Name"] = "" | |
d["MAC"] = mac | |
d["WGPubKey"] = "" | |
d["VLANTag"] = "" | |
d["RecentIP"] = "" | |
d["PSKEntry"] = {"Type": t, "Psk": password} | |
d["Groups"] = ["wan", "dns"] | |
d["DeviceTags"] = [] | |
dev[mac] = d | |
for line in sae.splitlines(): | |
password,mac = line.split("|mac=") | |
make(mac, password, "sae") | |
for line in wpa2.splitlines(): | |
mac,password = line.split(" ") | |
make(mac, password, "wpa2") | |
open("newdevices.json",'w').write(json.dumps(dev, indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment