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

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Crackeador de Hashes MD5, SHA256, SHA512 con Python 3 [codigo fuente]
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Crackeador de Hashes MD5, SHA256, SHA512 con Python 3 [codigo fuente]  (Leído 1,609 veces)
Bad4m_cod3

Desconectado Desconectado

Mensajes: 11


"a28ed83f69647d8f2a1046b9fa0e7c2c" H.P.Lovecraft


Ver Perfil
Crackeador de Hashes MD5, SHA256, SHA512 con Python 3 [codigo fuente]
« en: 23 Agosto 2023, 00:58 am »

A continuación procedo a presentar un codigo fuente diseñado para "Crackear" usando un Ataque de diccionario online y las librerias "colorama", hashlib, string, urllib. Claramente esta carente de limpieza, orden y comentarios por lo que pido ignorar esos importantes detalles. Pueden leer y utilizar el codigo a su placer...

 
Código
  1. #coding: utf-8
  2. from colorama import init, Fore, Back, Style
  3. import hashlib
  4. import string
  5. from urllib.request import urlopen
  6. #   )\      )  )\       )\())    )      ( /(  
  7. # (((_)  ( /( ((_) (   ((_)\  ( /(  (   )\())
  8. # )\___  )(_)) _   )\   _((_) )(_)) )\ ((_)\  
  9. #((/ __|((_)_ | | ((_) | || |((_)_ ((_)| |(_)
  10. # | (__ / _` || |/ _|  | __ |/ _` |(_-<| ' \  
  11. #  \___|\__,_||_|\__|  |_||_|\__,_|/__/|_||_|
  12.  
  13. #81dc9bdb52d04dc20036dbd8313ed055
  14.  
  15. init()#iniciar el colorama
  16. def art_ascii():
  17.  print(Fore.BLUE+"#-"*50+"#")
  18.  print(Fore.YELLOW+"   )\     )  )\      )\())    )      ( /(  ")                                                                
  19.  print(" (((_)  ( /( ((_) (   ((_)\ ( /(  (   )\()) ")                                                                
  20.  print(" )\___  )(_)) _   )\  _((_) )(_)) )\ ((_)\ ")                                                                
  21.  print("((/ __|((_)_ | | ((_) | || |((_)_ ((_)| |(_) ")                                                                
  22.  print(Fore.RED+"((/ __|((_)_ | | ((_) | || |((_)_ ((_)| |(_) ")                                                                
  23.  print(" | (__ / _` || |/ _|  | __ |/ _` |(_-<| ' \ ")                                                                
  24.  print("  \___|\__,_||_|\__|  |_||_|\__,_|/__/|_||_| ")
  25.  print(Fore.WHITE+"---| "+Fore.GREEN+".$$."+Fore.WHITE+"Bad4m_cod3"+Fore.GREEN+".$$."+Fore.WHITE+"|---")                                                          
  26.  print(Fore.MAGENTA+"\"a28ed83f69647d8f2a1046b9fa0e7c2c\""+Fore.GREEN+" H.P.Lovecraft")                                                          
  27.  print(Fore.BLUE+"#-"*50+"#"+Fore.WHITE)
  28.  
  29. def consol_prin(strdata):
  30.  print(Fore.BLUE+"--["+Fore.WHITE+"+"+Fore.BLUE+"]:"+Fore.WHITE+strdata)
  31.  
  32. def consol_input():
  33.  return str(input(Fore.BLUE+"--["+Fore.GREEN+"$.input.$"+Fore.BLUE+"]:"+Fore.WHITE))
  34.  
  35. def consol_error(errtext):
  36.  print(Fore.WHITE+"--["+Fore.RED+"Error!!"+Fore.WHITE+"]"+Fore.RED+":: "+errtext+Fore.WHITE)
  37.  
  38. def hash_text(strdata,typee):
  39.  if typee==0:
  40.    hashtxt = hashlib.md5(strdata).hexdigest()
  41.  elif typee==1:
  42.    hashtxt = hashlib.sha256(strdata).hexdigest()
  43.  elif typee==2:
  44.    hashtxt = hashlib.sha512(strdata).hexdigest()
  45.  else:
  46.    raise ValueError("Invalid Type Hash")
  47.  return hashtxt
  48.  
  49. def ishash(strhash,typee):
  50.  if all(inxx in string.hexdigits for inxx in strhash):
  51.    if typee==0:#md5
  52.      return len(strhash)==32
  53.    elif typpe==1:#sha256
  54.      return len(strhash)==64
  55.    elif typee==2:#sha512
  56.      return len(strhash)==128
  57.    else:
  58.      raise ValueError("Invalid Type Hash")
  59.  else:
  60.    return False
  61.  
  62. def return_case_hash(tphsh):
  63.  if tphsh=="md5":  return 0
  64.  elif tphsh=="sha256": return 1
  65.  elif tphsh=="sha512": return 2
  66.  else: return 99
  67.  
  68. def download_url(link):
  69.  return urlopen(link).read()
  70.  
  71. def main():
  72.  art_ascii()
  73.  global tp_hash
  74.  global hash_to_crack
  75.  consol_prin("Crackeadora de hashes")
  76.  
  77.  while True:
  78.    consol_prin("Seleccione el tipo de hash {md5,sha256,sha512}")
  79.    tipehash = consol_input()
  80.    tp_hash = return_case_hash(tipehash)
  81.  
  82.    if tp_hash == 99:
  83.      consol_error("Tipo de Hash invalido")
  84.    else:
  85.       break
  86.  
  87.  consol_prin("Tipo de hash selecionado [{}]".format(tipehash))
  88.  
  89.  while True:
  90.    consol_prin("Introduzca el HASH tipo {} que desea Crackear".format((tipehash)))
  91.    hash_to_crack = consol_input()
  92.    if ishash(hash_to_crack,tp_hash):
  93.      consol_prin("Iniciando Cracking de HASH: {} ...".format(hash_to_crack))
  94.      break
  95.    else:
  96.      consol_error("Hash {} invalida".format(hash_to_crack))
  97.  
  98.  consol_prin("Descangando Diccionario")
  99.  dicc = download_url("https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt")
  100.  consol_prin("Diccionario descargado")
  101.  consol_prin("Iniciando Ataque de diccionario "+Fore.RED+"[ATTACK INI]::::"+Fore.WHITE)
  102.  for inxx in dicc.split("\n".encode('utf-8')):
  103.    z = hash_text(inxx,tp_hash)
  104.    consol_prin("HASH:: {}          texto plano:: {}".format(z,inxx))
  105.    if z == hash_to_crack:
  106.      consol_prin("Password: {}         HASH: {}".format(inxx,z))
  107.      break
  108.  
  109. main()


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Codigo fuente de algun crackeador?
Programación Visual Basic
Ch3ck 5 2,508 Último mensaje 1 Junio 2008, 00:53 am
por skapunky
Codigo de fuente o librerias ... [PYTHON]
Scripting
Bomb-P 8 5,538 Último mensaje 29 Septiembre 2012, 15:04 pm
por Bomb-P
Codigo fuente de un troyano en python
Análisis y Diseño de Malware
AdeLax 8 9,140 Último mensaje 10 Enero 2013, 21:38 pm
por Ulianov
GitHub-Python-Correr y ver codigo fuente
Scripting
santiagoyepes 0 1,928 Último mensaje 2 Mayo 2019, 02:58 am
por santiagoyepes
Crackeo de hashes sha512-crypt con John the Ripper
Seguridad
Sugarb0y 3 8,514 Último mensaje 9 Octubre 2020, 20:46 pm
por Serapis
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines