Created
April 16, 2017 00:27
-
-
Save picatz/acc62bcc24aefdece27229b6462f0b14 to your computer and use it in GitHub Desktop.
Violent Python Example: Unix Password Cracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import crypt | |
def testPass(cryptPass): | |
salt = cryptPass[0:2] | |
dictFile = open('dictionary.txt', 'r') | |
for word in dictFile.readlines(): | |
word = word.strip('\n') | |
cryptWord = crypt.crypt(word, salt) | |
if cryptWord == cryptPass: | |
print '[+] Found Password: ' + word + '\n' | |
return | |
print '[-] Password Not Found.\n' | |
return | |
def main(): | |
passFile = open('passwords.txt') | |
for line in passFile.readlines(): | |
if ':' in line: | |
user = line.split(':')[0] | |
cryptPass = line.split(':')[1].strip(' ') | |
print '[*] Cracking Password For: ' + user | |
testPass(cryptPass) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment