[Tutor] bruteforce match word in text file

David david at abbottdavid.com
Thu Jan 22 01:09:14 CET 2009


> #!/usr/bin/python
> import re
> password = 'loser'
> wordlist = '/home/david/Challenge-You/wordlist.txt'
> try:
>     words = open(wordlist, 'r').readlines()
> except IOError, e:
>     print "Sorry no words"
> for word in words:
>     word = word.replace("\n","")
>     if password in word:
>         print "The password is: ", word
>     else:
>         pass
> 
> I could not figure out how to split the file into words.
> 
> 
I removed the import re as that was left over from my experimenting.

-- 
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu



More information about the Tutor mailing list