Beispiel #1
0
 def ssh_brute_char(hostname, user, minimo, maximo, char, verbose):
     min = minimo
     max = maximo
     chrs = char
     min_length, max_length = int(min), int(max)
     for n in range(min_length, max_length + 1):
         for xs in itertools.product(chrs, repeat=n):
             if verbose == True:
                 passw = ''.join(xs)
                 try:
                     s = paramiko.SSHClient()
                     s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
                     s.load_system_host_keys()
                     s.connect(hostname=hostname,
                               username=user,
                               password=passw)
                     Debug.AVISO("[+] Success! %s => %s" % (user, passw))
                     break
                 except socket.gaierror:
                     Debug.ERRO("[+]HOST INVALIDO")
                     break
                 except paramiko.AuthenticationException:
                     Debug.ERRO("[-] falha:%s => %s" % (user, passw))
                 except paramiko.ssh_exception.SSHException:
                     Debug.ERRO("[+]SSHException")
                     pass
             else:
                 passw = ''.join(xs)
                 try:
                     s = paramiko.SSHClient()
                     s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
                     s.load_system_host_keys()
                     s.connect(hostname=hostname,
                               username=user,
                               password=passw)
                     Debug.AVISO("[+] Success! %s => %s" % (user, passw))
                     break
                 except socket.gaierror:
                     Debug.ERRO("[+]HOST INVALIDO")
                     break
                 except paramiko.AuthenticationException:
                     Debug.ERRO("[-] falha:%s => %s" % (user, passw))
                 except paramiko.ssh_exception.SSHException:
                     Debug.ERRO("[+]SSHException")
                     pass
Beispiel #2
0
 def connect_UDP(host, port, timeout):
     try:
         s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         s.settimeout(timeout)
         s.connect((host, port))
         hp = str(host) + ":" + str(port)
         Debug.CRITICAL(f"conectado UDP => [{hp}]")
     except socket.error:
         hp = str(host) + ":" + str(port)
         Debug.AVISO(f"falha ao conectar => [{hp}]")
Beispiel #3
0
 def check_anonymous_login(hostname):
     try:
         ftp = FTP(hostname)
         ftp.login()
         Debug.CRITICAL("[+]Anonymous => [ok]")
         Debug.CRITICAL("[+]Username  => [anonymous]")
         Debug.CRITICAL("[+]Pass      => [anonymous]")
         ftp.quit()
     except:
         Debug.AVISO("[+]Anonymous off")
         pass
Beispiel #4
0
 def baixar(url, saida=""):
     """
     :info metodo responsavel para baixar arquivos
     :param url,saida:
     :return: arquivo
     """
     if url == None:
         print("[+]erro nao pode ser um argumento vazio")
         pass
     elif saida == None:
         print("local padrao [/tmp]")
         try:
             _local = "/tmp"
             arquivo = wget.download(url=url, out=_local)
             Debug.AVISO("Diretorio => [" + _local + "]")
             Debug.AVISO("Arquivo => [" + arquivo + "]")
         except Exception:
             pass
     else:
         local = saida
         arquivo = wget.download(url=url, out=local)
         Debug.AVISO("Diretorio => [" + local + "]")
         Debug.AVISO("Arquivo => [" + arquivo + "]")
Beispiel #5
0
 def ssh_brute_file(hostname, user, filebr):
     with open(filebr, "r") as fl:
         for passw in fl:
             try:
                 s = paramiko.SSHClient()
                 s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
                 s.load_system_host_keys()
                 s.connect(hostname=hostname, username=user, password=passw)
                 Debug.AVISO("[+] Success! %s => %s" % (user, passw))
                 break
             except socket.gaierror:
                 Debug.ERRO("[+]HOST INVALIDO")
                 break
             except paramiko.AuthenticationException:
                 Debug.ERRO("[-] falha:%s => %s" % (user, passw))
             except paramiko.ssh_exception.SSHException:
                 Debug.ERRO("[+]SSHException")
                 pass
Beispiel #6
0
    def report(CTF_NOME, CTF_team, CTF_USER, CTF_challenges, CTF_challenges_PASTA, file_name, evento_nome, flag_pontos):
        Debug.CRITICAL("[+]criando relatorio")
        Debug.AVISO(f"CTF_NOME: {CTF_NOME} ")
        Debug.AVISO(f"CTF_TIME: {CTF_team} ")
        Debug.AVISO(f"CTF_USER: {CTF_USER} ")
        Debug.AVISO(f"CTF_TIPO: {CTF_challenges} ")
        Debug.AVISO(f"CTF_PASTA: {CTF_challenges_PASTA} ")
        Debug.AVISO(f"EVENTO_NOME: {evento_nome} ")
        Debug.AVISO(f"FLAG_PONTOS {flag_pontos} ")
        try:  # Ele vai tentar criar a pasta brainiac_ctf_report, pasta CTF_challenges_PASTA e o nome do arquivo
            os.mkdir("../brainiac_ctf_report")  # Cria pasta brainiac_ctf_report
            Debug.CRITICAL("[+] criando pasta => [brainiac_ctf_report]")
            os.mkdir(CTF_challenges_PASTA)  # Cria pasta CTF_challenges_PASTA
            os.chdir(CTF_challenges_PASTA)  # Entra na pasta CTF_challenges_PASTA
            Debug.CRITICAL(f"[+] CTF_challenges  => [{CTF_challenges_PASTA}]")
            Debug.CRITICAL(f"[+] file_challenges  => [{file_name}]")

        except FileExistsError:  # Se a pasta brainiac_ctf_report existir ele entra na pasta
            os.chdir("../brainiac_ctf_report")  # Entra na pasta brainiac_ctf_report
            try:  # Tenta criar a pasta CTF_challenges_PASTA
                os.mkdir(CTF_challenges_PASTA)  # Cria CTF_challenges_PASTA
                os.chdir(CTF_challenges_PASTA)  # Entra CTF_challenges_PASTA
                Debug.CRITICAL(f"[+] CTF_challenges  => [{CTF_challenges_PASTA}]")
                Debug.CRITICAL(f"[+] file_challenges  => [{file_name}]")

            except FileExistsError:  # Se a pasta CTF_challenges_PASTA existir
                os.chdir(CTF_challenges_PASTA)  # Entra na pasta CTF_challenges_PASTA
                Debug.CRITICAL(f"[+] CTF_challenges  => [{CTF_challenges_PASTA}]")
                Debug.CRITICAL(f"[+] file_challenges  => [{file_name}]")

        with open(file_name, "w") as fl:  ###Escreve logs no file_name
            fl.write("#" * 35)
            fl.write("\n" + "#" * 10 + "report" + "#" * 10)
            fl.write("\n" + "#" * 5 + "brainiac_report_info_ctf" + "#" * 6)
            fl.write("\n" + "#" * 35)
            fl.write("\n" + f"CTF_EVENTO: {evento_nome} ")
            fl.write("\n" + f"CTF_DATE: {today}")

            fl.write("\n" + f"CTF_PONTOS: {flag_pontos} ")
            fl.write("\n" + f"CTF_NOME: {CTF_NOME} ")
            fl.write("\n" + f"CTF_TIME: {CTF_team} ")
            fl.write("\n" + f"CTF_USER: {CTF_USER} ")
            fl.write("\n" + f"CTF_TIPO: {CTF_challenges} ")
            fl.write("\n" + f"CTF_PASTA: {CTF_challenges_PASTA} ")
            fl.close()
            os.system("nano " + file_name)