Last active
September 15, 2021 16:04
-
-
Save zhouyunao/91f3aa8d435afbf9a22e5d5df9ce6267 to your computer and use it in GitHub Desktop.
try to extract binary plist from other files
This file contains 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
import struct | |
import sys | |
def parser(data,base): | |
offset_size, object_ref_size, number_of_objects, top_object, table_offset = struct.unpack('!6xBB4xI4xI4xI', data[base:base+32]) | |
size = 0x20 + offset_size * number_of_objects + table_offset | |
start = base - (size - 0x20) | |
# if start < 0: | |
# print(hex(start)) | |
# return | |
try: | |
if data[start:start+8] == b"bplist00": | |
# print(hex(start)) | |
with open(str(hex(start))+".bplist","wb") as f: | |
f.write(data[start:start+size]) | |
return | |
else: | |
return | |
except: | |
print("error") | |
return | |
args = sys.argv | |
print(args[1]) | |
with open(args[1],"rb") as f: | |
fdata = f.read() | |
print("size is {}".format(str(len(fdata)))) | |
for idx in range(len(fdata)-32): | |
parser(fdata,idx) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment