Skip to content

Instantly share code, notes, and snippets.

@zhouyunao
Last active September 15, 2021 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhouyunao/91f3aa8d435afbf9a22e5d5df9ce6267 to your computer and use it in GitHub Desktop.
Save zhouyunao/91f3aa8d435afbf9a22e5d5df9ce6267 to your computer and use it in GitHub Desktop.
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