From f44f2f32acebd6cd0045c8ee99cf48533ebfd7c0 Mon Sep 17 00:00:00 2001 From: nodemixaholic Date: Tue, 30 Jan 2024 17:33:30 +0000 Subject: [PATCH] Upload files to '' --- bags.py | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/bags.py b/bags.py index b1468ee..375b930 100644 --- a/bags.py +++ b/bags.py @@ -10,7 +10,7 @@ def apns_init_bag_old(): if OLD_APNS_BAG is not None: return OLD_APNS_BAG - + r = requests.get("https://init.push.apple.com/bag", verify=False) if r.status_code != 200: raise Exception("Failed to get APNs init bag") @@ -32,7 +32,7 @@ def apns_init_bag(): if APNS_BAG is not None: return APNS_BAG - + r = requests.get("http://init-p01st.push.apple.com/bag", verify=False) if r.status_code != 200: raise Exception("Failed to get APNs init bag 2") @@ -53,7 +53,7 @@ def ids_bag(): if IDS_BAG is not None: return IDS_BAG - + r = requests.get( "https://init.ess.apple.com/WebObjects/VCInit.woa/wa/getBag?ix=3", verify=False ) @@ -71,16 +71,35 @@ def ids_bag(): return bag +GRANDSLAM_BAG = None +def grandslam_bag(): + global GRANDSLAM_BAG + + if GRANDSLAM_BAG is not None: + return GRANDSLAM_BAG + + import icloud.gsa as gsa + + r = requests.get( + "https://gsa.apple.com/grandslam/GsService2/lookup", verify=False, + headers = { + # We have to provide client info so that the server knows which version of the bag to give us + "X-Mme-Client-Info": gsa.build_client(), + "User-Agent": gsa.USER_AGENT, + } + ) + if r.status_code != 200: + raise Exception("Failed to get Grandslam bag: " + r.status_code) + + GRANDSLAM_BAG = plistlib.loads(r.content) + + return GRANDSLAM_BAG + + if __name__ == "__main__": # config = get_config() # print(config) # print(apns_init_bag_2()) # print(apns_init_bag_2() == apns_init_bag()) - bag = ids_bag() - for key in bag: - # print(key) - # print(bag[key]) - if type(bag[key]) == str: - if "http" in bag[key]: - print(key, bag[key]) + print(grandslam_bag()) \ No newline at end of file