small changes

This commit is contained in:
JJTech0130 2023-04-07 13:44:56 -04:00
parent 6cfdab8af0
commit 54ad3295d7
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6
2 changed files with 7 additions and 6 deletions

View file

@ -61,7 +61,8 @@ def _p_filter(prefix, fields: list[tuple[int, bytes]]):
elif field[0] == 5: elif field[0] == 5:
paused.append(_lookup_topic(field[1])) paused.append(_lookup_topic(field[1]))
else: else:
print(f"Unknown field ID: {field[0]}") pass # whatever, there's a 6 but it's not documented
#print(f"Unknown field ID: {field[0]}")
# Remove None values # Remove None values
enabled = [topic.strip() for topic in enabled if topic is not None] enabled = [topic.strip() for topic in enabled if topic is not None]
@ -144,10 +145,8 @@ def pretty_print_payload(prefix, payload: tuple[int, list[tuple[int, bytes]]]) -
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Keep Alive Ack{bcolors.ENDC}") print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Keep Alive Ack{bcolors.ENDC}")
elif id == 0x14: elif id == 0x14:
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Set State{bcolors.ENDC}: {_get_field(payload[1], 1).hex()}") print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Set State{bcolors.ENDC}: {_get_field(payload[1], 1).hex()}")
elif id == 0x1d: elif id == 0x1d or id == 0x20:
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0x1D{bcolors.ENDC}") print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.WARNING}PubSub{bcolors.ENDC}")
elif id == 0x20:
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0x20{bcolors.ENDC}")
elif id == 0xe: elif id == 0xe:
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0xe{bcolors.ENDC}") print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0xe{bcolors.ENDC}")
elif id == 0xa: elif id == 0xa:

View file

@ -5,7 +5,7 @@ import tlslite
import threading import threading
# APNs server to proxy traffic to # APNs server to proxy traffic to
APNS_HOST = "1-courier.push.apple.com" APNS_HOST = "windows.courier.push.apple.com"
APNS_PORT = 5223 APNS_PORT = 5223
ALPN = b"apns-security-v3" ALPN = b"apns-security-v3"
#ALPN = b"apns-pack-v1" #ALPN = b"apns-pack-v1"
@ -57,6 +57,8 @@ def proxy(conn1: tlslite.TLSConnection, conn2: tlslite.TLSConnection, prefix: st
except OSError as e: except OSError as e:
if e.errno == 9: if e.errno == 9:
pass # Probably a connection closed error pass # Probably a connection closed error
except tlslite.TLSAbruptCloseError:
pass
print("Connection closed") print("Connection closed")
# Close the connections # Close the connections
conn1.close() conn1.close()