elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Hacking (Moderador: toxeek)
| | |-+  [Aporte] Generador de diccionarios para fuerza bruta
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Aporte] Generador de diccionarios para fuerza bruta  (Leído 8,017 veces)
WHK
Moderador Global
***
Desconectado Desconectado

Mensajes: 6.589


Sin conocimiento no hay espíritu


Ver Perfil WWW
[Aporte] Generador de diccionarios para fuerza bruta
« en: 25 Enero 2016, 00:35 am »

Hola, hice un generador de diccionarios en python, lo pueden descargar desde acá:
https://github.com/WHK102/whk-dictionary-maker

Uso:

Código:
whk@machine:~/$ python whk-dict-maker.py
- WHK Dictionary Maker 1.0, for pentesting purposes.
- Enter max longitude of word [4]        :
- Use letters?                [Y/n]      :
- Use lowercase?              [Y/n]      :
- Use uppercase?              [y/N]      :
- Use numbers?                [Y/n]      :
- Use special chars?          [y/N]      :
- Filename of dictionary      [dict.txt] :

  Summary                                             
  -----------------------------------------------------
- Max longitude of word                  : 4
- Total number of characters to use      : 36
- Total of words                         : 1,727,604
- Use letters                            : Yes
- Use lowercase letters                  : Yes
- Use uppercase letters                  : No
- Use numbers                            : Yes
- Use special chars                      : No
- Filename of dictionary                 : dict.txt
- File size estimated of dictionary      : 8.19MB
  -----------------------------------------------------
- You want to proceed?        [Y/n]      :
- End!                                                 

whk@machine:~/$ ls -lah
total 8,3M
drwxrwxr-x 3 whk whk 4,0K ene 24 20:24 .
drwxrwxr-x 4 whk whk 4,0K ene 24 20:09 ..
-rw-rw-r-- 1 whk whk 8,2M ene 24 20:24 dict.txt
-rw-rw-r-- 1 whk whk 7,0K ene 24 20:09 whk-dict-maker.py
whk@machine:~/$

Código:

Código
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. import os
  6. import math
  7.  
  8. class MainCLS:
  9.  
  10.    total_of_words      = 0
  11.    total_of_characters = 0
  12.    current             = 0
  13.    user_longitude      = 0
  14.    user_use_letters    = False
  15.    user_use_lowercase  = False
  16.    user_use_uppercase  = False
  17.    user_use_numbers    = False
  18.    user_use_specials   = False
  19.    user_filename       = ''
  20.    list_string         = ''
  21.  
  22.  
  23.    def processWord(self, str):
  24.        self.current = self.current + 1
  25.        self.file_handler.write("%s\n" % str)
  26.        sys.stdout.write("\r- Progress: %d/%d (%s)                " % (self.current, self.total_of_words, str))
  27.        sys.stdout.flush()
  28.  
  29.  
  30.    def loop(self, prefix, loops):
  31.        if loops == 0:
  32.            return
  33.  
  34.        last_list = []
  35.        for id_letter in range(0, len(self.list_string)):
  36.            final_str = prefix + self.list_string[id_letter]
  37.            last_list.append(final_str)
  38.            self.processWord(final_str)
  39.  
  40.        for id_array in range(0, len(last_list)):
  41.            self.loop(last_list[id_array], loops - 1)
  42.  
  43.  
  44.    def getInput(self, message, type_inp, default_value):
  45.        inp = raw_input(message)
  46.        inp = inp.strip()
  47.  
  48.        if inp == '':
  49.            inp = default_value
  50.  
  51.        if type_inp == 'int':
  52.            try:
  53.                val = int(inp)
  54.                if val > -1:
  55.                    return val
  56.                else:
  57.                    print '- That\'s not an number. Try again.'
  58.                    return self.getInput(message, type_inp, default_value)
  59.  
  60.            except ValueError:
  61.                print '- That\'s not an number. Try again.'
  62.                return self.getInput(message, type_inp, default_value)
  63.  
  64.        elif type_inp == 'bool':
  65.            if inp.lower() == 'y':
  66.                return True
  67.            elif inp.lower() == 'n':
  68.                return False
  69.            else:
  70.                print '- Please, respond with yes (y) or not (n). Try again.'
  71.                return self.getInput(message, type_inp, default_value)
  72.  
  73.        elif type_inp == 'file':
  74.            if os.path.isfile(inp):
  75.                respond = self.getInput('- The file exists.You want to replace it? [y/N] : ', 'bool', 'n')
  76.                if respond == False:
  77.                    return self.getInput(message, type_inp, default_value)
  78.                else:
  79.                    return inp
  80.            else:
  81.                return inp
  82.  
  83.        else:
  84.            return inp
  85.  
  86.    def printSummary(self):
  87.        print '                                                       '
  88.        print '  Summary                                              '
  89.        print '  -----------------------------------------------------'
  90.        print '- Max longitude of word                  : ' + '{0:,}'.format(self.user_max_longitude)
  91.        print '- Total number of characters to use      : ' + '{0:,}'.format(len(self.list_string))
  92.        print '- Total of words                         : ' + '{0:,}'.format(self.total_of_words)
  93.  
  94.        if self.user_use_letters == True:
  95.            print '- Use letters                            : Yes'
  96.            print '- Use lowercase letters                  : ' + ('Yes' if self.user_use_lowercase  else 'No')
  97.            print '- Use uppercase letters                  : ' + ('Yes' if self.user_use_uppercase  else 'No')
  98.        else:
  99.            print '- Use letters                            : No'
  100.  
  101.  
  102.        print '- Use numbers                            : ' + ('Yes' if self.user_use_numbers  else 'No')
  103.        print '- Use special chars                      : ' + ('Yes' if self.user_use_specials else 'No')
  104.        if os.path.isfile(self.user_filename):
  105.            print '- Filename of dictionary                 : ' + self.user_filename + ' (override)'
  106.        else:
  107.            print '- Filename of dictionary                 : ' + self.user_filename
  108.  
  109.        print '- File size estimated of dictionary      : ' + self.convertSize(self.total_of_characters)
  110.  
  111.        print '  -----------------------------------------------------'
  112.        return self.getInput('- You want to proceed?        [Y/n]      : ', 'bool', 'y')
  113.  
  114.  
  115.    def convertSize(self, size, precision=2):
  116.        # size = size + 0.0
  117.        suffixes=['B','KB','MB','GB','TB','PB']
  118.        suffixIndex = 0
  119.        while size > 1024 and suffixIndex < 4:
  120.            suffixIndex += 1 #increment the index of the suffix
  121.            size = size/1024.0 #apply the division
  122.        return ("%.*f%s" % (precision, size, suffixes[suffixIndex]))
  123.  
  124.  
  125.    def __init__(self):
  126.  
  127.        print '- WHK Dictionary Maker 1.0, for pentesting purposes.';
  128.        # self.user_min_longitude = self.getInput('- Enter min longitude of word [0]        : ', 'int',  '0')
  129.        self.user_max_longitude = self.getInput('- Enter max longitude of word [4]        : ', 'int',  '4')
  130.  
  131.        self.user_use_letters   = self.getInput('- Use letters?                [Y/n]      : ', 'bool', 'y')
  132.        if self.user_use_letters == True:
  133.            self.user_use_lowercase   = self.getInput('- Use lowercase?              [Y/n]      : ', 'bool', 'y')
  134.            self.user_use_uppercase   = self.getInput('- Use uppercase?              [y/N]      : ', 'bool', 'n')
  135.  
  136.        self.user_use_numbers   = self.getInput('- Use numbers?                [Y/n]      : ', 'bool', 'y')
  137.        self.user_use_specials  = self.getInput('- Use special chars?          [y/N]      : ', 'bool', 'n')
  138.        self.user_filename      = self.getInput('- Filename of dictionary      [dict.txt] : ', 'file', 'dict.txt')
  139.  
  140.        self.list_string = ''
  141.  
  142.        if self.user_use_letters == True:
  143.  
  144.            if self.user_use_lowercase == True:
  145.                self.list_string = self.list_string + 'abcdefghijklmnopqrstuvwxyz'
  146.  
  147.            if self.user_use_uppercase == True:
  148.                self.list_string = self.list_string + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  149.  
  150.        if self.user_use_numbers == True:
  151.            self.list_string = self.list_string + '0123456789'
  152.  
  153.        if self.user_use_specials == True:
  154.            self.list_string = self.list_string + '\\/\'"@#$%&/()=?¿!¡+-*_.:,;'
  155.  
  156.  
  157.        self.total_of_words      = 0
  158.        self.total_of_characters = 0
  159.        for n in range(0, self.user_max_longitude):
  160.            total = (len(self.list_string)**(n + 1))
  161.            self.total_of_words      = self.total_of_words + total
  162.            # (word length * count words) + \n
  163.            self.total_of_characters = self.total_of_characters + (total * (n + 1)) + total
  164.  
  165.        # Summary
  166.        response = self.printSummary()
  167.        if response == False:
  168.            return
  169.  
  170.        # Load file
  171.        if os.path.isfile(self.user_filename):
  172.            os.remove(self.user_filename)
  173.        self.file_handler = open(self.user_filename, 'w')
  174.  
  175.        # Execute all
  176.        self.loop('', self.user_max_longitude)
  177.  
  178.        # End
  179.        self.file_handler.close()
  180.        print "\r                                                       \r- End!"
  181.  
  182. if __name__ == '__main__':
  183.    mainCLS = MainCLS()
  184.  

Enjoy.
En línea

nevachana

Desconectado Desconectado

Mensajes: 61


Ver Perfil
Re: [Aporte] Generador de diccionarios para fuerza bruta
« Respuesta #1 en: 25 Enero 2016, 22:12 pm »

Yo tambien hice uno hace tiempo en c# , aqui esta mi ejemplo ^^
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Combolist2
  9. {
  10.    class Program
  11.    {
  12.        public static List<string> usernames = new List<string>();
  13.        public static List<string> passwords = new List<string>();
  14.        public static string line = "";
  15.        static void Main(string[] args)
  16.        {
  17.            Console.Title = "ComboList 2.0 - Nevachana";
  18.            Console.Write("Name of usernames file: ");
  19.            string userFile = Console.ReadLine();
  20.            using (StreamReader sr = File.OpenText(userFile))
  21.            {
  22.                string lines = sr.ReadToEnd();
  23.                string[] line = lines.Split('\n');
  24.                foreach (string filtering in line)
  25.                {
  26.                        usernames.Add(filtering);
  27.                }
  28.            }
  29.            Console.Write("Name of password file: ");
  30.            string passwordFile = Console.ReadLine();
  31.            using (StreamReader sr = File.OpenText(passwordFile))
  32.            {
  33.                string lines = sr.ReadToEnd();
  34.                string[] line = lines.Split('\n');
  35.                foreach (string filtering in line)
  36.                {
  37.                    if (filtering.Contains(" "))
  38.                        filtering.Replace(" ", "");
  39.                    passwords.Add(filtering);
  40.                }
  41.            }
  42.            Console.Write("max prefix and sufix intenger: ");
  43.            int max = int.Parse(Console.ReadLine());
  44.            Console.WriteLine("Doing combo..");
  45.            using (TextWriter tw = new StreamWriter("Combo.txt")) // we create the file.
  46.            {
  47.                for (int x = 1; x < usernames.Count; x++)
  48.                {
  49.  
  50.                    for (int y = 0; y < passwords.Count; y++)
  51.                    {
  52.                        if (passwords[y].ToLower().Contains("%user%"))
  53.                            line = string.Format("{0}:{1}", usernames[x], passwords[y].Replace("%user%", usernames[x]));
  54.                        else
  55.                        line = string.Format("{0}:{1}", usernames[x], passwords[y]);
  56.                        tw.Write(line + Environment.NewLine);
  57.                    }
  58.                    for (int z = 0; z < max; z++)
  59.                    {
  60.                        tw.Write(usernames[x]+":" + usernames[x]+z+ Environment.NewLine);
  61.  
  62.                        tw.Write(usernames[x] + ":" +z+ usernames[x] +  Environment.NewLine);
  63.                        if (usernames[x].Any(c => char.IsUpper(c)))
  64.                        {
  65.                            tw.Write(usernames[x] + ":" + usernames[x].ToLower() + z + Environment.NewLine);
  66.                            tw.Write(usernames[x] + ":" + z + usernames[x].ToLower() + Environment.NewLine);
  67.                        }
  68.                    }
  69.  
  70.                }
  71.            }
  72.            Console.WriteLine("Done");
  73.            Console.ReadLine();
  74.        }
  75.    }
  76. }
  77.  
En línea

B4tm4n

Desconectado Desconectado

Mensajes: 1


Ver Perfil
Re: [Aporte] Generador de diccionarios para fuerza bruta
« Respuesta #2 en: 31 Enero 2016, 19:49 pm »

Hola, pues estan chidos, pero que tal el crunch?
En línea

WHK
Moderador Global
***
Desconectado Desconectado

Mensajes: 6.589


Sin conocimiento no hay espíritu


Ver Perfil WWW
Re: [Aporte] Generador de diccionarios para fuerza bruta
« Respuesta #3 en: 1 Febrero 2016, 02:34 am »

Hola, pues estan chidos, pero que tal el crunch?

Código:
whk@machine:~$ time crunch 0 4 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 > dict.txt
Crunch will now generate the following amount of data: 74846649 bytes
71 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 15018571

real 0m4.349s
user 0m1.332s
sys 0m0.016s

whk@machine:~$ time python whk-dict-maker.py
- WHK Dictionary Maker 1.0, for pentesting purposes.
                                                       
  Summary                                             
  -----------------------------------------------------
- Max longitude of word                  : 4
- Total number of characters to use      : 62
- Total of words                         : 15,018,570
- Use letters                            : Yes
- Use lowercase letters                  : Yes
- Use uppercase letters                  : Yes
- Use numbers                            : Yes
- Use special chars                      : No
- Filename of dictionary                 : dict2.txt
- File size estimated of dictionary      : 71.38MB
  -----------------------------------------------------
- End!                                                 

real 0m7.010s
user 0m6.956s
sys 0m0.048s
whk@machine:~$

Definitivamente el crunch es casi el doble de rápido que el mio y creo que se debe porque es compilado y el mio interpretado. No conocía crunch, está bastante bueno.
En línea

El_Andaluz


Desconectado Desconectado

Mensajes: 4.075



Ver Perfil
Re: [Aporte] Generador de diccionarios para fuerza bruta
« Respuesta #4 en: 1 Febrero 2016, 04:52 am »

WHK:Gracias por el aporte hacía tiempo que no veía algún generador diccionario nuevo por aquí, me gustaría probarlo en el Wifislax es la única distribución así que tengo de linux y me gustaría saber como podría hacerlo funcionar ? Si se puede, me gustaría si no te importa que me expliques los pasos a seguir para hacerlo funcionar tengo ganas de probarlo.  

Otra opción sería hacer un modulo en xzm de este generador de diccionario y probarlo en Wifislax, creo que sería mas fácil si a ti no te importaría hacerlo si no es mucho pedir.

Yo probé hacerlo hace tiempo pero luego no me funcionan bien por que le faltan dependencias o cosas así. :P
« Última modificación: 1 Febrero 2016, 05:09 am por El_Andaluz » En línea

WHK
Moderador Global
***
Desconectado Desconectado

Mensajes: 6.589


Sin conocimiento no hay espíritu


Ver Perfil WWW
Re: [Aporte] Generador de diccionarios para fuerza bruta
« Respuesta #5 en: 7 Febrero 2016, 19:24 pm »

Hola, es facil, entras acá:
https://raw.githubusercontent.com/WHK102/whk-dictionary-maker/master/whk-dict-maker.py

Copias todo y lo guardas en un archivo de texto llamado whk-dict-maker.py , luego abres el terminal y lo posicionas sobre el directorio donde guardaste el script y ejecutas: "python whk-dict-maker.py" y listo. No necesitas instalar nada.
En línea

El_Andaluz


Desconectado Desconectado

Mensajes: 4.075



Ver Perfil
Re: [Aporte] Generador de diccionarios para fuerza bruta
« Respuesta #6 en: 7 Febrero 2016, 23:54 pm »

Hola, es facil, entras acá:
https://raw.githubusercontent.com/WHK102/whk-dictionary-maker/master/whk-dict-maker.py

Copias todo y lo guardas en un archivo de texto llamado whk-dict-maker.py , luego abres el terminal y lo posicionas sobre el directorio donde guardaste el script y ejecutas: "python whk-dict-maker.py" y listo. No necesitas instalar nada.

Lo voy a intentar hacer desde el terminal de la consola del Wifislax, ejecutarlo tal y como me has explicado a ver si consigo abrir el script lo que me da miedo es a la hora de hacer el diccionario y sea demasiado grande y se me quede pillado el Pc.

Ya te contare si he sido capaz gracias. ;)
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[APORTE] Generador de Diccionarios VB.NET « 1 2 »
.NET (C#, VB.NET, ASP)
kub0x 15 16,095 Último mensaje 13 Septiembre 2012, 18:36 pm
por .oZONo.
Diccionarios para realizar ataques de fuerza bruta
Hacking
joanch 2 32,826 Último mensaje 10 Mayo 2015, 07:53 am
por scott_
efectividad de diccionarios de fuerza bruta?
Hacking
Razzari 2 2,895 Último mensaje 27 Septiembre 2016, 18:38 pm
por oldaccount
(Necesito) Scrip de python para generar diccionarios de contraseñas fuerza bruta
Hacking
teco77 4 3,865 Último mensaje 18 Diciembre 2016, 07:23 am
por teco77
El mejor Generador de diccionarios para Fuerza Bruta (BruteForce Attack)
Software
**Aincrad** 3 1,695 Último mensaje 13 Junio 2017, 03:45 am
por **Aincrad**
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines