Skip to content

Commit

Permalink
version 2.1.0#dev update
Browse files Browse the repository at this point in the history
important update
  • Loading branch information
LandGrey committed Dec 22, 2017
1 parent 298ae3b commit d3b1106
Show file tree
Hide file tree
Showing 44 changed files with 1,933 additions and 1,499 deletions.
531 changes: 109 additions & 422 deletions README.md

Large diffs are not rendered by default.

516 changes: 103 additions & 413 deletions README_CN.md

Large diffs are not rendered by default.

23 changes: 10 additions & 13 deletions core/BASE.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

import string
import itertools
from lib.data.data import paths, pystrs, pyoptions
from lib.fun.fun import finishprinter, finishcounter, countchecker, range_compatible, mybuildtime, finalsavepath
from lib.data.data import pystrs, pyoptions
from lib.fun.fun import finishprinter, countchecker, range_compatible, finalsavepath, fun_name


# get the dictionary list
def getchars(type, need_char=False):
def getchars(type):
flag = str(type)
chars = []
if type in pystrs.base_dic_type and not need_char:
if type in pystrs.base_dic_type:
if flag == pystrs.base_dic_type[0]:
chars = string.digits
elif flag == pystrs.base_dic_type[1]:
Expand All @@ -34,20 +34,17 @@ def getchars(type, need_char=False):
elif flag == pystrs.base_dic_type[6]:
chars = string.printable[:62]
return chars
elif need_char:
return type


def get_base_dic(objflag, need_char_dic=False):
objflag = getchars(objflag, need_char=need_char_dic)
def get_base_dic(objflag):
storepath = finalsavepath(fun_name())

objflag = getchars(objflag)
countchecker(len(objflag), pyoptions.minlen, pyoptions.maxlen)
dict_prefix = pystrs.BASE_prefix
if need_char_dic:
dict_prefix = pystrs.CHAR_prefix
storepath = finalsavepath(paths.results_path, dict_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
with open(storepath, "a") as f:
for i in range_compatible(pyoptions.minlen, pyoptions.maxlen+1):
for item in itertools.product(objflag, repeat=i):
f.write(pyoptions.operator.get(pyoptions.encode)(pyoptions.head + "".join(item) + pyoptions.tail) +
pyoptions.CRLF)
finishprinter(finishcounter(storepath), storepath)

finishprinter(storepath)
20 changes: 17 additions & 3 deletions core/CHAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@
License: GNU GENERAL PUBLIC LICENSE Version 3
"""

from core.BASE import get_base_dic
from __future__ import unicode_literals

import itertools
from lib.data.data import pyoptions
from lib.fun.fun import finishprinter, countchecker, range_compatible, finalsavepath, fun_name

def get_char_dic(customchar):
return get_base_dic(customchar, need_char_dic=True)

def get_char_dic(objflag):
storepath = finalsavepath(fun_name())

countchecker(len(objflag), pyoptions.minlen, pyoptions.maxlen)
with open(storepath, "a") as f:
for i in range_compatible(pyoptions.minlen, pyoptions.maxlen+1):
for item in itertools.product(objflag, repeat=i):
if item:
f.write(pyoptions.operator.get(pyoptions.encode)(pyoptions.head + "".join(item) + pyoptions.tail) +
pyoptions.CRLF)

finishprinter(storepath)
28 changes: 6 additions & 22 deletions core/CHUNK.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,14 @@
from __future__ import unicode_literals

import itertools
from lib.fun.filter import filterforfun
from lib.data.data import paths, pystrs, pyoptions
from lib.fun.fun import finishprinter, finishcounter, countchecker, mybuildtime, finalsavepath
from lib.fun.decorator import magic
from lib.fun.fun import countchecker


def get_chunk_dic(objflag):
countchecker(len(objflag))
storepath = finalsavepath(paths.results_path, pystrs.CHUNK_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
with open(storepath, "a") as f:

@magic
def chunk():
for item in itertools.permutations(objflag):
item = filterforfun("".join(item), head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
regex_is_filter=True, regex=pyoptions.filter_regex,
encode_is_filter=True, encode=pyoptions.encode,
occur_is_filter=True,
letter_occur=pyoptions.letter_occur,
digital_occur=pyoptions.digital_occur,
special_occur=pyoptions.special_occur,
types_is_filter=True,
letter_types=pyoptions.letter_types,
digital_types=pyoptions.digital_types,
special_types=pyoptions.special_types,
)
if item:
f.write(item + pyoptions.CRLF)
finishprinter(finishcounter(storepath), storepath)
yield "".join(item)
41 changes: 12 additions & 29 deletions core/CONF.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
from __future__ import unicode_literals

import itertools
from lib.fun.filter import filterforfun
from lib.data.data import paths, pystrs, pyoptions
from lib.fun.decorator import magic
from lib.data.data import pystrs, pyoptions
from lib.parse.confparse import elementparser, confmatcher
from lib.fun.fun import finishprinter, finishcounter, countchecker, lengthchecker, range_compatible, cool, mybuildtime,\
finalsavepath
from lib.fun.fun import countchecker, lengthchecker, range_compatible, cool


def build_conf_dic(source=""):
@magic
def conf():
for item in confcore(source):
yield item


def get_conf_dic(minlength, maxlength, objflag, encodeflag, head, tail):
Expand All @@ -29,29 +35,6 @@ def get_conf_dic(minlength, maxlength, objflag, encodeflag, head, tail):
return diclist


def build_conf_dic(source="", file_prefix=pystrs.CONF_prefix):
storepath = finalsavepath(paths.results_path, file_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
with open(storepath, "a") as f:
for item in confcore(source):
item = filterforfun(item, head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
regex_is_filter=True, regex=pyoptions.filter_regex,
encode_is_filter=True, encode=pyoptions.encode,
occur_is_filter=True,
letter_occur=pyoptions.letter_occur,
digital_occur=pyoptions.digital_occur,
special_occur=pyoptions.special_occur,
types_is_filter=True,
letter_types=pyoptions.letter_types,
digital_types=pyoptions.digital_types,
special_types=pyoptions.special_types,
)
if item:
f.write(item + pyoptions.CRLF)
finishprinter(finishcounter(storepath), storepath)


# if you have better way to actualize it, please pull request
def confcore(resource):
try:
Expand All @@ -64,8 +47,8 @@ def confcore(resource):
for x in range(0, finalen):
lengthchecker(confdicts[pystrs.conf_minlen][x], 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])
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(listpool[0]))
for item in itertools.product(listpool[0]):
Expand Down
99 changes: 23 additions & 76 deletions core/EXTEND.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,32 @@
import re
import itertools
from core.CONF import confcore
from lib.fun.osjudger import py_ver_egt_3
from lib.fun.decorator import magic
from lib.data.data import paths, pyoptions
from lib.fun.leetmode import leet_mode_magic
from lib.fun.filter import filterforfun
from lib.data.data import paths, pystrs, pyoptions
from lib.fun.fun import cool, finishprinter, finishcounter, walks_all_files, mybuildtime, unique, charanger, finalsavepath
if not py_ver_egt_3():
from lib.fun.fun import cool, walks_all_files, unique, charanger
try:
import ConfigParser
else:
except:
import configparser as ConfigParser


def extend_magic(rawlist):
if rawlist == []:
exit(pyoptions.CRLF + cool.red("[-] raw extend resource cannot be empty"))
leet = pyoptions.extend_leet

@magic
def extend():
for _ in walks_all_files(paths.weblist_path):
yield "".join(_)
if pyoptions.level <= 1:
for _ in walks_all_files(paths.syslist_path):
yield "".join(_)
for _ in extend_enter(rawlist, leet=leet):
yield "".join(_)


def wordsharker(raw, leet=True):
# raw word maybe strange case, both not lowercase and uppercase, such as 'myName'
#
Expand Down Expand Up @@ -217,7 +232,7 @@ def extend_enter(rawlist, leet=True):
return unique(res)


def get_extend_dic(target, need_extendscratch=False):
def get_extend_dic(target):
rawlist = []
for t in target:
if os.path.isfile(t):
Expand All @@ -226,72 +241,4 @@ def get_extend_dic(target, need_extendscratch=False):
rawlist.append(line.strip())
else:
rawlist.append(t)
extend_magic(rawlist, need_extendscratch=need_extendscratch)


def extend_magic(rawlist, need_extendscratch=False):
prefix = pystrs.EXTEND_prefix
if rawlist == []:
exit(pyoptions.CRLF + cool.red("[-] raw extend resource cannot be empty"))

leet = pyoptions.extend_leet
if need_extendscratch:
prefix = pystrs.PASSCRAPER_prefix
leet = pyoptions.passcraper_leet

storepath = finalsavepath(paths.results_path, prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
with open(storepath, "a") as f:
for _ in walks_all_files(paths.weblist_path):
item = filterforfun("".join(_), head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
regex_is_filter=True, regex=pyoptions.filter_regex,
encode_is_filter=True, encode=pyoptions.encode,
occur_is_filter=True,
letter_occur=pyoptions.letter_occur,
digital_occur=pyoptions.digital_occur,
special_occur=pyoptions.special_occur,
types_is_filter=True,
letter_types=pyoptions.letter_types,
digital_types=pyoptions.digital_types,
special_types=pyoptions.special_types,
)
if item:
f.write(item + pyoptions.CRLF)
if pyoptions.level <= 1:
for _ in walks_all_files(paths.syslist_path):
item = filterforfun("".join(_), head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
regex_is_filter=True, regex=pyoptions.filter_regex,
encode_is_filter=True, encode=pyoptions.encode,
occur_is_filter=True,
letter_occur=pyoptions.letter_occur,
digital_occur=pyoptions.digital_occur,
special_occur=pyoptions.special_occur,
types_is_filter=True,
letter_types=pyoptions.letter_types,
digital_types=pyoptions.digital_types,
special_types=pyoptions.special_types,
)
if item:
f.write(item + pyoptions.CRLF)
for _ in extend_enter(rawlist, leet=leet):
item = filterforfun("".join(_), head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
regex_is_filter=True, regex=pyoptions.filter_regex,
encode_is_filter=True, encode=pyoptions.encode,
occur_is_filter=True,
letter_occur=pyoptions.letter_occur,
digital_occur=pyoptions.digital_occur,
special_occur=pyoptions.special_occur,
types_is_filter=True,
letter_types=pyoptions.letter_types,
digital_types=pyoptions.digital_types,
special_types=pyoptions.special_types,
)
if item:
f.write(item + pyoptions.CRLF)

finishprinter(finishcounter(storepath), storepath)
extend_magic(rawlist)
44 changes: 14 additions & 30 deletions core/SEDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@
import time

from core.EXTEND import extend_enter
from lib.fun.decorator import magic
from lib.fun.filter import filterforfun
from lib.data.data import paths, pystrs, pyoptions
from lib.fun.osjudger import is_Windows, is_Linux, is_Mac
from lib.fun.filter import filterforfun
from lib.data.text import help_dict, helpmsg, pydictor_art_text
from lib.fun.fun import cool, unique, finishprinter, finishcounter, walks_all_files, mybuildtime, finalsavepath
from lib.fun.fun import cool, unique, finishprinter, walks_all_files, mybuildtime, finalsavepath, fun_name
from rules.EB import EB
from rules.Mailrule import Mailrule
from rules.NB import NB
from rules.NNrule import NNrule
from rules.SB import SB
from rules.SDrule import SDrule
from rules.SNrule import SNrule
from rules.SSrule import SSrule
from rules.NNrule import NNrule
from rules.Mailrule import Mailrule
from rules.SingleRule import SingleRule


Expand Down Expand Up @@ -293,17 +294,15 @@ def do_output(self, key):
print(pyoptions.CRLF + cool.red("[-] Cannot create result file: %s " % paths.results_path))
finally:
this_name = '%s_%s%s' % (pystrs.SEDB_prefix, mybuildtime(), pyoptions.filextension) \
if paths.results_file_name == None \
else paths.results_file_name
if paths.results_file_name == None else paths.results_file_name
print("[+] store path: {0}".format(cool.green(os.path.join(paths.results_path, this_name
if paths.results_file_name != None
else ''))) + pyoptions.CRLF)
if paths.results_file_name != None else ''))) + pyoptions.CRLF)

def do_run(self, args):
storepath = finalsavepath(fun_name())

pystrs.startime = time.time()
results = []
storepath = finalsavepath(paths.results_path, pystrs.SEDB_prefix, mybuildtime(), pyoptions.filextension,
paths.results_file_name)
paths.results_file_name = None
# SingleRule
for single in SingleRule(pystrs.sedb_dict[pystrs.sedb_range[0]], pystrs.sedb_dict[pystrs.sedb_range[1]],
Expand Down Expand Up @@ -465,23 +464,8 @@ def do_run(self, args):
# Using extend_enter plug
for extendstr in extend_enter(readylist, leet=pyoptions.sedb_leet):
results.append(extendstr)
with open(storepath, "a") as f:
for ur in unique(results):
item = filterforfun("".join(ur), head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
regex_is_filter=True, regex=pyoptions.filter_regex,
encode_is_filter=True, encode=pyoptions.encode,
occur_is_filter=True,
letter_occur=pyoptions.letter_occur,
digital_occur=pyoptions.digital_occur,
special_occur=pyoptions.special_occur,
types_is_filter=True,
letter_types=pyoptions.letter_types,
digital_types=pyoptions.digital_types,
special_types=pyoptions.special_types,
)
if item:
f.write(item + pyoptions.CRLF)

finishprinter(finishcounter(storepath), storepath)

@magic
def sedb():
for ur in results:
yield "".join(ur)
Loading

0 comments on commit d3b1106

Please sign in to comment.