1

I'm new to python, but I just made a basic wordlist generator with a combination of unknown and known alphanumeric characters that are stored into a file:

textfile = file('passwords.txt', 'wt')

import itertools

numbers = itertools.product('0123456789',  repeat=8)
alphanum = itertools.product('0123456789ABCDEF', repeat=4)
for i in numbers:
    for c in alphanum:
        textfile.write(''.join(i)+'XXXX'+''.join(c)+'\n')

textfile.close()

I get this kind of output:

"00000000XXXX@@@@"

where the X are numbers (known numbers) and @ a mix of characters and numbers. That's fine. But I want the first 8 numeric values to change, and they keep being 0's, not from 0-9. I have tried some things but nothing worked...

How to solve this? And what am I doing wrong? I know there are programs like crunch and cewl etc etc.. but I like it more to start doing my own simple scripts and keep learning.

Thanks, and sorry if something like this have been answered, I couldn't find the exact thing I want.

  • This is not security related as your question is regarding python. This is the wrong section of SE. –  Nov 04 '15 at 19:56
  • How big is your file? I'd expect your zeroes section to tick over to 00000001 after 65,536 lines, and go to 0000002 after 131,072 lines, etc. Is that not what you're seeing? – Kevin Nov 04 '15 at 19:59
  • Not sure of teh above program but do have perl and python script for the same along with multithreading as well, let me know if required will share it. – user3754136 Nov 05 '15 at 07:32

1 Answers1

0

Your problem is that alphanum gets used up/exhausted after the first loop through. Try this:

textfile = file('passwords.txt', 'wt')

numbers = itertools.product('0123456789',  repeat=8)
for i in numbers:
    print ''.join(i)+'XXXX' # notice that this works
    alphanum = itertools.product('0123456789ABCDEF', repeat=4)
    for c in alphanum:
        textfile.write(''.join(i)+'XXXX'+''.join(c)+'\n')

textfile.close()

Note that this will take a very long time to complete

Community
  • 1
  • 1
Jephron
  • 2,652
  • 1
  • 23
  • 34