Advertisement
Guest User

Untitled

a guest
Feb 8th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. import crypt
  2. #hadi function lwla
  3. def passwordmatching(cryptedpassword,dictfilelocation):
  4.  
  5.     dictionaryfile= open(dictfilelocation,'r')
  6.  
  7.     salt = cryptedpassword[0:2]
  8.  
  9.     for word in dictionaryfile.readlines():
  10.  
  11.         word = word.strip('\n')
  12.  
  13.         endresult = crypt.crypt(word,salt)
  14.  
  15.         if(cryptedpassword == endresult):
  16.  
  17.             print "[+] password is: "+word + '\n'
  18.  
  19.             return
  20.  
  21.         else:
  22.  
  23.             print "[-]password not found" + '\n'
  24.  
  25.     return        
  26. #hadi function tanya
  27. def main():
  28.  
  29.     print "give the location of the password file "+ '\n'
  30.  
  31.     passfilelocation =raw_input()
  32.  
  33.     print "give the location of the dictionary file "+ '\n'
  34.  
  35.     dictfilelocation =raw_input()
  36.  
  37.     passwordfile = open(passfilelocation,'r')
  38.  
  39.     for line in passwordfile.readlines():
  40.  
  41.         if ":" in line:
  42.  
  43.             username=line.split(':')[0]
  44.  
  45.             cryptedpassword =line.split(':')[1].strip()
  46.  
  47.             print "[*] Cracking Password For: "+username
  48.  
  49.             passwordmatching(cryptedpassword,dictfilelocation)
  50.  
  51.         else:
  52.  
  53.             cryptedpassword=line.strip()
  54.  
  55.             print "[*] Cracking Password For: "+username
  56. #here i call the first function and i give it the parameters it needs
  57.             passwordmatching(cryptedpassword,dictfilelocation)
  58.  
  59. if __name__ == "__main__":
  60. #here i call the second function no need calling the first one hit second one kat3yt 3la l first one
  61. #read it slowly
  62.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement