import os
import sys
import time
import string
import argparse
import itertools
def createWordList(chrs, min_length, max_length, output):
"""
:param `chrs` is characters to iterate.
:param `min_length` is minimum length of characters.
:param `max_length` is maximum length of characters.
:param `output` is output of wordlist file.
"""
if min_length > max_length:
print ("[!] Please `min_length` must smaller or same as with `max_length`")
sys.exit()
if os.path.exists(os.path.dirname(output)) == False:
os.makedirs(os.path.dirname(output))
print ('[+] Creating wordlist at `%s`...' % output)
print ('[i] Starting time: %s' % time.strftime('%H:%M:%S'))
output = open(output, 'w')
for n in range(min_length, max_length + 1):
for xs in itertools.product(chrs, repeat=n):
chars = ''.join(xs)
output.write("%s\n" % chars)
sys.stdout.write('\r[+] saving character `%s`' % chars)
sys.stdout.flush()
output.close()
print ('\n[i] End time: %s' % time.strftime('%H:%M:%S'))
if __name__ == '__main__':
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
description='Python Wordlist Generator')
parser.add_argument(
'-chr', '--chars',
default=None, help='characters to iterate')
parser.add_argument(
'-min', '--min_length', type=int,
default=1, help='minimum length of characters')
parser.add_argument(
'-max', '--max_length', type=int,
default=2, help='maximum length of characters')
parser.add_argument(
'-out', '--output',
default='output/wordlist.txt', help='output of wordlist file.')
args = parser.parse_args()
if args.chars is None:
args.chars = string.printable.replace(' \t\n\r\x0b\x0c', '')
createWordList(args.chars, args.min_length, args.max_length, args.output)
Creating Awesome Wordlist with Python. You can check sample this file:
output/wordlist.txt
usage: wgen.py [-h] [-chr CHARS] [-min MIN_LENGTH] [-max MAX_LENGTH]
[-out OUTPUT]
Python Wordlist Generator
optional arguments:
-h, --help show this help message and exit
-chr CHARS, --chars CHARS
characters to iterate
-min MIN_LENGTH, --min_length MIN_LENGTH
minimum length of characters
-max MAX_LENGTH, --max_length MAX_LENGTH
maximum length of characters
-out OUTPUT, --output OUTPUT
output of wordlist file.
$ python3 wgen.py -chr=abc -min=1 -max=4 -out=output/wordlist.txt
$ python3 wgen.py -chr=a1B2c3D4e5 -min=4 -max=6 -out=output/wordlist.txt
Because many are violating the ITE Law, therefore this disclaimer we made to protect us from legal related undesirable actions of other parties, such as using this scripts or code for unlawful activities.
Therefore we with EXPRESSLY stating NOT RESPONSIBLE and FREE FROM CLAIMS OF LAW for any misuse of script or code that we provide on this repository.