Skip to content

Instantly share code, notes, and snippets.

@hyuunnn
Last active October 11, 2018 03:07
Show Gist options
  • Save hyuunnn/1e545e994c418c9cd0ac2f50bec4c166 to your computer and use it in GitHub Desktop.
Save hyuunnn/1e545e994c418c9cd0ac2f50bec4c166 to your computer and use it in GitHub Desktop.
RecentFileCache.bcf parser
import binascii
import struct
class REC():
def __init__(self):
self.signature = b'\xfe\xff\xee\xff\x11\x22\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00'
self.data = open("RecentFileCache.bcf","rb").read()
self.data_size = len(self.data)
self.offset = 20
def run(self):
# https://github.com/libyal/assorted/blob/master/documentation/RecentFileCache.bcf%20format.asciidoc
if self.signature == self.data[:16]:
print("checksum : {}".format(self.data[16:20]))
while self.offset < self.data_size:
string_length = struct.unpack("<L",self.data[self.offset:self.offset+4])[0]
string = self.data[self.offset+4:self.offset+4+string_length*2+2] # +2 == null byte (2bytes utf-16)
print("string : {}".format(string.decode("utf-16-le")))
self.offset = self.offset+4+string_length*2+2 # +2 == null byte (2bytes utf-16)
if __name__ == '__main__':
a = REC()
a.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment