Beispiel #1
0
def patterncore(resource):
    pattern_dict = {}

    try:
        confdicts = elementparser(confmatcher(resource))
    except IndexError:
        confdicts = {}
        exit(
            cool.red(
                "[-] parse element error, please check your parsing element"))
    finalen = len(confdicts[pystrs.conf_head])
    for x in range(0, finalen):
        pattern_set_list = confdicts[pystrs.conf_char][x]
        pattern_dict[x] = "".join(pattern_set_list)

    return pattern_dict
Beispiel #2
0
def confcore(resource):
    try:
        confdicts = elementparser(confmatcher(resource))
    except IndexError:
        confdicts = {}
        exit(cool.red("[-] parse element error, please check your parsing element"))

    finalen = len(confdicts[pystrs.conf_head])
    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])
        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(listpool[0]))
        for item in itertools.product(listpool[0]):
            yield "".join(item)
    elif finalen == 2:
        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(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(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(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(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(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(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(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(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)