getting ready for imessage decryption...

This commit is contained in:
JJTech0130 2023-04-08 16:01:03 -04:00
parent 7a9d8c3466
commit ed9eb28097
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6
2 changed files with 15 additions and 1 deletions

View file

@ -153,8 +153,15 @@ def pretty_print_payload(prefix, payload: tuple[int, list[tuple[int, bytes]]]) -
# if it has apsd -> APNs in the prefix, it's an outgoing notification
if "apsd -> APNs" in prefix:
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKBLUE}OUTGOING Notification{bcolors.ENDC}", end="")
topic = _lookup_topic(_get_field(payload[1], 1))
if b"bplist" in _get_field(payload[1], 3):
print(f" {bcolors.OKCYAN}Binary{bcolors.ENDC}", end="")
if topic == "com.apple.madrid":
print(f" {bcolors.FAIL}Madrid{bcolors.ENDC}", end="")
import plistlib
plist = plistlib.loads(_get_field(payload[1], 3))
for key in plist:
print(f" {bcolors.OKBLUE}{key}{bcolors.ENDC}: {plist[key]}", end="")
print(f" {bcolors.WARNING}Topic{bcolors.ENDC}: {_lookup_topic(_get_field(payload[1], 1))}")
else:

View file

@ -61,7 +61,14 @@ def proxy(conn1: tlslite.TLSConnection, conn2: tlslite.TLSConnection, prefix: st
print(prefix, "Connection closed due to no data")
break
override = printer.pretty_print_payload(prefix, apns._deserialize_payload_from_buffer(data))
try:
override = printer.pretty_print_payload(prefix, apns._deserialize_payload_from_buffer(data))
except Exception as e:
if e == "Buffer is too short":
print("Buffer is too short to parse, ignoring")
# print("Buffer is too short, trying to read more")
# data += conn1.read()
pass
if override is not None:
data = override
print("OVERRIDE: ", end="")