Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions maskgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def __init__(self):
self.minoccurrence = None
self.maxoccurrence = None

self.customcharset1len = None
self.customcharset2len = None
self.customcharset3len = None
self.customcharset4len = None

# PPS (Passwords per Second) Cracking Speed
self.pps = 1000000000
self.showmasks = False
Expand All @@ -51,6 +56,13 @@ def getcomplexity(self, mask):
elif char == "d": count *= 10
elif char == "s": count *= 33
elif char == "a": count *= 95
elif char == "b": count *= 256
elif char == "h": count *= 16
elif char == "H": count *= 16
elif char == "1" and self.customcharset1len: count *= self.customcharset1len
elif char == "2" and self.customcharset2len: count *= self.customcharset2len
elif char == "3" and self.customcharset3len: count *= self.customcharset3len
elif char == "4" and self.customcharset4len: count *= self.customcharset4len
else: print "[!] Error, unknown mask ?%s in a mask %s" % (char,mask)

return count
Expand Down Expand Up @@ -201,6 +213,13 @@ def getmaskscoverage(self, checkmasks):

parser.add_option("--showmasks", dest="showmasks",help="Show matching masks", action="store_true", default=False)

custom = OptionGroup(parser, "Custom charater set options")
custom.add_option("--custom-charset1-len", dest="customcharset1len", type="int", metavar="26", help="Length of cutom character set 1")
custom.add_option("--custom-charset2-len", dest="customcharset2len", type="int", metavar="26", help="Length of cutom character set 2")
custom.add_option("--custom-charset3-len", dest="customcharset3len", type="int", metavar="26", help="Length of cutom character set 3")
custom.add_option("--custom-charset4-len", dest="customcharset4len", type="int", metavar="26", help="Length of cutom character set 4")
parser.add_option_group(custom)

misc = OptionGroup(parser, "Miscellaneous options")
misc.add_option("--pps", dest="pps",help="Passwords per Second", type="int", metavar="1000000000")
misc.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, help="Don't show headers.")
Expand Down Expand Up @@ -236,6 +255,12 @@ def getmaskscoverage(self, checkmasks):
if options.minoccurrence: maskgen.minoccurrence = options.minoccurrence
if options.maxoccurrence: maskgen.maxoccurrence = options.maxoccurrence

# Custom
if options.customcharset1len: maskgen.customcharset1len = options.customcharset1len
if options.customcharset2len: maskgen.customcharset2len = options.customcharset2len
if options.customcharset3len: maskgen.customcharset3len = options.customcharset3len
if options.customcharset4len: maskgen.customcharset4len = options.customcharset4len

# Misc
if options.pps: maskgen.pps = options.pps
if options.showmasks: maskgen.showmasks = options.showmasks
Expand Down