mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2024-12-24 11:52:27 -06:00
more printing stuff
This commit is contained in:
parent
abb47ddaf7
commit
b17ae3f6f6
2 changed files with 23 additions and 4 deletions
19
printer.py
19
printer.py
|
@ -108,6 +108,25 @@ def pretty_print_payload(prefix, payload: tuple[int, list[tuple[int, bytes]]]):
|
|||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Connected{bcolors.ENDC} {token_str}")
|
||||
elif id == 7:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Connect Request{bcolors.ENDC}")
|
||||
elif id == 0xc:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Keep Alive{bcolors.ENDC}")
|
||||
elif id == 0xd:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Keep Alive Ack{bcolors.ENDC}")
|
||||
elif id == 0x14:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Set State{bcolors.ENDC}: {_get_field(payload[1], 1).hex()}")
|
||||
elif id == 0x1d:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0x1D{bcolors.ENDC}")
|
||||
elif id == 0x20:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0x20{bcolors.ENDC}")
|
||||
elif id == 0xe:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.FAIL}Unknown 0xe{bcolors.ENDC}")
|
||||
elif id == 0xa:
|
||||
if prefix == "apsd -> APNs":
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKBLUE}OUTGOING Notification{bcolors.ENDC}")
|
||||
else:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Notification{bcolors.ENDC}")
|
||||
elif id == 0xb:
|
||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Notification Ack{bcolors.ENDC}")
|
||||
else:
|
||||
print(prefix, f"Payload ID: {hex(payload[0])}")
|
||||
for field in payload[1]:
|
||||
|
|
|
@ -16,10 +16,10 @@ def connect() -> tlslite.TLSConnection:
|
|||
sock = socket.create_connection((APNS_HOST, APNS_PORT))
|
||||
# Wrap the socket in TLS
|
||||
ssock = tlslite.TLSConnection(sock)
|
||||
print("Handshaking with APNs")
|
||||
#print("Handshaking with APNs")
|
||||
# Handshake with the server
|
||||
ssock.handshakeClientCert(alpn=[b"apns-security-v3"])
|
||||
print("Handshaked with APNs")
|
||||
#print("Handshaked with APNs")
|
||||
|
||||
return ssock
|
||||
|
||||
|
@ -60,10 +60,10 @@ def handle(conn: socket.socket):
|
|||
global cert, key
|
||||
chain = tlslite.X509CertChain()
|
||||
chain.parsePemList(cert)
|
||||
print(chain)
|
||||
#print(chain)
|
||||
#cert = tlslite.X509CertChain([tlslite.X509().parse(cert)])
|
||||
key_parsed = tlslite.parsePEMKey(key, private=True)
|
||||
print(key_parsed)
|
||||
#print(key_parsed)
|
||||
s_conn.handshakeServer(certChain=chain, privateKey=key_parsed, reqCert=False, alpn=[ALPN])
|
||||
|
||||
print("Handling connection")
|
||||
|
|
Loading…
Reference in a new issue