Skip to content

Commit 2fb2776

Browse files
committed
export plist names and private keys
1 parent d6b6d2a commit 2fb2776

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

export.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Export from Property Lists files
5+
"""
6+
7+
from os import walk, path
8+
from plistlib import load
9+
from requests import put
10+
from cryptic import b64_ascii
11+
12+
PLIST_DIR = "/tmp/plists"
13+
URL = ""
14+
HEADERS = {"X-API-Key": "xyz"}
15+
16+
if __name__ == "__main__":
17+
devices = []
18+
for root, dirs, files in walk(PLIST_DIR):
19+
for file in files:
20+
if file.endswith(".plist"):
21+
plist_path = path.join(root, file)
22+
print("Reading", plist_path)
23+
with open(plist_path, "rb") as plist:
24+
for device in load(plist):
25+
devices.append(
26+
{
27+
"name": device["name"],
28+
"privateKey": b64_ascii(device["privateKey"]),
29+
}
30+
)
31+
print(devices)
32+
if URL.startswith("http"):
33+
response = put(URL, headers=HEADERS, json=devices, timeout=60)
34+
print("status_code:", response.status_code)

0 commit comments

Comments
 (0)