yay kinda works

This commit is contained in:
JJTech0130 2023-07-24 16:37:53 -04:00
parent b32cba7501
commit b762b2622f
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6
3 changed files with 55 additions and 7 deletions

View file

@ -102,6 +102,7 @@ class APNSConnection:
if payload is not None: if payload is not None:
# print("QUEUE: Received payload: " + str(payload)) # print("QUEUE: Received payload: " + str(payload))
# print("QUEUE: Received payload type: " + hex(payload[0])) # print("QUEUE: Received payload type: " + hex(payload[0]))
logger.debug(f"Received payload: {payload}")
self.incoming_queue.append(payload) self.incoming_queue.append(payload)
# print("QUEUE: Thread ended") # print("QUEUE: Thread ended")

22
demo.py
View file

@ -17,7 +17,7 @@ logging.basicConfig(
logging.getLogger("urllib3").setLevel(logging.WARNING) logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("jelly").setLevel(logging.INFO) logging.getLogger("jelly").setLevel(logging.INFO)
logging.getLogger("nac").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("albert").setLevel(logging.INFO)
logging.getLogger("ids").setLevel(logging.DEBUG) logging.getLogger("ids").setLevel(logging.DEBUG)
logging.getLogger("bags").setLevel(logging.DEBUG) logging.getLogger("bags").setLevel(logging.DEBUG)
@ -77,6 +77,8 @@ def safe_b64decode(s):
except: except:
return None return None
conn.connect(token=safe_b64decode(CONFIG.get("push", {}).get("token"))) 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()) #print(b64encode(conn.token).decode())
user = ids.IDSUser(conn) user = ids.IDSUser(conn)
@ -110,13 +112,21 @@ while True:
if line == "": if line == "":
break break
# Look up the username # 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 # Write config.json
CONFIG["id"] = { #CONFIG["id"] = {
"key": user._id_keypair.key, # "key": user._id_keypair.key,
"cert": user._id_keypair.cert, # "cert": user._id_keypair.cert,
} #}
CONFIG["auth"] = { CONFIG["auth"] = {
"key": user._auth_keypair.key, "key": user._auth_keypair.key,
"cert": user._auth_keypair.cert, "cert": user._auth_keypair.cert,

View file

@ -23,10 +23,47 @@ def register(
"software-version": "22D68", "software-version": "22D68",
"services": [ "services": [
{ {
"capabilities": [{"flags": 1, "name": "Messenger", "version": 1}], "capabilities": [{"flags": 17, "name": "Messenger", "version": 1}],
"service": "com.apple.madrid", "service": "com.apple.madrid",
"users": [ "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, "uris": uris,
"user-id": user_id, "user-id": user_id,
} }