Пример #1
0
def getIDCardPost(posflag, encodeflag, head, tail, sex):
    storepath = os.path.join(
        get_result_store_path(),
        "%s_%s_%s_%s%s" % (IDCARD_prefix, str(posflag)[-1:], get_buildtime(),
                           encodeflag, filextension))
    posrule = lambda _: str(_) if _ >= 10 else "0" + str(_)
    # month
    value1112 = " ".join(posrule(x) for x in range_compatible(1, 13))
    # day
    value1314 = " ".join(posrule(x) for x in range_compatible(1, 32))
    value1516 = " ".join(posrule(x) for x in range_compatible(1, 100))
    post18 = "0 1 2 3 4 5 6 7 8 9 X"
    value1718 = ""
    if sex == 'm':
        rand = "1 3 5 7 9"
        for _ in rand.split(' '):
            for _p in post18.split(' '):
                value1718 += _ + _p + " "
    elif sex == 'f':
        rand = "0 2 4 6 8"
        for _ in rand.split(' '):
            for _p in post18.split(' '):
                value1718 += _ + _p + " "
    else:
        rand = " ".join(str(_) for _ in range_compatible(0, 10))
        for _ in rand.split(' '):
            for _p in post18.split(' '):
                value1718 += _ + _p + " "
    with open(storepath, "w") as f:
        if posflag == 'pid8':
            for v1112 in value1112.split(' '):
                for v1314 in value1314.split(' '):
                    for v1516 in value1516.split(' '):
                        for v1718 in value1718.split(' '):
                            if v1718 != "":
                                if encodeflag == "":
                                    f.write(head + v1112 + v1314 + v1516 +
                                            v1718 + tail + CRLF)
                                else:
                                    f.write(
                                        operator.get(encodeflag)
                                        (head + v1112 + v1314 + v1516 + v1718 +
                                         tail) + CRLF)
        elif posflag == 'pid6':
            for v1314 in value1314.split(' '):
                for v1516 in value1516.split(' '):
                    for v1718 in value1718.split(' '):
                        if v1718 != "":
                            if encodeflag == "":
                                f.write(head + v1314 + v1516 + v1718 + tail +
                                        CRLF)
                            else:
                                f.write(
                                    operator.get(encodeflag)
                                    (head + v1314 + v1516 + v1718 + tail) +
                                    CRLF)
    finishprinter(finishcounter(storepath), storepath)
Пример #2
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)
Пример #3
0
def counter_operator(original_file_path,
                     justsave,
                     justview,
                     encodeflag,
                     head,
                     tail,
                     view_count=default_view_items):
    items = Counter(
        open(original_file_path, 'r').read().replace(
            string.punctuation,
            "").split(counter_split)).most_common(view_count)
    items_length = len(items)
    storepath = os.path.join(
        get_result_store_path(),
        "%s_%s%s" % (COUNTER_prefix, get_buildtime(), filextension))
    if view_count > view_counter_switcher:
        exit(CRLF + cool.fuchsia("[!] view items should Leq {0}".format(
            view_counter_switcher)))
    elif items_length < view_count:
        exit(CRLF + cool.fuchsia("[!] max items is {0}".format(items_length)))
    print("{0}Welcome to the COUNTER tool".format("   " * 8))
    if justsave:
        with open(storepath, "a") as f:
            for _ in items:
                f.write(operator.get(encodeflag)(head + _[0] + tail) + CRLF)
        finishprinter(finishcounter(storepath), storepath)
    elif justview:
        print(CRLF * 2)
        for item in items:
            print("{0}Word:{2:20} -> {1:10} times".format(
                "     " * 5, cool.orange(item[1]), cool.orange(item[0])))
        print("[+] Cost:{} seconds".format(
            cool.orange(str(time.time() - startime)[:6])))
    else:
        print(CRLF * 2)
        for item in items:
            print("{0}Word:{2:20} -> {1:10} times".format(
                "     " * 5, cool.orange(item[1]), cool.orange(item[0])))
        print(CRLF)
        with open(storepath, 'a') as f:
            for _ in items:
                f.write(operator.get(encodeflag)(head + _[0] + tail) + CRLF)
        finishprinter(finishcounter(storepath), storepath)
Пример #4
0
def get_idcard_post(posflag, encodeflag, head, tail, sex):
    storepath = os.path.join(get_result_store_path(), "%s_%s_%s_%s%s" %
                             (IDCARD_prefix, str(posflag)[-1:], get_buildtime(), encodeflag, filextension))
    posrule = lambda _: str(_) if _ >= 10 else "0" + str(_)
    # month
    value1112 = " ".join(posrule(x) for x in range_compatible(1, 13))
    # day
    value1314 = " ".join(posrule(x) for x in range_compatible(1, 32))
    value1516 = " ".join(posrule(x) for x in range_compatible(1, 100))
    post18 = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "X")
    value1718 = ""
    if sex == sex_range[0]:
        rand = ("1", "3", "5", "7", "9")
        for _ in rand:
            for _p in post18:
                value1718 += _ + _p + " "
    elif sex == sex_range[1]:
        rand = ("0", "2", "4", "6", "8")
        for _ in rand:
            for _p in post18:
                value1718 += _ + _p + " "
    elif sex == sex_range[2]:
        rand = " ".join(str(_) for _ in range_compatible(0, 10))
        for _ in rand.split(" "):
            for _p in post18:
                value1718 += _ + _p + " "

    with open(storepath, "a") as f:
        if posflag == plug_range[1]:
            for v1112 in value1112.split(" "):
                for v1314 in value1314.split(" "):
                    for v1516 in value1516.split(" "):
                        for v1718 in value1718.split(" "):
                            if v1718 != "":
                                f.write(operator.get(encodeflag)(head + v1112 + v1314 + v1516 + v1718 + tail) + CRLF)
        elif posflag == plug_range[0]:
                for v1314 in value1314.split(" "):
                    for v1516 in value1516.split(" "):
                        for v1718 in value1718.split(" "):
                            if v1718 != "":
                                f.write(operator.get(encodeflag)(head + v1314 + v1516 + v1718 + tail) + CRLF)
    finishprinter(finishcounter(storepath), storepath)
Пример #5
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
Пример #6
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)
Пример #7
0
def get_extend_dic(rawlist, encodeflag='none', need_passcratch=False):
    prefix = EXTEND_prefix
    if rawlist == []:
        exit(CRLF + cool.red("[-] raw extend_enter file cannot be empty"))
    if need_passcratch:
        prefix = PASSCRAPER_prefix
    storepath = os.path.join(
        get_result_store_path(),
        "%s_%s_%s%s" % (prefix, get_buildtime(), encodeflag, filextension))
    with open(storepath, "a") as f:
        try:
            for _ in extend_enter(rawlist):
                f.write(operator.get(encodeflag)(str(_) + CRLF))
        except:
            traceback.print_exc()
            exit(CRLF + cool.red("[-] Some error"))
    finishprinter(finishcounter(storepath), storepath)
Пример #8
0
def getExtendDic(rawlist, encodeflag=""):
    if rawlist == []:
        exit(CRLF + cool.red("[-] raw extend file cannot be empty"))
    storepath = os.path.join(
        get_result_store_path(), "%s_%s_%s%s" %
        (EXTEND_prefix, get_buildtime(), encodeflag, filextension))
    with open(storepath, 'w') as f:
        try:
            for _ in extend(rawlist):
                _ = str(_)
                if encodeflag == "":
                    f.write(_ + CRLF)
                else:
                    f.write(operator.get(encodeflag)(_ + CRLF))
        except:
            exit(CRLF + cool.red("[-] File's character encoding maybe error"))
    finishprinter(finishcounter(storepath), storepath)
Пример #9
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)