Example #1
0
def main():
    with open(sys.argv[1], 'r') as f:
        with contextlib.closing(mmap.mmap(f.fileno(), 0,
                                          access=mmap.ACCESS_READ)) as buf:
            offset = buf.find("LfLe", 0x8)  # skip header
            if offset == -1:
                print "Record not found"
                return -1
            record = Record(buf, offset - 0x4)

            print(hex_dump(buf[record.offset():record.offset() + record.length()]))

            print(record.get_all_string(indent=0))
def main():
    with open(sys.argv[1], 'r') as f:
        with contextlib.closing(
                mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)) as buf:
            offset = buf.find("LfLe", 0x8)  # skip header
            if offset == -1:
                print "Record not found"
                return -1
            record = Record(buf, offset - 0x4)

            print(
                hex_dump(buf[record.offset():record.offset() +
                             record.length()]))

            print(record.get_all_string(indent=0))
Example #3
0
def main():
    with open(sys.argv[1], 'r') as f:
        with contextlib.closing(mmap.mmap(f.fileno(), 0,
                                          access=mmap.ACCESS_READ)) as buf:
            offset = buf.find("\x11\x11\x11\x11\x22\x22\x22\x22\x33\x33\x33\x33\x44\x44\x44\x44")
            if offset == -1:
                print "Cursor not found"
                return -1
            if offset < 0x4:
                print "Cursor in unexpected location: %s" % hex(offset)
                return -2
            cursor = Cursor(buf, offset - 0x4)

            print(hex_dump(buf[cursor.offset():cursor.offset() + cursor.length()]))

            print(cursor.get_all_string(indent=0))
Example #4
0
def main():
    with open(sys.argv[1], 'r') as f:
        with contextlib.closing(mmap.mmap(f.fileno(), 0,
                                          access=mmap.ACCESS_READ)) as buf:
            offset = 0x8
            offset = buf.find("LfLe", offset)  # skip header
            while offset != -1:
                try:
                    record = Record(buf, offset - 0x4)
                except OverrunBufferException:
                    break
                print(hex_dump(buf[record.offset():record.offset() + record.length()]))
                print(record.get_all_string(indent=0))
                if record.length() > 0x100:
                    offset = buf.find("LfLe", offset + 1)
                else:
                    offset = buf.find("LfLe", offset + record.length())
Example #5
0
def main():
    with open(sys.argv[1], 'r') as f:
        with contextlib.closing(
                mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)) as buf:
            offset = buf.find(
                "\x11\x11\x11\x11\x22\x22\x22\x22\x33\x33\x33\x33\x44\x44\x44\x44"
            )
            if offset == -1:
                print "Cursor not found"
                return -1
            if offset < 0x4:
                print "Cursor in unexpected location: %s" % hex(offset)
                return -2
            cursor = Cursor(buf, offset - 0x4)

            print(
                hex_dump(buf[cursor.offset():cursor.offset() +
                             cursor.length()]))

            print(cursor.get_all_string(indent=0))