Exemple #1
0
def get_chunk_dic(objflag, encodeflag, head, tail):
    countchecker(len(objflag))
    storepath = os.path.join(get_result_store_path(), "%s_%s_%s%s" %
                             (CHUNK_prefix, get_buildtime(), encodeflag, filextension))
    with open(storepath, "a") as f:
        for item in itertools.permutations(objflag, len(objflag)):
            f.write(operator.get(encodeflag)(head + "".join(item) + tail) + CRLF)
    finishprinter(finishcounter(storepath), storepath)
Exemple #2
0
def get_conf_dic(minlength, maxlength, objflag, encodeflag, head, tail):
    diclist = []
    for i in range_compatible(minlength, maxlength + 1):
        for item in itertools.product(objflag, repeat=i):
            if encodeflag in operator.keys():
                diclist.append(
                    operator.get(encodeflag)(head + "".join(item) + tail))
            else:
                exit(CRLF + cool.red('[-] wrong encode type'))

    # items count check
    countchecker(-1, len(diclist))
    return diclist
Exemple #3
0
def get_base_dic(minlength, maxlength, objflag, encodeflag, head, tail):
    countchecker(len(objflag), minlength, maxlength)
    global description
    storepath = os.path.join(
        get_result_store_path(), "%s_%s_%s_%s_%s_%s%s" %
        (BASE_prefix, minlength, maxlength, description, get_buildtime(),
         encodeflag, filextension))
    with open(storepath, "w") as f:
        for i in range_compatible(minlength, maxlength + 1):
            for item in itertools.product(objflag, repeat=i):
                if encodeflag == "":
                    f.write(head + "".join(item) + tail + CRLF)
                else:
                    f.write(
                        operator.get(encodeflag)(head + "".join(item) + tail) +
                        CRLF)
    finishprinter(finishcounter(storepath), storepath)
Exemple #4
0
def get_base_dic(minlength,
                 maxlength,
                 objflag,
                 encodeflag,
                 head,
                 tail,
                 need_char_dic=False):
    objflag = getchars(objflag, need_char=need_char_dic)
    countchecker(len(objflag), minlength, maxlength)
    global description
    dict_prefix = BASE_prefix
    if need_char_dic:
        dict_prefix = CHAR_prefix
    storepath = os.path.join(
        get_result_store_path(), "%s_%s_%s_%s_%s_%s%s" %
        (dict_prefix, minlength, maxlength, description, get_buildtime(),
         encodeflag, filextension))
    with open(storepath, "a") as f:
        for i in range_compatible(minlength, maxlength + 1):
            for item in itertools.product(objflag, repeat=i):
                f.write(
                    operator.get(encodeflag)(head + "".join(item) + tail) +
                    CRLF)
    finishprinter(finishcounter(storepath), storepath)
Exemple #5
0
def build_conf_dic():
    confdicts = confparser(confmatcher(get_conf_path()))
    finalen = len(confdicts[head])
    alllist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    storepath = os.path.join(
        get_result_store_path(),
        "%s_%s%s" % (CONF_prefix, get_buildtime(), filextension))
    for x in range(0, finalen):
        lengthchecker(confdicts[minlen][x], confdicts[maxlen][x])
        alllist[x] = get_conf_dic(int(confdicts[minlen][x]),
                                  int(confdicts[maxlen][x]),
                                  confdicts[char][x], confdicts[encode][x],
                                  confdicts[head][x], confdicts[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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)
    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) + CRLF)

    finishprinter(finishcounter(storepath), storepath)