一个 Python 3 脚本,使用两个文本文件作为输入,对目标 SSH 服务器执行字典/词表攻击。此脚本的编写目的是为了我的 Intel 技术筛选。
此脚本依赖于 Paramiko 和 Colorama。
通过 pip install -r requirements.txt 或 pip3 install -r requirements.txt 安装依赖。
端口 22,无尝试次数限制,也无锁定时间
python3 buffalo.py localhost users.txt passwords.txt
默认线程数为 100,可以使用 thread 标志提高或降低该数量。
python3 buffalo.py localhost users.txt passwords.txt --threads 200
在端口 2222 上指定服务
python3 buffalo.py localhost users.txt passwords.txt --port 2222
大多数系统在特定时间范围内对每个账户都设有某种尝试次数限制。为了避开这个限制,可以通过 --max_attempts 和 --lockout_period 标志限制每个账户的尝试次数。例如,将每个账户在 15 分钟内的尝试次数限制为 3 次。
python3 buffalo.py localhost users.txt passwords.txt --max_attempts 3 --lockout_period 15
[$] python3 buffalo.py -h [12:39:53]
usage: buffalo.py [-h] [--port [PORT]] [--max_attempts [MAX_ATTEMPTS]] [--lockout_period [LOCKOUT_PERIOD]]
[--threads [THREADS]]
target users passwords
Quick SSH brute force script for Red Team @Intel.
positional arguments:
target Target IP or hostname.
users Username file, one username per line.
passwords Password file, one password per line.
optional arguments:
-h, --help show this help message and exit
--port [PORT] SSH port. DEFAULT 22.
--max_attempts [MAX_ATTEMPTS]
Max attempts per account within the lockout window. DEFAULT unlimited.
--lockout_period [LOCKOUT_PERIOD]
Length of the lockout window in minutes. DEFAULT 0.
--threads [THREADS] Thread count. DEFAULT 100.
这里简要列出了一些我认为未来实现起来会很酷的功能。
invoke_shell 打开交互式 shell。exec_command 的各种选项。以下是一些头脑风暴的想法。