I want to create a wordlist of incrementing decimal numbers by 1 using python

Question:

I know i can create a wordlist using programms like ‘crunch’ but i wanted to use python in hopes of learning something new.

so I’m doing this CTF where i need a wordlist of numbers from 1 to maybe 10,000 or more. all the wordlists in Seclists have at least 3 zeroes in front of them, i dont want to use those files because i need to hash each entry through md5. if there are zeros in front of a numbers the hash differs from the same number without any zeros in front of it.

i need each numbers in its own line, starting with 1 to however many lines or number i want.

I feel like there may be a github gist for this out there but i havnt been looking long or hard enough to find one. if you have a link for one pls let me know!

Asked By: Maverick S.

||

Answers:

Here is how you can create a wordlist of such numbers and get it into a .csv file:

def generate(min=0,max=10000):
    '''
    Generates a wordlist of numbers from min to max.
    '''
    r = range(min,max+1,1)
    with open('myWordlist.csv','a') as file:
        for i in r:
            file.write(f'{i}n')
        
generate()
Answered By: GaëtanLF

this works better, then pipe the results into a file.

#!/usr/bin/python3

def generate():

        n = 10000
        print("n".join(str(v) for v in range(1, n + 1)))
generate()

Answered By: Maverick S.
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.