参数对照仓库源码 cmd/finger.go、cmd/fofaext.go 校准,不是二手转载。 文件名按 Windows 版 Ehole-windows-amd64.exe 写,Linux/mac 把名字换成对应二进制即可。


0. 环境准备

# 三个文件必须同目录:二进制 / finger.json / config.ini
# finger.json 缺失 → [error] fingerprint file error!!! 直接退出

# 看总帮助
./Ehole-windows-amd64.exe -h

# 看子命令帮助
./Ehole-windows-amd64.exe finger -h
./Ehole-windows-amd64.exe fofaext -h

config.ini(只在用 FOFA 拉资产时需要):

Email=你的fofa邮箱
Fofa_token=你的fofa_api_key
Fofa_timeout=10

1. finger —— 指纹识别本体

# 单目标
./Ehole-windows-amd64.exe finger -u http://192.168.142.10:8080

# 批量(本地文件)
./Ehole-windows-amd64.exe finger -l url.txt

# 批量 + 导出 json
./Ehole-windows-amd64.exe finger -l url.txt -o result.json

# 批量 + 导出 xlsx + 提高并发
./Ehole-windows-amd64.exe finger -l url.txt -o result.xlsx -t 200

# 从 FOFA 按 IP / IP 段拉资产后识别
./Ehole-windows-amd64.exe finger -f 60.8.125.1/24
./Ehole-windows-amd64.exe finger -f 192.168.1.1

# 从 FOFA 按语法拉资产后识别
./Ehole-windows-amd64.exe finger -s 'app="Apache-Tomcat" && port="8080"'
./Ehole-windows-amd64.exe finger -s 'app="致远互联-OA"'

# 走 HTTP 代理(抓包 / 绕封 IP)
./Ehole-windows-amd64.exe finger -l url.txt -p http://127.0.0.1:7897

# 走 SOCKS5
./Ehole-windows-amd64.exe finger -l url.txt -p socks5://127.0.0.1:1080

# 生产环境稳一点:低并发 + 代理 + 落盘
./Ehole-windows-amd64.exe finger -l url.txt -t 30 -p http://127.0.0.1:7897 -o audit.xlsx

finger 参数表

参数 简写 说明
--url -u 单个目标
--local -l 本地资产文件,一行一个
--fip -f FOFA 按 IP/IP 段取资产,如 192.168.1.0/24
--fofa -s FOFA 按完整语法取资产
--output -o 导出结果,只认 .json / .xlsx 后缀
--thread -t 并发线程,默认 100
--proxy -p http:// 或 socks5:// 代理

2. fofaext —— 批量把 IP 换成 IP:PORT

# 文本里一堆 IP,去 FOFA 查开放端口,默认输出 results.xlsx
./Ehole-windows-amd64.exe fofaext -l ip.txt

# 指定输出文件(必须是 .xlsx)
./Ehole-windows-amd64.exe fofaext -l ip.txt -o results.xlsx

# 用 FOFA 语法直接拉
./Ehole-windows-amd64.exe fofaext -s 'app="Apache-Tomcat"' -o tomcat.xlsx

fofaext 参数表

参数 简写 默认 说明
--ipfile -l — 从文本读 IP,拿去 FOFA 搜索
--fofa -s — 从 FOFA 按语法提取
--output -o results.xlsx 只支持 .xlsx 后缀

产出用法的关键一步:打开 results.xlsx,把 host 列整列复制出来存成 url.txt,喂给 finger -l。


3. url.txt 格式规则

# 正确
http://192.168.142.10:8080
https://oa.example.com
192.168.142.11:9090        # 不含 http → 自动补 https://,失败再降级 http 重试
  • 行内含 http → 原样使用;不含 → 自动前置 https://,失败后自动改 http:// 重试(多耗约 10 秒)。
  • 空行会被拼成 https:// 然后报错,先清干净。
  • 不支持 # 注释,会被当域名解析。
  • 一行一个,不要空格;IPTORT、URL、URL+端口 都接受。

清洗用(Linux/mac):

sed -e 's/\r$//' -e '/^\s*$/d' -e 's/^\s*//;s/\s*$//' raw.txt | sort -u > url.txt

4. 输出格式与字段

终端每行:

[ url | cms | server | statuscode | length | title ]
  • cms 非空的会归入「重点资产」并红色高亮;空的是已探测但没认出系统。
  • 一个 URL 命中多条指纹时逗号拼接,如 致远OA,通用企业管理软件。
  • -o 导出的 json / xlsx 字段:url / cms / server / statuscode / length / title。

从 xlsx 里快速筛重点(Linux):

# 用 python 读出来按 cms 是否为空筛选(依赖 openpyxl)
python -c "
import openpyxl
wb=openpyxl.load_workbook('result.xlsx');ws=wb.active
for r in ws.iter_rows(min_row=2,values_only=True):
    if r[1]: print(r[0],'|',r[1])
"

5. 指纹维护 finger.json

{
    "cms": "致远OA",
    "method": "keyword",
    "location": "body",
    "keyword": ["/seeyon/USER-DATA/IMAGES/LOGIN/login.gif"]
}
{
    "cms": "CapRover",
    "method": "faviconhash",
    "location": "body",
    "keyword": ["988422585"]
}
{
    "cms": "某自研后台",
    "method": "regular",
    "location": "title",
    "keyword": ["^(运维|监控)平台\\s*v\\d"]
}
字段 取值 说明
cms 字符串 输出的系统名,可重复写多条规则命中同一系统
method keyword / faviconhash / regular README 里写的 regula 是文档笔误,代码只认 regular
location body / header / title 只在三处匹配;faviconhash 固定走 body 分支
keyword 字符串数组 与关系,全部命中才算;strings.Contains 匹配,大小写敏感

要点:

  • faviconhash = mmh3(int32, base64(图标字节,每 76 字符换行)),与 FOFA 的 icon_hash 同算法,数值可互填。
  • 图标获取顺序:页面 <link ...favicon...> 指向的文件 → 回退 /favicon.ico。
  • 加指纹挑带版本号或固定路径的静态特征,别用「XX系统」这种会被复用的通用词。
  • 改完 finger.json 用本机自建站点跑一遍 -u 验证,别直接上生产目标。

6. 蓝队检测用的流量特征(自查 / 写规则)

EHole 发出的请求是固定的,用于在 Nginx / WAF 日志里识别扫描:

UA         随机池(Win Chrome / Firefox / macOS Safari 轮换)
Cookie     rememberMe=me        ← 源码写死,最强单点特征(与 Shiro 利用无关)
Accept     */*;q=0.8
Connection close
路径       GET /  →  GET /favicon.ico
超时       10s,无重试
并发       默认 100

聚合口径建议:

同一源 IP,60 秒内请求的不同目标域名数 > 20       → 疑似批量指纹识别
出现 Cookie: rememberMe=me 且 UA 为上述池         → 强特征,直接告警
大量 GET / + /favicon.ico 且 Referer 为空         → 典型扫描指纹

7. 速查:坑与对策

现象 原因 对策
[error] fingerprint file error!!! finger.json 不在二进制同目录 放到同目录
批量扫描一条都不出 url.txt 有空行 / 缺协议 / 多目标同行 按第 3 节清洗
结果里大量无 cms 目标 SPA、或只认根路径 换指纹到 /,或用 EHole_magic 的 route 指纹
大片超时 目标有云 WAF,或本机带宽/会话被打满 -t 20~50、-p 走代理
指纹明明对但识别不到 大小写不一致;method 写成 regula 按实际 HTML 大小写抄;改成 regular
FOFA 拉取报错/额度不足 免费账号限额 换付费账号,或改用导出文件模式
-o out.txt 无输出 只支持 .json / .xlsx 换后缀