{"id":15198660,"url":"https://github.com/noclin/localstorage-recovery","last_synced_at":"2025-10-28T10:32:51.903Z","repository":{"id":119142009,"uuid":"181681526","full_name":"NoCLin/localStorage-recovery","owner":"NoCLin","description":"一次恢复Chromium的LocalStorage (LevelDB)实践。务必谨慎删除，幸好还能恢复~","archived":false,"fork":false,"pushed_at":"2020-02-16T07:14:09.000Z","size":6,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T14:13:40.679Z","etag":null,"topics":["chrome","chromium","electron","ldb","leveldb","localstorage","recovery","restore","undelete"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NoCLin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-16T12:05:18.000Z","updated_at":"2024-08-23T03:43:03.000Z","dependencies_parsed_at":"2023-07-10T00:01:35.840Z","dependency_job_id":null,"html_url":"https://github.com/NoCLin/localStorage-recovery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoCLin%2FlocalStorage-recovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoCLin%2FlocalStorage-recovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoCLin%2FlocalStorage-recovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoCLin%2FlocalStorage-recovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NoCLin","download_url":"https://codeload.github.com/NoCLin/localStorage-recovery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238638095,"owners_count":19505531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","chromium","electron","ldb","leveldb","localstorage","recovery","restore","undelete"],"created_at":"2024-09-28T01:23:56.646Z","updated_at":"2025-10-28T10:32:46.504Z","avatar_url":"https://github.com/NoCLin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# localStorage 数据恢复\n\n适用于Chrome、Chromium、Electron等软件\n\n## 数据文件\n\nLocalStorage 文件存储位置：{APP_DATA_DIR}/Default/Local Storage/leveldb\n\nlocalStorage 使用 LevelDB 作为底层数据库\n\n```\nleveldb\n├── 000003.ldb\n├── 000014.ldb\n├── 000077.ldb\n├── 000080.log\n├── CURRENT\n├── LOCK\n├── LOG\n├── LOG.old\n└── MANIFEST-000079\n```\n\n其中 若干`*.ldb`存储了若干版本的数据，可从此处恢复。\n\n请参考：https://antimatter15.com/2015/12/recovering-deleted-data-from-leveldb/\n\n## 示例数据\n\nbytearray：`b'\\x00,{\\x8cN!k\\x84vpenc'` \n\nUnicode：`\\u7b2c\\u4e8c\\u6b21\\u7684\\u6570\\u636e`\n\n中文：第二次的数据\n\n\n程序输出：\n```\n(bytearray(b'_file://\\x00\\x01message'), bytearray(b'\\x00,{\\x8cN!k\\x84vpenc'))\n['0x7b2c', '0x4e8c', '0x6b21', '0x7684', '0x6570', '0x636e']\n第二次的数据\n```\n\n## 解码处理\n\n1. 去掉第一个\\x00 \n2. 剩余bytes 两两倒序以hex组合成一个Unicode (`,{` == `\\x2c\\x7b` =\u003e `\\u7b2c` =\u003e `第`)\n\n## 工具链\n\n- unicode编码解码: http://www.jsons.cn/unicode/ \n- ldbdump : \n    \n    用于从ldb文件dump出数据，但是会直接输出内容而不是byte array，需要手工修改源码不输出明文字符。\n    \u003e 然后 ldbdump xxxxxx.ldb \u003e raw.file 可以发现 raw.file 里面是明文字符了，但是如果原来的数据含有中文或者二进制内容，那么导出文件不好用php处理\n\n    请参考：https://blog.csdn.net/gold2008/article/details/70837495\n    \n- leveldb python leveldb库\n    \u003e 这个库只能读取文件夹，不能读取.ldb文件，因此最好使用ldbdump读取\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoclin%2Flocalstorage-recovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoclin%2Flocalstorage-recovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoclin%2Flocalstorage-recovery/lists"}