Advertisement
Guest User

Untitled

a guest
Jan 29th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding:utf-8 -*-
  3. import spwd,csv,urllib,crypt,getpass,pwd,sys
  4. from zipfile import ZipFile
  5. from StringIO import StringIO
  6.  
  7. try:
  8.     f = open('10k most common.txt', 'r+')
  9.     passwlist = [line.strip() for line in f.readlines()]
  10.     f.closed
  11. except :
  12.     myfile = urllib.urlopen("http://roger.zone42.fr/10k%20most%20common.zip")
  13.     passwdtxt = ZipFile(StringIO(myfile.read()))
  14.     passwlist = [line.strip() for line in  passwdtxt.open("10k most common.txt")]
  15.     passwdtxt.extract("10k most common.txt")
  16.  
  17. for item in spwd.getspall():
  18.     sys.stdout.write("Processing password for user \""+item.sp_nam+"\" : ")
  19.     sys.stdout.flush()
  20.     if item.sp_pwd == '!' or item.sp_pwd == '*':
  21.         print "no password hash to process."
  22.         continue
  23.     for index,brutepass in enumerate(passwlist):
  24.         if crypt.crypt(brutepass, item.sp_pwd) == item.sp_pwd:
  25.             print "password is \""+brutepass+"\""
  26.             break
  27.         if index == len(passwlist)-1 :
  28.             print "failed to break password"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement