0

I am trying to implement crack.py.I haven't done crack.c...I am really confused.Can anyone please kindly explain me what is wrong with my code

import sys
import crypt

def main():
    if len(sys.argv) != 2 :
        sys.exit("Usage: ./crack hash")
    password = sys.argv[1]
    print(password)


    alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"


    for i in alphabet:
        for j in alphabet:
            word = i + j
            if(crypt.crypt(word, '50')) == password:
                    word1 = word
                    return word1


    for i in alphabet:
        for j in alphabet:
            for k in alphabet:
                word = i + j + k
                if(crypt.crypt(word, '50')) == password:
                    word1 = word
                    return word1

    for i in alphabet:
        for j in alphabet:
            for k in alphabet:
                for l in alphabet:
                    word = i + j + k + l
                    if(crypt.crypt(word, '50')) == password:
                        word1 = word
                        return word1


if __name__ == "__main__":
    main()
2
  • I figured out my mistake and solved it Jun 23 '17 at 12:39
  • You can answer your own question (like "printed the hash, but not the password") and accept that answer if you want (I think there might be a time restriction on that to give others a chance of answering). Questions without any answers will appear in the "unanswered" section, so it's best to have at least one answer on every question to not clutter that list.
    – Blauelf
    Jun 23 '17 at 12:42

You must log in to answer this question.

Browse other questions tagged .