From b762b2622f5ccf190c7873cc4cef0856933ce472 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Mon, 24 Jul 2023 16:37:53 -0400 Subject: [PATCH] yay kinda works --- apns.py | 1 + demo.py | 22 ++++++++++++++++------ ids/identity.py | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/apns.py b/apns.py index e8f5ba9..b399997 100644 --- a/apns.py +++ b/apns.py @@ -102,6 +102,7 @@ class APNSConnection: if payload is not None: # print("QUEUE: Received payload: " + str(payload)) # print("QUEUE: Received payload type: " + hex(payload[0])) + logger.debug(f"Received payload: {payload}") self.incoming_queue.append(payload) # print("QUEUE: Thread ended") diff --git a/demo.py b/demo.py index 04211ae..e1b9857 100644 --- a/demo.py +++ b/demo.py @@ -17,7 +17,7 @@ logging.basicConfig( logging.getLogger("urllib3").setLevel(logging.WARNING) logging.getLogger("jelly").setLevel(logging.INFO) logging.getLogger("nac").setLevel(logging.INFO) -logging.getLogger("apns").setLevel(logging.INFO) +logging.getLogger("apns").setLevel(logging.DEBUG) logging.getLogger("albert").setLevel(logging.INFO) logging.getLogger("ids").setLevel(logging.DEBUG) logging.getLogger("bags").setLevel(logging.DEBUG) @@ -77,6 +77,8 @@ def safe_b64decode(s): except: return None conn.connect(token=safe_b64decode(CONFIG.get("push", {}).get("token"))) +conn.set_state(1) +conn.connect(root=False, token=b64decode("E2qx2kiU0KxnyhcLErUHEnVQABEaEQfPEEISmUx+4j4=")) #print(b64encode(conn.token).decode()) user = ids.IDSUser(conn) @@ -110,13 +112,21 @@ while True: if line == "": break # Look up the username - logging.info(f"Looked up {line}, got response: {user.lookup([line])}") + resp = user.lookup([line]) + #logging.info(f"Looked up {line}, got response: {user.lookup([line])}") + info = resp[line] + identities = info["identities"] + logging.info(f"Identities: {len(identities)}") + for identity in identities: + logging.info(f"Identity: [yellow]{b64encode(identity['push-token']).decode()}[/] ({len(identity)} properties)", extra={"markup": True}) + if len(identity) > 5: + logging.warning(identity) # Write config.json -CONFIG["id"] = { - "key": user._id_keypair.key, - "cert": user._id_keypair.cert, -} +#CONFIG["id"] = { +# "key": user._id_keypair.key, +# "cert": user._id_keypair.cert, +#} CONFIG["auth"] = { "key": user._auth_keypair.key, "cert": user._auth_keypair.cert, diff --git a/ids/identity.py b/ids/identity.py index 5224eb3..9d79963 100644 --- a/ids/identity.py +++ b/ids/identity.py @@ -23,10 +23,47 @@ def register( "software-version": "22D68", "services": [ { - "capabilities": [{"flags": 1, "name": "Messenger", "version": 1}], + "capabilities": [{"flags": 17, "name": "Messenger", "version": 1}], "service": "com.apple.madrid", "users": [ { + "client-data": { + 'is-c2k-equipment': True, + 'optionally-receive-typing-indicators': True, + 'public-message-identity-key': b64decode("""MIH2gUMAQQSYmvE+hYOWVGotZUCd + M6zoW/2clK8RIzUtE6JAmWSCwj7d + B213vxEBNAPHefEtlxkVKlQH6bsw + ja5qYyl3Fh28goGuAKwwgakCgaEA + 4lw3MrXOFIWWIi3TTUGksXVCIz92 + R3AG3ghBa1ZBoZ6rIJHeuxhD2vTV + hicpW7kvZ/+AFgE4vFFef/9TjG6C + rsBtWUUfPtYHqc7+uaghVW13qfYC + tdGsW8Apvf6MJqsRmITJjoYZ5kwl + scp5Xw/1KVQzKMfZrwZeLC/UZ6O1 + 41u4Xvm+u40e+Ky/wMCOwLGBG0Ag + ZBH91Xrq+S8izgSLmQIDAQAB"""), + + 'public-message-identity-version':2, + 'show-peer-errors': True, + 'supports-ack-v1': True, + 'supports-activity-sharing-v1': True, + 'supports-audio-messaging-v2': True, + "supports-autoloopvideo-v1": True, + 'supports-be-v1': True, + 'supports-ca-v1': True, + 'supports-fsm-v1': True, + 'supports-fsm-v2': True, + 'supports-fsm-v3': True, + 'supports-ii-v1': True, + 'supports-impact-v1': True, + 'supports-inline-attachments': True, + 'supports-keep-receipts': True, + "supports-location-sharing": True, + 'supports-media-v2': True, + 'supports-photos-extension-v1': True, + 'supports-st-v1': True, + 'supports-update-attachments-v1': True, + }, "uris": uris, "user-id": user_id, }