![]() |
|
Create a wordlist generator (i.e. for bruteforcing) - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: Create a wordlist generator (i.e. for bruteforcing) (/Thread-Create-a-wordlist-generator-i-e-for-bruteforcing) |
RE: Create a wordlist generator (i.e. for bruteforcing) - jforero8 - 07-17-2014 I just want to share with you my version of @Deque code in python, i'm starting with python so any advise would be welcome. Also thanks @Deque for your post. Code: # Initialize constants
WORD_LENGTH = 4
alphabet = ['a', 'b', 'c']
MAX_WORDS = len(alphabet) ** WORD_LENGTH
radix = len(alphabet)
def convtoradix(plist):
"""
:param plist: list that contain the radix, the number to convert and word length
"""
radix = plist[0]
number = plist[1]
wlength = plist[2]
result = []
for i in range(wlength, 0, -1):
if number > 0:
rest = number % radix
number = int(number / radix)
result.insert(0, rest)
else:
result.insert(0, 0)
return result
for j in range(0, MAX_WORDS):
bword = convtoradix([radix, j, WORD_LENGTH])
word = [] * WORD_LENGTH
for k in range(0, WORD_LENGTH):
word.insert(k, alphabet[bword[k]])
res = ''.join(word)
print(res) |