Skip to content

Instantly share code, notes, and snippets.

@luxiao
Last active August 29, 2018 07:06
Show Gist options
  • Save luxiao/81c333a6ce85700115b28571814a0d01 to your computer and use it in GitHub Desktop.
Save luxiao/81c333a6ce85700115b28571814a0d01 to your computer and use it in GitHub Desktop.
django pbkdf2 crack
# coding: utf-8
import os
import time
from django.contrib.auth.hashers import make_password
from django.conf import settings
settings.configure()
algo = 'pbkdf2_sha256'
ps = 'SecLists/Passwords'
def c_pass(pwd):
time.sleep(0.1)
return make_password(pwd, salt, algo)[34:] == target
def gen_pwd():
for p, c, f in os.walk(ps):
print p, c, f
for txt in f:
print txt
if txt.endswith('.txt'):
with open(ps + '/' + txt) as pfile:
for line in pfile.readlines():
yield line.strip()
def main():
for pwd in gen_pwd():
if c_pass(pwd):
print 'crack', pwd
break
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment