基于时间差异和认证响应的SSH用户枚举脚本。利用与CVE-2018-15473相同的攻击向量,适用于易受攻击的OpenSSH版本(≤ 7.7),但也可能在现代配置中揭示模式。 使用Python 3 + Paramiko,支持:
预读取Banner以避免EOF/NoBanner错误。
每次尝试的重试次数和用户间的冷却时间(用于规避tarpit/MaxStartups)。
根据目标抖动自动调节参数(-m、-t)。
⚠️ 使用伦理
此脚本只能在自有环境或获得明确授权的情况下使用。 未经许可滥用外部系统可能违法。
📖 基本用法 ./ssh_enum_py3.py -i -u users.txt -m <multiplier_ms> -t
示例: ./ssh_enum_py3.py -i 149.210.234.234 -u users.txt -m 5000 -t 8
⚙️ 选项 -i, --ip 目标主机/IP(必填) -p, --port SSH端口(默认:22) -u, --userlist 用户列表文件(每行一个用户)
-a, --autotune 计算推荐参数(multiplier和threshold) -m, --multiplier 超过本地中位数的毫秒阈值 -t, --threshold 最小“投票”数(超过截止线的尝试次数)
--attempts 每用户尝试次数(默认:12) --timeout 连接/认证超时时间(秒,默认:6) --banner-timeout 读取SSH Banner超时时间(秒,默认:12) --delay 同一用户尝试之间的暂停(秒,默认:0.6) --cooldown-users 用户之间的暂停(秒,默认:0) --retries 因Banner/传输错误时每次尝试的重试次数
🚀 使用示例
输出: [*] Autotune sugerido: multiplier (ms): 4986 threshold : 8 baseline_med : 3586 ms (avg=3596 ms) error mix : {'AuthFailed': 12}
自动调优 + 同次运行中枚举
./ssh_enum_py3.py -i 149.210.234.234 -a -u users.txt
--timeout 12 --banner-timeout 30 --delay 3 --cooldown-users 15
使用固定参数直接枚举
./ssh_enum_py3.py -i 149.210.234.234 -u users.txt -m 4986 -t 8
--attempts 10 --timeout 12 --banner-timeout 30 --retries 5 --delay 3 --cooldown-users 15
📋 结果解读
likely VALID → 用户可能存在(超过截止线的尝试次数≥threshold)。
likely INVALID → 用户可能不存在(一致响应如“AuthFailed”)。
errors={...} → 错误码摘要:
AuthFailed: SSH正常响应。
NoBanner: 服务器在Banner前断开连接(tarpit、MaxStartups、WAF)。
TransportError: 网络/超时错误。