Skip to content

Instantly share code, notes, and snippets.

@sunfkny
Created February 24, 2024 11:31
Show Gist options
  • Save sunfkny/fe5a693d136495f40f1c961131b63aab to your computer and use it in GitHub Desktop.
Save sunfkny/fe5a693d136495f40f1c961131b63aab to your computer and use it in GitHub Desktop.
get oss-browser AK Histories
import json
import os
import pathlib
import sqlite3
from pprint import pprint
# pip install javascript
from javascript import require
crypto = require("crypto")
def decipher(encrypted: str) -> str:
decrypted = ""
decipher = crypto.createDecipher("aes192", "x82m#*lx8vv")
decrypted += decipher.update(encrypted, "hex", "utf8")
decrypted += decipher["final"]("utf8")
return decrypted
db_path = pathlib.Path(os.environ["APPDATA"]) / "oss-browser" / "Local Storage" / "file__0.localstorage"
assert db_path.exists()
db = sqlite3.connect(db_path)
cursor = db.cursor()
cursor.execute("SELECT value FROM ItemTable where key = 'auth-his'")
result: tuple[bytes] = cursor.fetchone()
value = result[0].decode("utf16")
auth_his = decipher(value)
pprint(json.loads(auth_his))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment