-
Notifications
You must be signed in to change notification settings - Fork 5
/
WordlistRaider.py
51 lines (39 loc) · 2.19 KB
/
WordlistRaider.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
import os
import sys
import argparse
import re
from colorama import init
init(strip=not sys.stdout.isatty()) # strip colors if stdout is redirected
from more_termcolor import cprint
from pyfiglet import figlet_format
cprint(figlet_format('WordlistRaider!', font='starwars', width=100), 'red')
cprint('Coded by Gregor Biswanger, Jürgen Gutsch & Community - Version 1.0', 'yellow')
parser = argparse.ArgumentParser(description='Returns a selection of words that matches the passed conditions in an existing list.')
parser.add_argument('-w', '--wordlist', metavar='path to source file', type=str, required=True, help='the wordlist to raid')
parser.add_argument('-t', '--target', metavar='path to the target file', type=str, required=True, help='the target wordlist')
parser.add_argument('--min', '--minlength', default=8, type=int, help='minimum length of password (default: 8)')
parser.add_argument('--max', '--maxlength', default=100, type=int, help='maximum length of password')
parser.add_argument('-n', '--numbers', type=bool, help='password must include numbers (default: false)')
parser.add_argument('-s', '--specialcharacters', type=bool, help='includes passwords with special characters (default: false)')
args = parser.parse_args()
def process_line_by_line():
with open(args.wordlist, 'r') as read_stream:
with open(args.target, 'w') as write_stream:
count = 0
for line in read_stream:
password = line.replace('\r', '').replace('\n', '')
passwordLength = len(password)
if (args.min <= passwordLength and args.max >= passwordLength):
if(args.numbers is not True and hasNumbers(password)):
continue
if(args.specialcharacters is not True and hasSpecialCharacters(password)):
continue
write_stream.write(line)
count += 1
print(f'{count} of Passwords written.')
def hasNumbers(inputString):
return any(char.isdigit() for char in inputString)
def hasSpecialCharacters(inputString):
return bool(re.findall('[^A-Za-z0-9]',inputString))
process_line_by_line()