mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2024-12-24 20:02:31 -06:00
print ROOT for root connection
This commit is contained in:
parent
d30c397300
commit
6cfdab8af0
2 changed files with 19 additions and 3 deletions
17
printer.py
17
printer.py
|
@ -113,16 +113,31 @@ def pretty_print_payload(prefix, payload: tuple[int, list[tuple[int, bytes]]]) -
|
||||||
print(f" {bcolors.WARNING}Token{bcolors.ENDC}: {b64encode(_get_field(payload[1], 1)).decode()}", end="")
|
print(f" {bcolors.WARNING}Token{bcolors.ENDC}: {b64encode(_get_field(payload[1], 1)).decode()}", end="")
|
||||||
if _get_field(payload[1], 0x0c):
|
if _get_field(payload[1], 0x0c):
|
||||||
print(f" {bcolors.OKBLUE}SIGNED{bcolors.ENDC}", end="")
|
print(f" {bcolors.OKBLUE}SIGNED{bcolors.ENDC}", end="")
|
||||||
|
if _get_field(payload[1], 0x5) and int.from_bytes(_get_field(payload[1], 0x5)) & 0x4:
|
||||||
|
print(f" {bcolors.FAIL}ROOT{bcolors.ENDC}", end="")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
#for field in payload[1]:
|
||||||
|
# print(f"Field ID: {field[0]}")
|
||||||
|
# print(f"Field Value: {field[1]}")
|
||||||
|
|
||||||
|
# 65 (user) or 69 (root)
|
||||||
|
|
||||||
for i in range(len(payload[1])):
|
for i in range(len(payload[1])):
|
||||||
|
#if payload[1][i][0] == 5:
|
||||||
|
#if payload[1][i][1] == b'\x00\x00\x00A': # user
|
||||||
|
# payload[1][i][1] = b'\x00\x00\x00E'
|
||||||
|
#elif payload[1][i][1] == b'\x00\x00\x00E': # root
|
||||||
|
# payload[1][i][1] = b'\x00\x00\x00A'
|
||||||
|
#else:
|
||||||
|
# print("Unknown field value: ", payload[1][i][1])
|
||||||
if payload[1][i][0] == 1:
|
if payload[1][i][0] == 1:
|
||||||
pass
|
pass
|
||||||
#payload[1][i] = (None, None)
|
#payload[1][i] = (None, None)
|
||||||
#payload[1][i] = (1, b64decode("D3MtN3e18QE8rve3n92wp+CwK7u/bWk/5WjQUOBN640="))
|
#payload[1][i] = (1, b64decode("D3MtN3e18QE8rve3n92wp+CwK7u/bWk/5WjQUOBN640="))
|
||||||
|
|
||||||
out = apns._serialize_payload(payload[0], payload[1])
|
out = apns._serialize_payload(payload[0], payload[1])
|
||||||
return out
|
#return out
|
||||||
elif id == 0xc:
|
elif id == 0xc:
|
||||||
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Keep Alive{bcolors.ENDC}")
|
print(f"{bcolors.OKGREEN}{prefix}{bcolors.ENDC}: {bcolors.OKCYAN}Keep Alive{bcolors.ENDC}")
|
||||||
elif id == 0xd:
|
elif id == 0xd:
|
||||||
|
|
|
@ -54,8 +54,9 @@ def proxy(conn1: tlslite.TLSConnection, conn2: tlslite.TLSConnection, prefix: st
|
||||||
#print(prefix, data)
|
#print(prefix, data)
|
||||||
# Write the data to the second connection
|
# Write the data to the second connection
|
||||||
conn2.write(data)
|
conn2.write(data)
|
||||||
except Exception as e:
|
except OSError as e:
|
||||||
pass # Probably a connection closed error
|
if e.errno == 9:
|
||||||
|
pass # Probably a connection closed error
|
||||||
print("Connection closed")
|
print("Connection closed")
|
||||||
# Close the connections
|
# Close the connections
|
||||||
conn1.close()
|
conn1.close()
|
||||||
|
|
Loading…
Reference in a new issue