[Tutor] All possible 16 character alphanumeric strings?

akleider at sonic.net akleider at sonic.net
Sun Sep 16 05:06:35 CEST 2012

#!/usr/bin/env python

# file :  every.py
print 'Running "every.py"'

possible = "234567abcdefghijklmnopqrstuvwxyz"
word_length = 16

word_list = []
def add_word(word):
    if len(word)==word_length:
        print word   # There may come a time you won't want this line.
        for c in possible:
            new_word = word + c


# print word_list

> That solution is really nice, thanks, I doubt I would've come up with
> something as nice. What I'll do is have that write to a file then use
> regex
> to strip out any characters like whitespace or commas from the list and
> that should give me a good solid list, no?
> I'm using this to write a program I'm calling TORdialer with the goal of
> attempting to basically ping all possible TOR hidden service pages with
> the
> goal of having an absolutely complete list of all TOR hidden services on
> the net right now. Unfortunately it will probably be a lot of fucked up CP
> sites and drug related marketplaces. I'm mostly interested in the sites
> that aren't publicized (ie- government related sites, etc).
> Thanks for your help and I'll try to keep everyone posted.

There won't be any whitespace or commas in any of the derived output.
For your purposes, you might want to make this into a generator although
that would be getting too sophisticated for me to help you.
Since in its present form the algorithm is a recursive one, I'm guessing
it'll run out of memory long before it comes to completion although I
haven't let it run for more than a few seconds, just enough to see that it
seemed to be doing what I wanted.
>From what I know about computer science, I believe that most if not all
recursive algorithms can be re-written to be non recursive. If you could
do that, you could then make a generator and presumably make use of it
without overwhelming resources.
I look forward to hearing what those with more expertise might have to say
about that.

More information about the Tutor mailing list