From 26e4257cacc54006e28f9f937da74936cea17649 Mon Sep 17 00:00:00 2001 From: JJTech0130 Date: Mon, 10 Apr 2023 20:22:26 -0400 Subject: [PATCH] use json to make the output a bit nicer --- ids.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ids.py b/ids.py index 65101bd..00cd4e7 100644 --- a/ids.py +++ b/ids.py @@ -105,4 +105,17 @@ body = response['b'] body = zlib.decompress(body, 16 + zlib.MAX_WBITS) body = plistlib.loads(body) -print(f"Body: {body}") \ No newline at end of file +# Recurse over the entire body, replacing all bytes with base64 encoded strings +def recurse(obj): + if isinstance(obj, bytes): + return b64encode(obj).decode() + elif isinstance(obj, dict): + return {k: recurse(v) for k, v in obj.items()} + elif isinstance(obj, list): + return [recurse(v) for v in obj] + return obj + +body = recurse(body) + +import json +print(json.dumps(body, indent=4)) \ No newline at end of file