pythonctf

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


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!


Solution

  • 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()