-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate-combo1337-rules.py
61 lines (55 loc) · 2.39 KB
/
generate-combo1337-rules.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
52
53
54
55
56
57
58
59
60
61
##!/usr/bin/env python
# -*- coding: latin-1 -*-
__author__ = "Felix Ryan of YGHT Ltd"
__license__ = "GPL"
__version__ = "0.1"
import time, os
charlength = 6
stdoutEnabled = False
# these are all the possible rules desired from hashcat rules syntax
manglers = ["T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "TA", "TB", "TC", "TD", "TE", "TF",
"^!", "^\"", "^£", "^$", "^%", "^^", "^&", "^*", "^(", "^)", "^-", "^=", "^_", "^+",
# "^{", "^}", "^[", "^]", "^;", "^'", "^#", "^:", "^@", "^~", "^,", "^.", "^/", "^<", "^>", "^?",
# "$!", "$\"", "$£", "$$", "$%", "$^", "$&", "$*", "$(", "$)", "$-", "$=", "$_", "$+",
# "${", "$}", "$[", "$]", "$;", "$'", "$#", "$:", "$@", "$~", "$,", "$.", "$/", "$<", "$>", "$?",
"sa4", "sa@", "sb6", "sc<", "sc{", "se3", "sg9", "si1", "si!", "so0", "sq9", "ss5", "ss$", "st7", "st+", "sx%"]
def Main():
# record when the routine gets started for later use
startTime = time.time()
# delete file for fresh output if exists
if os.path.exists('comboleet.rule'):
os.remove('comboleet.rule')
# the output gets large quickly, so instead of maxing out RAM, lets write to disk
with open('comboleet.rule', 'a') as outfile:
# initialise the inarray so Python doesn't squirm
inarray = [""]
# initialise the character limiter
index = 0
# loop until character limit is reached
while index < charlength:
# define the outarray so python doesn't squirm
outarray = [""]
# iterate through the items currently in the inarray
for inarrayElement in inarray:
# iterate through the subrules from the manglers array defined above
for subruleElement in manglers:
# check if rule is already in generated string
if subruleElement not in inarrayElement:
# take the current subrule and join it to the current inrule
outarray.append("".join((inarrayElement, subruleElement)))
outfile.write("".join((inarrayElement, subruleElement)))
#copy this to the inarray to not lose the results
inarray = outarray
#increment the length counter so that we do terminate eventually
index += 1
# add the "no change" rule
inarray.append(":")
executionTime = time.time() - startTime
print(''.join((str(executionTime), " seconds")))
# print the built array, mostly for testing purposes
if (stdoutEnabled):
for outrule in outarray:
print outrule
return
if __name__ == '__main__':
Main()