Skip to content

Gary-yang1/baiyan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

baiyan · 资产测绘与指纹识别工具

An asset discovery & fingerprinting toolkit in Go

⚠️ 仅限授权安全测试与研究用途。请遵守当地法律法规。
⚠️ For authorized security testing & research only. You are responsible for legal compliance.


目录 · Table of Contents


简介 · Overview

baiyan 是一个用 Go 编写的自动化资产测绘与识别工具,覆盖子域名收集、空间引擎聚合、端口探测、HTTP 识别与指纹识别,并导出一份结构化 Excel 报告
baiyan is a Go-based automation tool for reconnaissance: subdomain discovery, search-engine aggregation, port scanning, HTTP probing, and fingerprint enrichment, exporting a structured Excel report.


功能特性 · Features

  • 子域名枚举 · Subdomain enumeration

    • subfinder(活跃/全量)
    • ksubdomain 字典爆破(同 IP 仅保留一个代表子域名)
    • 统一清洗:去除 =>、CNAME 链噪声
  • 空间引擎聚合 · Search engine aggregation

    • FOFA(带缓存):一次查询复用子域名与 URL 结果
    • 证书扩展(可选):cert="domain" 拉取新 IP
  • CDN 识别与规避 · CDN detection & avoidance

    • CDN 域名:仅对 80/443/8080/8880 做 httpx 探活
    • 非 CDN:解析公网 IPv4,进入端口扫描与后续流程
  • 端口探测 · Port scanning

    • 使用 masscan(全局去重:同一 IP 仅扫描一次)
  • HTTP 识别 · HTTP probing

    • httpx 采集 status/title/webserver
    • SNI 友好:优先以“代表域名”探测 IP 的开放端口
  • 指纹识别 · Fingerprinting

    • 集成 observer_ward(可选)
    • 自动 -u 更新 → 对 URL 列表批量识别
    • 清洗 ANSI 颜色码,仅保留指纹名字列表
  • 报告导出 · Report

    • 输出 Excel:子域名 / URL / 端口 / c 段统计 / 互联网 IP / title&指纹识别

工作流程 · Workflow

Targets (domain/ip/cidr)
      │
      ├─ Subdomains: subfinder(alive/all) + ksubdomain(dict)
      │      └─ Clean & dedupe: strip "=>", keep one sub per IP
      │
      ├─ Space engines: FOFA (cached)
      │      ├─ Subdomain aggregation
      │      └─ URL aggregation
      │
      ├─ CDN decision
      │      ├─ CDN: httpx fixed ports (80/443/8080/8880)
      │      └─ Non-CDN: public IPv4 → masscan → httpx
      │
      ├─ (optional) cert="domain" → new IPs → masscan+httpx
      │
      └─ ObserverWard → Excel

输出结果 · Outputs

生成 result.xlsx,包含以下 Sheet:
result.xlsx includes the following sheets:

  1. 子域名 / Subdomainssubdomain
  2. URLurl, status, title, webserver
  3. 端口 / Portshost, port, protohost 可能为代表域名或原始 IP)
  4. c段统计 / /24 Summary/24(出现次数 ≥ 3 的 /24 汇总)
  5. 互联网ip统计 / Public IPsip(去重后的公网 IPv4)
  6. title&指纹识别 / Title & FingerprintsURL, Title, 指纹(如 ecology-oa, 泛微-oa e-cology8

指纹解析会清洗颜色码与状态码,不写入 :443 等端口后缀。


安装与编译 · Install & Build

依赖 · Requirements

  • Go 1.20+
  • Linux(建议):masscan 需要 root 或 CAP_NET_RAW
  • 有效 FOFA 凭据(如启用)
  • 可访问外网下载依赖二进制

编译 · Build

git clone <this-repo>
cd baiyan
go build -o asf .

首次运行自动安装 · First-run Auto Installer

  • 创建 ./bin/ 并下载:httpx, masscan, subfinder, ksubdomain
  • 绝对路径./bin 追加到当前进程 PATH
  • 生成 .install_lock,下次启动跳过下载

如你自备工具或非 Linux/amd64,请自行替换 ./bin;删除 .install_lock 可触发重装。

可选:ObserverWard

  • 将可执行文件放到:./lib/ob/observer_ward
  • 程序会自动执行:
    ./lib/ob/observer_ward -u && ./lib/ob/observer_ward -f <urlfile> > ./lib/ob/ob_output.txt
  • 结果写入 Excel 的 title&指纹识别 Sheet

配置文件 · Configuration

./config/spaceConfig.ini(示例)

[FOFA API]
email = your-email@example.com
key   = your-fofa-api-key
fofa_nums = 1000

[Quake API]
x-quaketoken =   ; (当前未启用,可留空)

[Quake nums]
quake_nums = 100 ; (当前未启用)

其他:

  • ./config/subfinder-config.yaml:subfinder 的 provider 配置
  • ./dict/sub.dict:ksubdomain 爆破字典

使用示例 · Usage

基本用法 · Basic

./asf -f url.txt

url.txt 每行一个目标(域名 / IP / CIDR):

example.com
1.2.3.4
10.0.0.0/24

常用参数 · Common Flags

  • -f string 目标清单(必填)
  • -t int httpx 并发(默认 300
  • --rate int masscan 速率(默认 5000
  • --fast 仅空间引擎 + httpx,只导出 URL
  • --certscan 证书扩展(可能误报,谨慎)
  • --timeout duration 单目标最大时长(默认 15m
  • -o string Excel 输出(默认 result.xlsx
  • --debug 详细日志

示例 · Examples

全流程 / Full pipeline

sudo ./asf -f url.txt --certscan --debug

快速模式 / FAST mode

./asf -f url.txt --fast

自定义扫描速率 / Custom masscan rate

sudo ./asf -f url.txt --rate 10000

常见问题 · FAQ / Troubleshooting

  • 找不到子命令? 首次运行已把 ./bin 绝对路径加入本进程 PATH;若你单独运行子命令,请手动 export PATH="$(pwd)/bin:$PATH"
  • masscan 无法运行或无结果? 需要 root 或 CAP_NET_RAW;检查防火墙/丢包与 --rate
  • ksubdomain 无输出? 不同版本参数可能差异(-f vs -w, -rlist vs -r)。本项目默认 -f/-rlist
  • Excel 指纹为空或乱码? 我们已清洗 ANSI/状态码;若你的 observer_ward 输出格式不同,请开 issue 附样例。

路线图 · Roadmap

  • 集成 Quake 查询
  • 目录扫描(可选)
  • ObserverWard JSON 直出更完整适配
  • 更丰富字段与可视化

致谢 · Credits

第三方工具版权归原作者所有。


许可协议 · License

本项目的许可证见仓库根目录 LICENSE
See LICENSE in the repository root for details.


如果你觉得这个项目有用,欢迎 Star ⭐ 与 PR
If you find it helpful, please consider starring ⭐ the repo and sending PRs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages