Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. # This Python file uses the following encoding: utf-8
  2. import sys, string, crypt
  3. import passlib.hash
  4.  
  5. passwords = []
  6. with open('.htpasswd', 'r') as pass_file:
  7.         for line in pass_file:
  8.                 line = line.strip('\n')
  9.                 password_to_hack = line.split(':')[1]
  10.                 block = line.split('$')
  11.                 salthash = block[2]
  12.                 #username = (block[0])[:len(block[0])-1]
  13.                 #alg = block[1]
  14.                 #hash_pass = block[3]
  15.                 #print('username = ' + username + ' alg = ' + alg + ' salthash = ' + salthash + ' hash_pass = ' + hash_pass)
  16.                 chars = string.ascii_letters
  17.                 for a in chars:
  18.                         for b in chars:
  19.                                 for c in chars:
  20.                                         trial = a+b+c
  21.                                         crypted = passlib.hash.apr_md5_crypt.encrypt(trial,salt=salthash)
  22.                                         if crypted == password_to_hack:
  23.                                                 break
  24.                                 if crypted == password_to_hack:
  25.                                         break
  26.                         if crypted == password_to_hack:
  27.                                 break
  28.                 if crypted == password_to_hack:
  29.                         print( "Hasło złamane: " + trial)
  30.                 else:
  31.                         print( "Nie złamano hasła" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement