From 0a901fb7a6146a8e3a134063f41e09bf0d8339ad Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Thu, 6 Apr 2023 12:49:27 -0400 Subject: [PATCH] minor things --- config.py | 23 +++++++++++++++++++++++ courier.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..52701a3 --- /dev/null +++ b/config.py @@ -0,0 +1,23 @@ +import requests +import plistlib + +#CONFIG_URL = "http://init-p01st.push.apple.com/bag" +CONFIG_URL = "https://init.push.apple.com/bag" + +def get_config(): + + r = requests.get(CONFIG_URL, verify=False) + if r.status_code != 200: + raise Exception("Failed to get config") + + # Parse the config as a plist + config = plistlib.loads(r.content) + + # Parse the nested "bag" as a plist + #config["bag"] = plistlib.loads(config["bag"]) + + return config + +if __name__ == "__main__": + config = get_config() + print(config) \ No newline at end of file diff --git a/courier.py b/courier.py index f9422b0..dcfd94d 100644 --- a/courier.py +++ b/courier.py @@ -4,8 +4,8 @@ import socket COURIER_HOST = "10-courier.push.apple.com" COURIER_PORT = 5223 -#ALPN = [b"apns-security-v2"] -ALPN = None +ALPN = [b"apns-security-v2"] +#ALPN = None def connect(private_key=None, cert=None): # If we don't have a private key or certificate, generate one