Getting data inside a google Chrome IndexedDB from Bash or Python

亡梦爱人 提交于 2020-06-28 04:20:34

问题


I have LevelDB (IndexedDB) file from my Google Chrome, the file is located in this folder:

/home/<user>/.config/google-chrome/Default/IndexedDB/https_<site>_0.indexeddb.leveldb/

The folder content is:

$ ls
000005.ldb  000006.log  CURRENT  LOCK  LOG  MANIFEST-000001

And I have a very simple python script for opening it:

#!/bin/python
import leveldb
db = leveldb.LevelDB('./000005.ldb')

Now I always get this error:

leveldb.LevelDBError: IO error: ./000005.ldb/LOCK: Not a directory

Does anyone have information about how correctly access the data stored in my IndexDB files? Basically, I just need to get the same information like from the 'Developers Tool' view but using Bash or Python.


回答1:


You have to open the directory with this API, not a file. Also it worth noting that using plyvel library is probably better:

import plyvel
db = plyvel.DB('/home/<user>/.config/google-chrome/Default/IndexedDB/https_<site>_0.indexeddb.leveldb')
for key, value in db:
    print("{0} : {1}".format(key, value)) 


来源:https://stackoverflow.com/questions/53704997/getting-data-inside-a-google-chrome-indexeddb-from-bash-or-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!