Skip to content

bingling-sama/swsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Service Worker Storage X-ray

Read-only MVP for analyzing Microsoft Edge storage quota and Service Worker snapshots.

‼️Warn

Using this tool may cause your Edge profile and account LOGOUT. You may need to login and sync again after analyze.

Setup

npm install
cd engine && cargo test

Offline Analysis

mkdir -p out
cp fixtures/raw.json out/raw.json
bin/swsx --skip-collect

Real Collection

Close Microsoft Edge before collecting. By default, the tool scans the Edge User Data directory at $HOME/Library/Application Support/Microsoft Edge and outputs to ./out:

bin/swsx

To analyze a different profile:

bin/swsx --profile /path/to/other/profile

The MVP does not clear browser data, kill browser processes, or run destructive Chrome DevTools Protocol commands. Cleanup output is guidance only.

入口脚本与使用说明

主入口脚本为 bin/swsx(可直接执行)。脚本行为要点:

  • 会在开始采集前检查 Microsoft Edge 是否在运行;若检测到正在运行会退出并提示先关闭浏览器。
  • 默认 profile 为 $HOME/Library/Application Support/Microsoft Edge,输出目录默认 ./out
  • 支持参数 --profile--out--top--threshold--skip-collect--dry-run
  • 当未使用 --skip-collect 时,脚本会调用采集器 node collector/collect.mjs 进行数据抓取;采集完成后用 cargo run 启动 engine 进行分析并打印报告。

示例:

采集并分析(默认行为):

bin/swsx

仅分析现有 out/raw.json(跳过采集):

bin/swsx --skip-collect

指定 profile、输出目录与参数:

bin/swsx --profile "/path/to/profile" --out ./out --top 5 --threshold "100 MiB"

Dry-run 校验采集器启动参数:

bin/swsx --dry-run

示例输出

  1. 原始快照(采集器写入 out/raw.json,下面为裁剪后的示例片段):
{
 "capturedAt": "2026-05-14T00:00:00.000Z",
 "browser": "edge",
 "pages": {
  "quotaInternals": {
   "url": "edge://quota-internals",
   "html": "<table>...<tr><td>https://example.com</td><td>640 MiB</td><td>600 MiB</td></tr>..."
  },
  "serviceWorkerInternals": { "url": "edge://serviceworker-internals", "html": "<div class=\"serviceworker\">..." },
  "extensions": { "url": "edge://extensions", "html": "<extensions-item id=\"abc123def456\">Sample Extension</extensions-item>" }
 }
}
  1. 分析报告(实际运行输出,基于 fixtures/raw.json):
SWSX Report
========================

Parsed: 4 quota records, 2 service workers, 1 extensions
Total usage: 712.00 MiB

Top Storage Consumers
┌─────────────────────────────────┬────────────┬──────────────┬───────────┐
│ Origin                          ┆ Usage      ┆ CacheStorage ┆ Kind      │
╞═════════════════════════════════╪════════════╪══════════════╪═══════════╡
│ https://example.com             ┆ 640.00 MiB ┆ 600.00 MiB   ┆ Website   │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ chrome-extension://abc123def456 ┆ 42.00 MiB  ┆ 40.00 MiB    ┆ Extension │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ chrome-extension://missing999   ┆ 18.00 MiB  ┆ 18.00 MiB    ┆ Extension │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ https://orphan.test             ┆ 12.00 MiB  ┆ 1.00 MiB     ┆ Website   │
└─────────────────────────────────┴────────────┴──────────────┴───────────┘

Orphaned Storage Candidates
┌───────────────────────────────┬───────────┬──────────────┬───────────┐
│ Origin                        ┆ Usage     ┆ CacheStorage ┆ Kind      │
╞═══════════════════════════════╪═══════════╪══════════════╪═══════════╡
│ https://orphan.test           ┆ 12.00 MiB ┆ 1.00 MiB     ┆ Website   │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ chrome-extension://missing999 ┆ 18.00 MiB ┆ 18.00 MiB    ┆ Extension │
└───────────────────────────────┴───────────┴──────────────┴───────────┘

Cache Bloat Risk Candidates
┌─────────────────────┬────────────┬──────────────┬─────────┐
│ Origin              ┆ Usage      ┆ CacheStorage ┆ Kind    │
╞═════════════════════╪════════════╪══════════════╪═════════╡
│ https://example.com ┆ 640.00 MiB ┆ 600.00 MiB   ┆ Website │
└─────────────────────┴────────────┴──────────────┴─────────┘

Extension Residue Candidates
┌───────────────────────────────┬───────────┬──────────────┬───────────┐
│ Origin                        ┆ Usage     ┆ CacheStorage ┆ Kind      │
╞═══════════════════════════════╪═══════════╪══════════════╪═══════════╡
│ chrome-extension://missing999 ┆ 18.00 MiB ┆ 18.00 MiB    ┆ Extension │
└───────────────────────────────┴───────────┴──────────────┴───────────┘

Cleanup Guidance
- Inspect and clear site data for https://orphan.test from Edge settings. CDP reference only: Stor
age.clearDataForOrigin(origin: "https://orphan.test", storageTypes: "all")
- Inspect and clear site data for chrome-extension://missing999 from Edge settings. CDP reference 
only: Storage.clearDataForOrigin(origin: "chrome-extension://missing999", storageTypes: "all")
- Inspect and clear site data for https://example.com from Edge settings. CDP reference only: Stor
age.clearDataForOrigin(origin: "https://example.com", storageTypes: "all")
- Inspect and clear site data for chrome-extension://missing999 from Edge settings. CDP reference 
only: Storage.clearDataForOrigin(origin: "chrome-extension://missing999", storageTypes: "all")

快速开始(示例命令)

采集(在采集前请关闭 Edge):

node collector/collect.mjs --profile "$HOME/Library/Application Support/Microsoft Edge" --out out
# 或(仅做 dry-run 校验)
node collector/collect.mjs --profile /path/to/profile --dry-run

离线分析(使用现有 out/raw.json):

mkdir -p out
cp fixtures/raw.json out/raw.json
bin/swsx --skip-collect
# 或直接在 engine 目录运行(需先构建)
cd engine && cargo run -- --input ../fixtures/raw.json --top 10 --threshold "500 MiB"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors