Created
May 21, 2023 14:37
-
-
Save dedoussis/3ad084a5c9a50430de520e8e165021ca to your computer and use it in GitHub Desktop.
Retrieve local anisette data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import json | |
import typing as t | |
import objc | |
from Foundation import NSBundle, NSClassFromString, NSISO8601DateFormatter, NSDate, NSTimeZone | |
from AppKit import * | |
AOSKitBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/AOSKit.framework') | |
objc.loadBundleFunctions(AOSKitBundle, globals(), [("retrieveOTPHeadersForDSID", b''), ("machineSerialNumber", b'')]) | |
def headers() -> t.Mapping[str, str]: | |
aos_utils = NSClassFromString('AOSUtilities') | |
date_formatter = NSISO8601DateFormatter.alloc().init() | |
date_string = date_formatter.stringFromDate_(NSDate.alloc().init()) | |
current_device = AKDevice.currentDevice() | |
otp_headers = aos_utils.retrieveOTPHeadersForDSID_("-2") | |
return { | |
'X-Apple-I-Client-Time': date_string, | |
'X-Apple-MD': otp_headers["X-Apple-MD"], | |
'X-Apple-MD-LU': current_device.localUserUUID(), | |
'X-Apple-MD-M': otp_headers["X-Apple-MD-M"], | |
'X-Apple-I-MD-RINFO': "0", | |
'X-Apple-I-SRL-NO': aos_utils.machineSerialNumber(), | |
'X-Apple-I-TimeZone': NSTimeZone.systemTimeZone().abbreviation(), | |
'X-Apple-Locale': current_device.locale().localeIdentifier(), | |
'X-MMe-Client-Info': current_device.serverFriendlyDescription(), | |
'X-Mme-Device-Id': current_device.uniqueDeviceIdentifier(), | |
} | |
def main() -> None: | |
json.dump(headers(), sys.stdout, indent=4) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment