remigius-labs/slopsquatscan

GitHub: remigius-labs/slopsquatscan

一款轻量级命令行工具,用于检测已安装包中可能被LLM臆造、恶意抢注或存在可疑特征的依赖项,帮助防范AI时代的供应链安全风险。

Stars: 0 | Forks: 0

``` _____ _ _____ _ _____ / ___| | / ___| | | / ___| \ `--.| | ___ _ __ \ `--. __ _ _ _ __ _| |_\ `--. ___ __ _ _ __ `--. \ |/ _ \| '_ \ `--. \/ _` | | | |/ _` | __|`--. \/ __/ _` | '_ \ /\__/ / | (_) | |_) /\__/ / (_| | |_| | (_| | |_/\__/ / (_| (_| | | | | \____/|_|\___/| .__/\____/ \__, |\__,_|\__,_|\__\____/ \___\__,_|_| |_| | | | | |_| |_| ``` **你是否盲目 `pip install` 过 LLM 臆造出来的东西?我也是。** SlopsquatScan 会根据真实的软件源检查你已安装的包,并告诉你是否有些包不该存在。它能检测出: - 在其软件源上**不存在**的包(即臆造的包) - **下载量低得可疑**的包(没人用这东西——为什么你要用?) - **全新**的包(昨天才发布,就已经在你机器上了?) ## 问题所在 LLM 会臆造包名。攻击者注册这些包名。你安装了它们。这就是所谓的 [slopsquatting](https://socket.dev/blog/slopsquatting-how-ai-hallucinations-are-fueling-a-new-class-of-supply-chain-attacks)。 ## 安装 ``` # 只需将其放在你的 PATH 上 git clone https://github.com/remigius-labs/slopsquatscan.git ln -s $(pwd)/slopsquatscan/slopsquatscan ~/.local/bin/slopsquatscan ``` **需要:** `bash`, `curl`, `jq` ## 用法 ``` slopsquatscan # scan everything slopsquatscan --npm # npm global packages only slopsquatscan --pip # pip packages only slopsquatscan --aur # AUR packages only (Arch Linux) slopsquatscan --verbose # also show clean packages ``` ## 检查内容 | 软件源 | 方式 | 标记条件 | |----------|-----|-------| | **npm** | `registry.npmjs.org` + 下载统计 | 未找到, 周下载量<100, 发布少于30天 | | **PyPI** | `pypi.org` + `pypistats.org` | 未找到, 周下载量<100, 发布少于30天 | | **AUR** | `aur.archlinux.org` RPC | 未找到, 投票数<5, 发布少于30天 | ## 输出示例 ``` thresholds: <100 dl/week = warning, <30d old = warning npm (global) ✓ express 35419280 dl/week ✓ typescript 54812903 dl/week ✗ node-fetch-utils NOT FOUND on npm registry ! http-colorize only 3 downloads/week pip ✓ requests 4891204 dl/week ✓ numpy 28534102 dl/week ✗ python-llm-helpers NOT FOUND on PyPI ! fastapi-colorlog first upload 4d ago AUR (foreign packages) ✓ spotify-launcher 312 votes ✓ visual-studio-code-bin 2891 votes Summary Clean: 6 Warnings: 2 Suspicious: 2 Action required: these packages were NOT FOUND on their registry: → npm:node-fetch-utils → pip:python-llm-helpers This could mean: typosquatted name, removed package, or private package. Investigate before continuing to use them. ``` ## 退出代码 | 代码 | 含义 | |------|---------| | `0` | 一切正常(或仅有警告) | | `1` | 发现可疑包——需调查 | ## 限制 - 仅检查全局安装的包(尚不支持检查项目级的 `node_modules`) - 下载阈值是硬编码的(正规的小众包可能会触发警告) - 需要网络访问以连接软件源 - 尚不支持检查 `cargo`、`gem` 或 `go` —— 欢迎 PR ## 许可证 MIT
标签:AUR, NPM安全, PyPI安全, Slopsquatting, Typosquatting, 依赖扫描, 包劫持, 大模型安全, 开发安全, 拼写劫持, 文档安全, 模型提供商, 软件开发工具包