文件
fenleixinxi/tmp_img/read_cookies2.py
MiAn 133d425ec0 feat: 新增阿里云OSS适配器及分类图标优化
- 新增阿里云OSS SDK核心类库文件
- 新增OSS插件配置文件及钩子监听
- 新增分类图标SVG资源并优化为轻量化格式
- 替换定位接口为天地图逆地理编码接口
- 新增OSS图片缩略处理工具方法
2026-11-20 11:11:03 +08:00

58 行
1.9 KiB
Python

import sqlite3, os
# Fix: win32crypt
try:
import win32crypt
HAVE_WIN32 = True
except ImportError:
try:
from win32crypt import CryptUnprotectData
HAVE_WIN32 = True
def decrypt(enc):
try:
return CryptUnprotectData(enc[3:] if len(enc) > 3 else enc, None, None, None, 0)[1].decode('utf-8', errors='replace')
except: return None
except:
HAVE_WIN32 = False
def decrypt(enc):
if not HAVE_WIN32 or not enc: return None
try:
return CryptUnprotectData(enc[3:], None, None, None, 0)[1].decode('utf-8', errors='replace')
except Exception as e:
return None
dbs = [
'C:/Users/ywswe/AppData/Roaming/Trae/Network/Cookies',
'C:/Users/ywswe/AppData/Roaming/Trae/Partitions/trae-webview/Network/Cookies',
'C:/Users/ywswe/AppData/Roaming/Trae/Partitions/icube-web-crawler-shared-session-v1.0/Network/Cookies',
]
for db_path in dbs:
name = os.path.basename(os.path.dirname(os.path.dirname(db_path)))
print(f"\n=== {name} ===")
try:
# 只读打开
conn = sqlite3.connect(f'file:{db_path}?mode=ro', uri=True, timeout=1)
cur = conn.cursor()
cur.execute("SELECT host_key, name, value, encrypted_value FROM cookies")
rows = cur.fetchall()
conn.close()
except Exception as e:
print(f" open fail: {e}")
continue
hits = 0
for host, cname, val, enc_val in rows:
host_lower = host.lower()
if not any(k in host_lower for k in ['trae', 'icube', 'mchost', 'bytedance', 'byteos', 'feishu', 'lark']):
continue
if enc_val:
d = decrypt(enc_val)
if d: val = d
vshort = (val[:100] + '...') if len(val) > 100 else val
print(f" {host} [{cname}]")
print(f" = {vshort}")
hits += 1
if hits == 0: print(" (no matching cookies)")