5

I'm trying to access leveldbs generated by Chrome storing indexeddbs. I get keys and values. But they are either in an unknown encoding - I've tried many ways to detect them - or they are scrambled in some way.

import plyvel    
db = plyvel.DB(dirname, comparator=cmp, comparator_name="idb_cmp1")
for key, value in db:
    print(key) 
    print(value)

I don't mind if the keys are in random order as described here. But it would be nice to get the keys and values in a readable fashion. I'm not dealing with binary data in the leveldb, either.

I'm using plyvel in python to iterate over the db. This answer might be related: LevelDB C iterator

Community
  • 1
  • 1
Dej
  • 271
  • 3
  • 10
  • 1
    I guess you can't. "The design of LevelDB is such that the same comparator must be used when opening a LevelDB that was used to create it." https://codereview.chromium.org/213263004 – Dej Jan 11 '17 at 10:13

1 Answers1

1

you may fake it by passing exactly the same comparator name to a custom comparator in plyvel. that comparator may work differently from the one originally used to create the database. that would get you past the first hurdle i guess.

but since leveldb does not provide a read-only mode of operation, there may be a background thread kicking in to do some compaction while you read the database. and since the comparator is mishaving, this can lead to data loss and destruction of your database.

wouter bolsterlee
  • 3,879
  • 22
  • 30