add identity pretty-printing

This commit is contained in:
JJTech0130 2023-05-02 17:37:46 -04:00
parent d8fc26bcb2
commit 1eb41fd70a
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6

34
demo.py
View file

@ -137,9 +137,39 @@ print("Got IDS certificate!")
# This is the actual lookup! # This is the actual lookup!
print("Looking up user...") print("Looking up user...")
ids_keypair = ids.KeyPair(CONFIG['key'], CONFIG['ids_cert']) ids_keypair = ids.KeyPair(CONFIG['key'], CONFIG['ids_cert'])
resp = ids.lookup(conn, CONFIG['username'], ids_keypair, 'com.apple.madrid', ['mailto:textgpt@icloud.com']) resp = ids.lookup(conn, CONFIG['username'], ids_keypair, 'com.apple.madrid', ['mailto:user_test2@icloud.com'])
print("Got response!") print("Got response!")
print(resp) #print(resp)
r = list(resp['results'].values())[0]
i = r['identities']
print(f"IDENTITIES: {len(i)}")
for iden in i:
print("IDENTITY", end=" ")
#print("========")
print(f"Push Token: {b64encode(iden['push-token']).decode()}", end=" ")
if 'client-data' in iden:
print(f"Client Data: {len(iden['client-data'])}")
# cl = iden['client-data']
# for key, value in cl.items():
# print(f"{key}: {value}")
else:
print("No client data")
#print("\n\n\n")
#print("\n\n\n")
#print(iden)
#
# for key, value in iden.items():
# print(f"{key}: {value}")
#for key, value in r.items():
# print(f"{key}: {value}")
#print(r)
#print(len(str(resp)))
#print("\n\n\n\n")
#for key, value in resp['results']['mailto:user_test2@icloud.com'].items():
# print(f"{key}: {value}")
# Save config # Save config
with open("config.json", "w") as f: with open("config.json", "w") as f: