rix4uni/oosexclude
GitHub: rix4uni/oosexclude
基于正则和 glob 模式列表对子域名进行排除或包含过滤的命令行工具,帮助安全测试人员快速收敛目标范围。
Stars: 5 | Forks: 2
## oosexclude
使用排除 (`--egrep`) 或包含 (`--grep`) 模式列表过滤子域名,支持 glob 通配符和完整的正则表达式。
## 安装
```
go install github.com/rix4uni/oosexclude@latest
```
## 下载预编译二进制文件
```
wget https://github.com/rix4uni/oosexclude/releases/download/v0.0.4/oosexclude-linux-amd64-0.0.4.tgz
tar -xvzf oosexclude-linux-amd64-0.0.4.tgz
rm -rf oosexclude-linux-amd64-0.0.4.tgz
mv oosexclude ~/go/bin/oosexclude
```
或者下载适用于您平台的[二进制发布版](https://github.com/rix4uni/oosexclude/releases)。
## 从源码编译
```
git clone --depth 1 https://github.com/rix4uni/oosexclude.git
cd oosexclude; go install
```
## 使用方法
```
Usage of oosexclude:
--egrep string Path to exclude list file or URL (default "https://raw.githubusercontent.com/rix4uni/scope/refs/heads/main/data/outofscope.txt")
--grep string Path to include list file or URL
--ignore-case Match patterns case-insensitively
--stats Print filtering stats to stderr after processing
--version Print the version of the tool and exit.
```
## 使用示例
```
# 使用默认的排除列表 URL
cat allsubs.txt | oosexclude
# 指定自定义的排除列表文件
cat allsubs.txt | oosexclude --egrep match-list.txt
# 指定自定义的包含列表文件
cat allsubs.txt | oosexclude --grep match-list.txt
# 单个内联 pattern
cat allsubs.txt | oosexclude --egrep "v[1-9].hack.com"
cat allsubs.txt | oosexclude --grep "v[1-9].hack.com"
# 多个内联 pattern(以逗号分隔)
cat allsubs.txt | oosexclude --egrep "v[1-9].hack.com, argocd.*.uidapi.com, *dev.ibotta.com"
cat allsubs.txt | oosexclude --grep "v[1-9].hack.com, argocd.*.uidapi.com, community.rapyd.net"
# 不区分大小写的匹配
cat allsubs.txt | oosexclude --egrep match-list.txt --ignore-case
cat allsubs.txt | oosexclude --grep match-list.txt --ignore-case
# 显示过滤统计信息
cat allsubs.txt | oosexclude --egrep match-list.txt --stats
```
## 输出示例
已知:
```
allsubs.txt:
_acme-challenge.hack.com
api.dev-us.hack.com
api.hack.com
auth-v2.hack.com
_autodiscover.hack.com
beta-login.hack.com
cdn-assets.hack.com
client-portal.hack.com
db-admin.internal.hack.com
dev-api.hack.com
edge-eu-west.hack.com
files.backup.hack.com
grafana.monitoring.hack.com
img.cdn.hack.com
jenkins-ci.hack.com
k8s-master01.hack.com
mail01.hack.com
mobile-app.hack.com
mta-sts.hack.com
node-1.cluster.hack.com
pre-prod.hack.com
s3-upload.hack.com
secure.payments.hack.com
shop.api-v2.hack.com
smtp-relay.hack.com
staging.api.hack.com
static-v1.hack.com
test123.hack.com
uat.portal.hack.com
vpn-gateway.hack.com
auth-v2.hack.com
shop.api-v2.hack.com
static-v1.hack.com
community.myfitnesspal.com
community-stage.myfitnesspal.com
img.allin.movilepay.com
dashboard.rapyd.net
argocd.test.uidapi.com
techdev.ibotta.com
exchange.bullish.com
```
使用:
```
match-list.txt:
v[1-9].hack.com
community*.myfitnesspal.com
*.allin.movilepay.com
*.starsoft.movilepay.com
community.rapyd.net
argocd.*.uidapi.com
*dev.ibotta.com
*.bullish.com
```
命令(`--egrep` 移除匹配任何模式的行):
```
cat allsubs.txt | oosexclude --egrep match-list.txt
```
输出:
```
_acme-challenge.hack.com
api.dev-us.hack.com
api.hack.com
_autodiscover.hack.com
beta-login.hack.com
cdn-assets.hack.com
client-portal.hack.com
db-admin.internal.hack.com
dev-api.hack.com
edge-eu-west.hack.com
files.backup.hack.com
grafana.monitoring.hack.com
img.cdn.hack.com
jenkins-ci.hack.com
k8s-master01.hack.com
mail01.hack.com
mobile-app.hack.com
mta-sts.hack.com
node-1.cluster.hack.com
pre-prod.hack.com
s3-upload.hack.com
secure.payments.hack.com
smtp-relay.hack.com
staging.api.hack.com
test123.hack.com
uat.portal.hack.com
vpn-gateway.hack.com
dashboard.rapyd.net
```
命令(`--grep` 仅保留匹配任何模式的行,匹配部分在终端中高亮显示):
```
cat allsubs.txt | oosexclude --grep match-list.txt
```
输出:
```
auth-v2.hack.com
shop.api-v2.hack.com
static-v1.hack.com
auth-v2.hack.com
shop.api-v2.hack.com
static-v1.hack.com
community.myfitnesspal.com
community-stage.myfitnesspal.com
img.allin.movilepay.com
argocd.test.uidapi.com
techdev.ibotta.com
exchange.bullish.com
```
命令(`--stats` 打印摘要信息到 stderr):
```
cat allsubs.txt | oosexclude --egrep match-list.txt --stats
```
Stderr 输出:
```
[stats] input: 40 kept: 28 removed: 12
```
标签:Bug Bounty, CLI, EVTX分析, GitHub, Glob匹配, Go语言, WiFi技术, 二进制发布, 占用监测, 可自定义解析器, 子域名过滤, 开源工具, 数据展示, 文本处理, 日志审计, 白名单, 目标范围限定, 程序破解, 红队, 网络安全, 资产管理, 隐私保护, 黑名单