minor clarification about the hardcoded token

This commit is contained in:
JJTech0130 2023-04-10 20:34:27 -04:00
parent 26e4257cac
commit cb15a3a6b1
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6
2 changed files with 9 additions and 10 deletions

View file

@ -90,19 +90,13 @@ class APNSConnection:
(1, sha1(topic.encode()).digest()),
(2, self.token),
(3, payload)])
#print(payload)
self.sock.write(payload)
payload = self.wait_for_packet(0x0b)
if payload[1][0][1] != 0x00.to_bytes():
raise Exception("Failed to send message")
#raise Exception("Failed to send message, got error code " + str(payload[1][1].hex()))
#payload = _deserialize_payload(self.sock)
#print(payload)
raise Exception("Failed to send message")
def set_state(self, state: int):
self.sock.write(_serialize_payload(0x14, [(1, state.to_bytes(1)), (2, 0x7FFFFFFF.to_bytes(4))]))

11
ids.py
View file

@ -7,7 +7,12 @@ from hashlib import sha1
import zlib
USER_AGENT = "com.apple.madrid-lookup [macOS,13.2.1,22D68,MacBookPro18,3]"
# NOTE: The push token MUST be registered with the account for self-uri!
# This is an actual valid one for my account, since you can look it up anyway.
PUSH_TOKEN = "5V7AY+ikHr4DiSfq1W2UBa71G3FLGkpUSKTrOLg81yk="
SELF_URI = "mailto:jjtech@jjtech.dev"
TO_LOOKUP = ['mailto:jjtech@jjtech.dev']
# Nonce Format:
# 01000001876bd0a2c0e571093967fce3d7
@ -52,7 +57,7 @@ def sign_payload(private_key: str, bag_key: str, query_string: str, push_token:
return sig, nonce
body = {'uris': ['mailto:jjtech@jjtech.dev']}
body = {'uris': TO_LOOKUP}
body = plistlib.dumps(body)
body = zlib.compress(body, wbits=16 + zlib.MAX_WBITS)
@ -64,7 +69,7 @@ headers = {
'x-id-nonce': b64encode(nonce).decode(),
'x-id-sig': signature,
'x-push-token': PUSH_TOKEN,
'x-id-self-uri': 'mailto:jjtech@jjtech.dev',
'x-id-self-uri': SELF_URI,
'User-Agent': USER_AGENT,
'x-protocol-version': '1630',
}
@ -84,7 +89,7 @@ print(conn1.token)
to_send = {'cT': 'application/x-apple-plist',
'U': b'\x16%D\xd5\xcd:D1\xa1\xa7z6\xa9\xe2\xbc\x8f', # Just random bytes?
'c': 96,
'ua': '[macOS,13.2.1,22D68,MacBookPro18,3]',
'ua': USER_AGENT,
'u': 'https://query.ess.apple.com/WebObjects/QueryService.woa/wa/query',
'h': headers,
'v': 2, # breaks lookup