Skip to content

Commit

Permalink
powerful update
Browse files Browse the repository at this point in the history
1. add level function
2. powerful extend function
3. support use multiple leet code at a time
4. modify function name, wordlist files and etc.
  • Loading branch information
LandGrey committed Jun 16, 2017
1 parent dd55d98 commit edc0334
Show file tree
Hide file tree
Showing 31 changed files with 2,094 additions and 1,143 deletions.
330 changes: 159 additions & 171 deletions README.md

Large diffs are not rendered by default.

345 changes: 161 additions & 184 deletions README_CN.md

Large diffs are not rendered by default.

112 changes: 55 additions & 57 deletions core/CONF.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

import os
import itertools
from lib.parse.confparse import elementparser, confmatcher
from lib.data.data import paths, pystrs, pyoptions
from lib.parse.confparse import elementparser, confmatcher
from lib.fun.fun import finishprinter, finishcounter, countchecker, lengthchecker, range_compatible, cool, mybuildtime


Expand All @@ -28,80 +28,78 @@ def get_conf_dic(minlength, maxlength, objflag, encodeflag, head, tail):
return diclist


# if you have better way to actualize it, please pull request
def build_conf_dic():
storepath = os.path.join(paths.results_path, "%s_%s%s" %
(pystrs.CONF_prefix, mybuildtime(), pyoptions.filextension))
with open(storepath, "a") as f:
for item in confcore(paths.buildconf_path):
f.write(str(item) + pyoptions.CRLF)
finishprinter(finishcounter(storepath), storepath)


# if you have better way to actualize it, please pull request
def confcore(resource):
try:
confdicts = elementparser(confmatcher(paths.buildconf_path))
confdicts = elementparser(confmatcher(resource))
except IndexError:
confdicts = {}
exit(cool.red("[-] parse element error, please check your parsing element"))

finalen = len(confdicts[pystrs.conf_head])
alllist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
storepath = os.path.join(paths.results_path, "%s_%s%s" %
(pystrs.CONF_prefix, mybuildtime(), pyoptions.filextension))
listpool = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

for x in range(0, finalen):
lengthchecker(confdicts[pystrs.conf_minlen][x], confdicts[pystrs.conf_maxlen][x])
alllist[x] = get_conf_dic(int(confdicts[pystrs.conf_minlen][x]), int(confdicts[pystrs.conf_maxlen][x]),
listpool[x] = get_conf_dic(int(confdicts[pystrs.conf_minlen][x]), int(confdicts[pystrs.conf_maxlen][x]),
confdicts[pystrs.conf_char][x], confdicts[pystrs.conf_encode][x],
confdicts[pystrs.conf_head][x], confdicts[pystrs.conf_tail][x])
if finalen == 1:
countchecker(-1, len(alllist[0]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]))
for item in itertools.product(listpool[0]):
yield "".join(item)
elif finalen == 2:
countchecker(-1, len(alllist[0]), len(alllist[1]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]))
for item in itertools.product(listpool[0], listpool[1]):
yield "".join(item)
elif finalen == 3:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]))
for item in itertools.product(listpool[0], listpool[1], listpool[2]):
yield "".join(item)
elif finalen == 4:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3]):
yield "".join(item)
elif finalen == 5:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]), len(alllist[4]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3], alllist[4]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3], listpool[4]):
yield "".join(item)
elif finalen == 6:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]), len(alllist[4]),
len(alllist[5]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3], alllist[4], alllist[5]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]),
len(listpool[5]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3], listpool[4], listpool[5]):
yield "".join(item)
elif finalen == 7:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]), len(alllist[4]),
len(alllist[5]), len(alllist[6]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3], alllist[4], alllist[5],
alllist[6]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]),
len(listpool[5]), len(listpool[6]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3], listpool[4], listpool[5],
listpool[6]):
yield "".join(item)
elif finalen == 8:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]), len(alllist[4]),
len(alllist[5]), len(alllist[6]), len(alllist[7]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3], alllist[4], alllist[5],
alllist[6], alllist[7]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]),
len(listpool[5]), len(listpool[6]), len(listpool[7]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3], listpool[4], listpool[5],
listpool[6], listpool[7]):
yield "".join(item)
elif finalen == 9:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]), len(alllist[4]),
len(alllist[5]), len(alllist[6]), len(alllist[7]), len(alllist[8]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3], alllist[4], alllist[5],
alllist[6], alllist[7], alllist[8]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]),
len(listpool[5]), len(listpool[6]), len(listpool[7]), len(listpool[8]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3], listpool[4], listpool[5],
listpool[6], listpool[7], listpool[8]):
yield "".join(item)
elif finalen == 10:
countchecker(-1, len(alllist[0]), len(alllist[1]), len(alllist[2]), len(alllist[3]), len(alllist[4]),
len(alllist[5]), len(alllist[6]), len(alllist[7]), len(alllist[8]), len(alllist[9]))
with open(storepath, "a") as f:
for item in itertools.product(alllist[0], alllist[1], alllist[2], alllist[3], alllist[4], alllist[5],
alllist[6], alllist[7], alllist[8], alllist[9]):
f.write("".join(item) + pyoptions.CRLF)
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]),
len(listpool[5]), len(listpool[6]), len(listpool[7]), len(listpool[8]), len(listpool[9]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3], listpool[4], listpool[5],
listpool[6], listpool[7], listpool[8], listpool[9]):
yield "".join(item)

finishprinter(finishcounter(storepath), storepath)
Loading

0 comments on commit edc0334

Please sign in to comment.