今天花了一下午写了个爆破ssh的多线程脚本,debug到新闻联播,队大佬来说是个辣鸡脚本,我在这记录一下,如有需要可以拿去用。
可以直接clone我的github:https://github.com/1344098010/BruteForceSSH
-
说明
- 环境python3.7
- windows和linux均可运行
- 爆破程序入口 start.py
PS F:\SSHBF> python .\start.py -h
Usage: Usage start.py -H <host_ip> -p <Post>
Options:
-h, --help show this help message and exit
-H TGTHOST target host ip
-p TGTPORT target host port
--uf=USERNAMES_FILE usernames file, txt is adapted
--pf=PASSWORDS_FILE passwords file, txt is adapted
--timeout=TIMEOUT set timeout defalut 1
- shell对话依赖于interactive.py
- 以上两个脚本在同一个文件夹下,并且当进入shell后,会在同文件夹下创建log.txt记录交互日志
- 用户名字典和密码字典默认路径是同一文件夹下的username_list.txt和username_list.txt
-
不足点
能力不够,多线程没有应用好
在windows powershell中linux文件显示中有颜色无法显示(linux terminal正常显示),使用root用户体验更好一些
-
代码
-
interactive.py
# -*- coding: utf-8 -*-
import socket
import sys
# windows does not have termios...
try:
import termios
import tty
has_termios = True
except ImportError:
has_termios = False
def interactive_shell(chan):