0

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!

PsOom
  • 37
  • 7

2 Answers2

1

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

PsOom
  • 37
  • 7
  • Could you please elaborate on why you think that this works better? Code-only answers usually do not help other users with the same question to understand the provided solution. Regarding the code, I would even go a step further and let the `generate` function return the string, so you can re-use it in different scenarios, e.g. printing or writing into a file etc. – Carlos Horn Nov 30 '22 at 12:55
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '22 at 12:55
0

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()
GaëtanLF
  • 101
  • 10
  • i ran the script except that i changed the '.csv' into '.txt' i did not see any new file in the directory i ran it. – PsOom Nov 28 '22 at 08:10