def comparer_magic(*args):
    """[minuend_file] [subtrahend_file]"""
    args = list(args[0])

    if len(args) != 3:
        exit(pyoptions.CRLF + cool.fuchsia("[!] Usage: {} {}".format(
            args[0], pyoptions.tools_info.get(args[0]))))
    storepath = finalsavepath(fun_name())

    minuend_file = args[1]
    subtrahend_file = args[2]
    if not os.path.isfile(os.path.abspath(pyoptions.args_tool[1])):
        exit(pyoptions.CRLF +
             cool.red("[-] file: {} don't exists".format(minuend_file)))
    if not os.path.isfile(os.path.abspath(pyoptions.args_tool[2])):
        exit(pyoptions.CRLF +
             cool.red("[-] file: {} don't exists".format(subtrahend_file)))

    minuend_list = walk_pure_file(minuend_file)
    subtrahend_list = walk_pure_file(subtrahend_file)
    with open(storepath, "a") as f:
        for item in minuend_list:
            if item not in subtrahend_list:
                item = filterforfun(item)
                if item:
                    f.write(item + pyoptions.CRLF)

    finishprinter(storepath)
Ejemplo n.º 2
0
def combiner_magic(*args):
    """[dir]"""
    args = list(args[0])

    if len(args) == 2:
        directory = os.path.abspath(args[1])
        if not os.path.isdir(os.path.abspath(directory)):
            exit(pyoptions.CRLF +
                 cool.red("[-] path: {} don't exists".format(directory)))
    else:
        exit(pyoptions.CRLF + cool.fuchsia("[!] Usage: {} {}".format(
            args[0], pyoptions.tools_info.get(args[0]))))
    storepath = finalsavepath(fun_name())

    filepaths = []
    combine_list = []
    for rootpath, subdirsname, filenames in os.walk(directory):
        filepaths.extend(
            [os.path.abspath(os.path.join(rootpath, _)) for _ in filenames])
    if len(filepaths) > 0:
        for _ in filepaths:
            if mimetypes.guess_type(_)[0] == 'text/plain':
                combine_list.append(_)
    try:
        with codecs.open(storepath, 'a', encoding="utf-8") as f:
            for onefile in combine_list:
                with codecs.open(onefile, 'r', encoding="utf-8") as tf:
                    f.write(tf.read())
        finishprinter(storepath)

    except Exception as ex:
        print(pyoptions.CRLF + cool.red("[-] Combine file failed, Looking: "))
        traceback.print_exc()
Ejemplo n.º 3
0
def hybrider_magic(*args):
    """[file1] [file2] ..."""
    args = list(args[0])

    filepaths = []
    hybrid_list = []
    if len(args) >= 2:
        for count in range(1, len(args)):
            directory = os.path.abspath(args[count])
            if not os.path.isfile(os.path.abspath(directory)):
                exit(pyoptions.CRLF + cool.red("[-] file: {} don't exists".format(directory)))
            else:
                filepaths.append(directory)
    else:
        exit(pyoptions.CRLF + cool.fuchsia("[!] Usage: {} {}".format(args[0], pyoptions.tools_info.get(args[0]))))
    storepath = finalsavepath(fun_name())

    try:
        for fp in filepaths:
            tmp = set()
            with open(fp, "r") as f:
                for line in f:
                    tmp.add(line.strip())
            hybrid_list.append(tmp)

        with open(storepath, "a") as f:
            for item in itertools.product(*hybrid_list):
                f.write(pyoptions.operator.get(pyoptions.encode)(pyoptions.head + "".join(item) + pyoptions.tail) +
                        pyoptions.CRLF)
        finishprinter(storepath)

    except Exception as ex:
        print(pyoptions.CRLF + cool.red("[-] Hybrid files failed, Looking: "))
        exit(pyoptions.CRLF + traceback.print_exc())
Ejemplo n.º 4
0
def get_char_dic(objflag):
    storepath = finalsavepath(fun_name())

    countchecker(len(objflag), pyoptions.minlen, pyoptions.maxlen)

    # global variable transfer local variable to improved speed
    buffer = []
    buffer_size = pyoptions.buffer_size
    head = pyoptions.head
    tail = pyoptions.tail
    crlf = pyoptions.CRLF
    encode_name = pyoptions.encode
    encode_fun = pyoptions.operator.get(encode_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):
                if encode_name == "none":
                    buffer.append(head + "".join(item) + tail)
                else:
                    buffer.append(encode_fun(head + "".join(item) + tail))
                if len(buffer) == buffer_size:
                    f.write(crlf.join(buffer) + crlf)
                    buffer = []
        f.write(crlf.join(buffer))
    finishprinter(storepath)
def get_base_dic(objflag):
    storepath = finalsavepath(fun_name())

    objflag = getchars(objflag)
    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):
                f.write(
                    pyoptions.operator.get(pyoptions.encode)
                    (pyoptions.head + "".join(item) + pyoptions.tail) +
                    pyoptions.CRLF)

    finishprinter(storepath)
Ejemplo n.º 6
0
def comparer_magic(*args):
    """[minuend_file] [subtrahend_file]"""
    args = list(args[0])

    if len(args) != 3:
        exit(pyoptions.CRLF + cool.fuchsia("[!] Usage: {} {}".format(
            args[0], pyoptions.tools_info.get(args[0]))))
    storepath = finalsavepath(fun_name())

    minuend_file = args[1]
    subtrahend_file = args[2]
    if not os.path.isfile(os.path.abspath(pyoptions.args_tool[1])):
        exit(pyoptions.CRLF +
             cool.red("[-] file: {} don't exists".format(minuend_file)))
    if not os.path.isfile(os.path.abspath(pyoptions.args_tool[2])):
        exit(pyoptions.CRLF +
             cool.red("[-] file: {} don't exists".format(subtrahend_file)))

    minuend_list = walk_pure_file(minuend_file)
    subtrahend_list = walk_pure_file(subtrahend_file)
    with open(storepath, "a") as f:
        for item in minuend_list:
            if item not in subtrahend_list:
                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(storepath)
Ejemplo n.º 7
0
def comparer_magic(*args):
    """[minuend_file] [subtrahend_file]"""
    args = list(args[0])

    if len(args) != 3:
        exit(pyoptions.CRLF + cool.fuchsia("[!] Usage: {} {}".format(
            args[0], pyoptions.tools_info.get(args[0]))))
    storepath = finalsavepath(fun_name())

    minuend_file = args[1]
    subtrahend_file = args[2]
    if not os.path.isfile(os.path.abspath(pyoptions.args_tool[1])):
        exit(pyoptions.CRLF +
             cool.red("[-] file: {} don't exists".format(minuend_file)))
    if not os.path.isfile(os.path.abspath(pyoptions.args_tool[2])):
        exit(pyoptions.CRLF +
             cool.red("[-] file: {} don't exists".format(subtrahend_file)))

    minuend_list = walk_pure_file(minuend_file)
    subtrahend_list = walk_pure_file(subtrahend_file)

    # global variable transfer local variable to improved speed
    buffer = []
    buffer_size = pyoptions.buffer_size
    head = pyoptions.head
    tail = pyoptions.tail
    crlf = pyoptions.CRLF
    encode_name = pyoptions.encode
    encode_fun = pyoptions.operator.get(encode_name)

    minlen = pyoptions.minlen
    maxlen = pyoptions.maxlen
    args_pick = pyoptions.args_pick
    letter_occur = pyoptions.letter_occur
    digital_occur = pyoptions.digital_occur
    special_occur = pyoptions.special_occur
    occur_is_filter = pyoptions.occur_is_filter
    letter_types = pyoptions.letter_types
    digital_types = pyoptions.digital_types
    special_types = pyoptions.special_types
    types_is_filter = pyoptions.types_is_filter
    letter_repeat = pyoptions.letter_repeat
    digital_repeat = pyoptions.digital_repeat
    special_repeat = pyoptions.special_repeat
    repeat_is_filter = pyoptions.repeat_is_filter
    filter_regex = pyoptions.filter_regex
    regex_is_filter = pyoptions.regex_is_filter

    with open(storepath, "a") as f:
        for item in minuend_list:
            if item not in subtrahend_list:
                item = fff_speed(item, head, tail, minlen, maxlen, args_pick,
                                 encode_fun, letter_occur, digital_occur,
                                 special_occur, occur_is_filter, letter_types,
                                 digital_types, special_types, types_is_filter,
                                 letter_repeat, digital_repeat, special_repeat,
                                 repeat_is_filter, filter_regex,
                                 regex_is_filter)
                if item:
                    f.write(item + pyoptions.CRLF)

    finishprinter(storepath)
Ejemplo n.º 8
0
    def do_run(self, args):
        storepath = finalsavepath(fun_name())

        pystrs.startime = time.time()
        results = []
        paths.results_file_name = None
        # SingleRule
        for single in SingleRule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                                 pystrs.sedb_dict[pystrs.sedb_range[1]],
                                 pystrs.sedb_dict[pystrs.sedb_range[2]],
                                 pystrs.sedb_dict[pystrs.sedb_range[3]],
                                 pystrs.sedb_dict[pystrs.sedb_range[4]],
                                 pystrs.sedb_dict[pystrs.sedb_range[5]],
                                 pystrs.sedb_dict[pystrs.sedb_range[6]],
                                 pystrs.sedb_dict[pystrs.sedb_range[7]],
                                 pystrs.sedb_dict[pystrs.sedb_range[8]],
                                 pystrs.sedb_dict[pystrs.sedb_range[9]],
                                 pystrs.sedb_dict[pystrs.sedb_range[10]],
                                 pystrs.sedb_dict[pystrs.sedb_range[11]],
                                 pystrs.sedb_dict[pystrs.sedb_range[12]],
                                 pystrs.sedb_dict[pystrs.sedb_range[13]],
                                 pystrs.sedb_dict[pystrs.sedb_range[14]]):
            results.append(single)
        # SDrule
        for sd in SDrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(sd)
        for sd in SDrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(sd)
        # EB
        for eb in EB(pystrs.sedb_dict[pystrs.sedb_range[1]],
                     pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(eb)
        for eb in EB(pystrs.sedb_dict[pystrs.sedb_range[1]],
                     pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(eb)
        # Mailrule
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[0]]):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[1]]):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[2]]):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[4]]):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[10]]):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[14]]):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[3]],
                           isstrs=False):
            results.append(mr)
        for mr in Mailrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                           pystrs.sedb_dict[pystrs.sedb_range[13]],
                           isstrs=False):
            results.append(mr)
        # NB
        for nn in NB(pystrs.sedb_dict[pystrs.sedb_range[10]],
                     pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(nn)
        for nn in NB(pystrs.sedb_dict[pystrs.sedb_range[10]],
                     pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)

        # SB
        for sb in SB(pystrs.sedb_dict[pystrs.sedb_range[2]],
                     pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(sb)
        for sb in SB(pystrs.sedb_dict[pystrs.sedb_range[2]],
                     pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(sb)

        # NNrule
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[5]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[6]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[5]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[6]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[7]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[9]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[12]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[7]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[9]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[11]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[12]]):
            results.append(nn)
        for nn in NNrule(pystrs.sedb_dict[pystrs.sedb_range[3]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(nn)

        # SNrule
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[5]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[6]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[7]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[9]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[11]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[4]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(sn)

        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[5]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[6]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[7]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[9]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[11]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(sn)

        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[3]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[5]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[6]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[7]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[9]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[11]]):
            results.append(sn)
        for sn in SNrule(pystrs.sedb_dict[pystrs.sedb_range[14]],
                         pystrs.sedb_dict[pystrs.sedb_range[13]]):
            results.append(sn)

        # SSrule
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[1]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[4]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[8]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[10]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[0]],
                         pystrs.sedb_dict[pystrs.sedb_range[14]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[1]],
                         pystrs.sedb_dict[pystrs.sedb_range[4]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[1]],
                         pystrs.sedb_dict[pystrs.sedb_range[8]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[1]],
                         pystrs.sedb_dict[pystrs.sedb_range[10]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[1]],
                         pystrs.sedb_dict[pystrs.sedb_range[14]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                         pystrs.sedb_dict[pystrs.sedb_range[10]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[8]],
                         pystrs.sedb_dict[pystrs.sedb_range[14]]):
            results.append(ss)
        for ss in SSrule(pystrs.sedb_dict[pystrs.sedb_range[10]],
                         pystrs.sedb_dict[pystrs.sedb_range[14]]):
            results.append(ss)

        # WeakPass
        for weakpwd in walks_all_files(paths.sedblist_path):
            results.append(weakpwd)
        readylist = []
        readylist.extend(pystrs.sedb_dict[pystrs.sedb_range[0]])
        readylist.extend(pystrs.sedb_dict[pystrs.sedb_range[1]])
        readylist.extend(pystrs.sedb_dict[pystrs.sedb_range[2]])
        readylist.extend(pystrs.sedb_dict[pystrs.sedb_range[4]])
        readylist.extend(pystrs.sedb_dict[pystrs.sedb_range[10]])
        readylist.extend(pystrs.sedb_dict[pystrs.sedb_range[14]])
        # Using extend_enter plug
        for extendstr in extend_enter(readylist, leet=pyoptions.sedb_leet):
            results.append(extendstr)

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