Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
try to extract binary plist from other files
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