bplist-python
bplist-python copied to clipboard
Error trying to read bplist from iPhone backup database
I've extracted bplist data from a sqlite row of data from iTunes backup. When I try to parse it like this: BPListReader.plistWithString(bplist_str)
I get this error:
python2.7/site-packages/bplist/bplist.py", line 147, in __unpackItem
obj_type, obj_info = (obj_header & 0xF0), (obj_header & 0x0F)
TypeError: unsupported operand type(s) for &: 'str' and 'int'
Did a little inspecting in pdb:
(Pdb) !type(obj_header)
<type 'str'>
(Pdb) !len(obj_header)
1
(Pdb) !obj_header
'\xd4'
(Pdb) !obj_type, obj_info = (obj_header & 0xF0), (obj_header & 0x0F)
*** TypeError: unsupported operand type(s) for &: 'str' and 'int'
I rather not share the bplist data since I don't what personal data is in it but If I save the bplist data to a file and preview in finder, it's able to parse the data:
with open('/temp/blist-test.plist', 'w') as f:
f.write(bplist_str)
I wonder if it's because some python typing changes – I last touched this code about 10 years ago and it seemed pretty stable.
I don't have a mac at hand to verify this right now but I wonder if
obj_header = self.data[offset]
should say
obj_header = ord(self.data[offset])