0
if len(sys.argv)!=2:
    print("Wrong")
    exit(1)

w=open("passdict.txt","r")

for line in w:
    arr=w.readline().split()
    if crypt.crypt("arr[0]", "50")==sys.argv[1]:
        print("{}".format(arr))

w.close()

I'm using a password dictionary (one word, each line with trailing spaces), and trying to compare each word's hash with the hash i want to crack. It's not working. To check, I hashed the first word in the dictionary with crypt and used it as the hash that i want to crack, but it doesn't give me back the word. Is there something wrong with the code?

1 Answer 1

1

When you iterate over a file, as in for line in w, you are repeatedly reading one line from the file w at a time until EOF and putting that line into the variable line. However, you then immediately read another line into the variable arr with readline(), disregarding line. That is the problem.

1
  • Thanks! cracked the passwords
    – Vaish MK
    Feb 25, 2017 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .