def scraper_magic(target=paths.scrapersites_path, only_scratch=False): sites = [] if os.path.isfile(target): with open(target, 'r') as f: for _ in f.readlines(): if _.startswith(pyoptions.annotator): pass else: sites.append(checkurl(_)) else: sites.append(checkurl(target)) rawlist = scratchword(sites) if only_scratch: storepath = os.path.join( paths.results_path, "%s_%s%s" % (pystrs.SCFATCH_prefix, mybuildtime(), pyoptions.filextension)) with open(storepath, "a") as f: for line in rawlist: f.write(str(line) + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath) else: storepath = os.path.join( paths.results_path, "%s_%s%s" % (pystrs.SCFATCH_prefix, mybuildtime(), pyoptions.filextension)) with open(storepath, "a") as f: for line in rawlist: f.write(str(line) + pyoptions.CRLF) get_extend_dic(rawlist, need_extendscratch=True)
def extend_magic(rawlist, need_passcratch=False): prefix = pystrs.EXTEND_prefix if rawlist == []: exit(pyoptions.CRLF + cool.red("[-] raw extend resource cannot be empty")) leet = pyoptions.extend_leet if need_passcratch: prefix = pystrs.PASSCRAPER_prefix leet = pyoptions.passcraper_leet rawstorepath = os.path.join( paths.results_path, "%s_%s%s" % (pystrs.SCFATCH_prefix, mybuildtime(), pyoptions.filextension)) with open(rawstorepath, "a") as f: for line in rawlist: f.write(str(line) + pyoptions.CRLF) finalstorepath = os.path.join( paths.results_path, "%s_%s%s" % (prefix, mybuildtime(), pyoptions.filextension)) with open(finalstorepath, "a") as f: if not pyoptions.args_pick: for _ in walks_all_files(paths.weblist_path): f.write( pyoptions.operator.get(pyoptions.encode)(str(_) + pyoptions.CRLF)) if pyoptions.level <= 1: for _ in walks_all_files(paths.syslist_path): f.write( pyoptions.operator.get( pyoptions.encode)(str(_) + pyoptions.CRLF)) for _ in extend_enter(rawlist, leet=leet): f.write( pyoptions.operator.get(pyoptions.encode)(str(_) + pyoptions.CRLF)) else: for _ in walks_all_files(paths.weblist_path): if pyoptions.minlen <= len(_) <= pyoptions.maxlen: f.write( pyoptions.operator.get( pyoptions.encode)(str(_) + pyoptions.CRLF)) if pyoptions.level <= 1: for _ in walks_all_files(paths.syslist_path): if pyoptions.minlen <= len(_) <= pyoptions.maxlen: f.write( pyoptions.operator.get( pyoptions.encode)(str(_) + pyoptions.CRLF)) for _ in extend_enter(rawlist, leet=leet): if pyoptions.minlen <= len(_) <= pyoptions.maxlen: f.write( pyoptions.operator.get( pyoptions.encode)(str(_) + pyoptions.CRLF)) finishprinter(finishcounter(finalstorepath), finalstorepath)
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)
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: for item in itertools.permutations(objflag, len(objflag)): 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)
def combiner_enter(directory=os.path.abspath(sys.argv[0]), need_uniqifer=False): if not os.path.isdir(os.path.abspath(directory)): exit(pyoptions.CRLF + cool.red("[-] path: {} don't exists".format(directory))) filepaths = [] combine_list = [] storepath = finalsavepath(paths.results_path, pystrs.COMBINER_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name if not need_uniqifer else None) 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 open(storepath, "a") as f: for onefile in combine_list: with open(onefile, 'r') as tf: f.write(tf.read()) if not need_uniqifer: finishprinter(finishcounter(storepath), storepath) else: uniqifer_enter(storepath, from_combiner=True) except Exception as ex: print(pyoptions.CRLF + cool.red("[-] Combine file failed, Looking: ")) exit(pyoptions.CRLF + traceback.print_exc())
def uniqifer_enter(original_file_path, from_combiner=False): dict_prefix = pystrs.UNIQIFER_prefix if from_combiner: dict_prefix = pystrs.UNIQBINER_prefix storepath = finalsavepath(paths.results_path, dict_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name) with open(original_file_path) as o_f: with open(storepath, "a") as s_f: for item in unique(o_f.readlines()): item = filterforfun(item.strip(), 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: s_f.write(item + pyoptions.CRLF) print("[+] Source of :{0} lines".format(cool.orange(finishcounter(original_file_path)))) finishprinter(finishcounter(storepath), storepath)
def get_handler_dic(path): if not os.path.isfile(path): exit(cool.red("[-] File don't exits" + pyoptions.CRLF)) storepath = finalsavepath(paths.results_path, pystrs.HANDLER_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name) handles = [] with open(path, 'r') as f: for item in f.readlines(): handles.append(item.strip()) with open(storepath, 'a') as save: for item in handles: 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: save.write(item + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def build_conf_dic(): storepath = os.path.join( paths.results_path, "%s_%s%s" % (pystrs.CONF_prefix, mybuildtime(), pyoptions.filextension)) with open(storepath, "a") as f: for item in confcore(paths.buildconf_path): f.write(str(item) + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def birthday_magic(begin_date, end_date): def check_date(dt, desc="datetime"): if len(dt) != 8 or not dt.isdigit(): exit( cool.fuchsia( "[!] {} format:[YYYYMMDD], such as:19900512{}".format( desc, pyoptions.CRLF))) elif int(dt[4:6]) > 12 or int(dt[4:6]) < 1 or int(dt[6:8]) > 31 or int( dt[6:8]) < 1: exit( cool.fuchsia( "[!] {} date format: 1<= month <=12 and 1<= day <=31{}". format(desc, pyoptions.CRLF))) else: return int(dt[:4]), int(dt[4:6]), int(dt[6:]) def check_range(s, e): if s[0] > e[0] or (s[0] == e[0] and s[1] > e[1]) or (s[1] == e[1] and s[2] > e[2]): exit( cool.fuchsia("[!] Start date should later than End date" + pyoptions.CRLF)) else: return True start_valid = check_date(begin_date, desc="Start datetime") end_valid = check_date(end_date, desc="End datetime") valid = check_range(start_valid, end_valid) if start_valid and end_valid else False storepath = finalsavepath(paths.results_path, pystrs.BIRTHDAY_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name) if valid: res = [] begin = datetime.datetime.strptime(begin_date, "%Y%m%d") end = datetime.datetime.strptime(end_date, "%Y%m%d") while begin <= end: date_str = begin.strftime("%Y%m%d") res.extend(dateshaper(date_str)) begin += datetime.timedelta(days=1) with open(storepath, "a") as f: for item in unique(res): item = filterforfun( item, head=pyoptions.head, tail=pyoptions.tail, lenght_is_filter=pyoptions.args_pick, minlen=pyoptions.minlen, maxlen=pyoptions.maxlen, encode_is_filter=True, encode=pyoptions.encode, ) if item: f.write(item + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def idcard_magic(posflag): storepath = finalsavepath(paths.results_path, pystrs.IDCARD_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name) 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 pystrs.default_sex == pystrs.sex_range[0]: rand = ("1", "3", "5", "7", "9") for _ in rand: for _p in post18: value1718 += _ + _p + " " elif pystrs.default_sex == pystrs.sex_range[1]: rand = ("0", "2", "4", "6", "8") for _ in rand: for _p in post18: value1718 += _ + _p + " " elif pystrs.default_sex == pystrs.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 == pystrs.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( pyoptions.operator.get(pyoptions.encode) (pyoptions.head + "".join(v1112 + v1314 + v1516 + v1718) + pyoptions.tail) + pyoptions.CRLF) elif posflag == pystrs.plug_range[0]: for v1314 in value1314.split(" "): for v1516 in value1516.split(" "): for v1718 in value1718.split(" "): if v1718 != "": f.write( pyoptions.operator.get(pyoptions.encode) (pyoptions.head + "".join(v1314 + v1516 + v1718) + pyoptions.tail) + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def uniqifer_enter(original_file_path, from_combiner=False): prefix = pystrs.UNIQIFER_prefix if from_combiner: prefix = pystrs.UNIQBINER_prefix storepath = os.path.join( paths.results_path, "%s_%s%s" % (prefix, mybuildtime(), pyoptions.filextension)) with open(original_file_path) as o_f: with open(storepath, "a") as s_f: for _ in unique(o_f.readlines()): s_f.write(_) print("[+] Source of :{0} lines".format( cool.orange(finishcounter(original_file_path)))) finishprinter(finishcounter(storepath), storepath)
def counter_operator(original_file_path, justsave, justview, encodeflag, head, tail, vs_count=pyoptions.default_vs_items): items = Counter( open(original_file_path, 'r').read().replace(string.punctuation, "").split( pyoptions.counter_split)).most_common(vs_count) items_length = len(items) storepath = os.path.join( paths.results_path, "%s_%s%s" % (pystrs.COUNTER_prefix, mybuildtime(), pyoptions.filextension)) if vs_count > pyoptions.vs_counter_switcher: exit(pyoptions.CRLF + cool.fuchsia("[!] view items should Leq {0}".format( pyoptions.vs_counter_switcher))) elif items_length < vs_count: exit(pyoptions.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( pyoptions.operator.get(encodeflag)(head + _[0] + tail) + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath) elif justview: print(pyoptions.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() - pystrs.startime)[:6]))) else: print(pyoptions.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(pyoptions.CRLF) with open(storepath, 'a') as f: for _ in items: f.write( pyoptions.operator.get(encodeflag)(head + _[0] + tail) + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def get_base_dic(objflag, need_char_dic=False): objflag = getchars(objflag, need_char=need_char_dic) 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)
def do_output(self, key): chunk = key.split(' ') if len(chunk) != 1: print(cool.fuchsia("[!] usage: output store_path" + pyoptions.CRLF)) elif not chunk[0]: print(cool.fuchsia("[!] usage: output store_path" + pyoptions.CRLF)) else: try: if not os.path.isdir(chunk[0]): tmp_dirpath, tmp_filename = os.path.split(chunk[0]) if '.' in tmp_filename: if not os.path.isdir(tmp_dirpath): os.makedirs(tmp_dirpath) paths.results_path = tmp_dirpath paths.results_file_name = tmp_filename else: if not os.path.isdir(chunk[0]): os.makedirs(chunk[0]) paths.results_path = chunk[0] else: paths.results_path = chunk[0] except WindowsError: 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 print("[+] store path: {0}".format( cool.green( os.path.join( paths.results_path, this_name if paths.results_file_name != None else ''))) + pyoptions.CRLF)
def counter_operator(original_file_path, justsave, justview, encodeflag, head, tail, vs_count=pyoptions.default_vs_items): items = Counter( open(original_file_path, 'r').read().replace(string.punctuation, "").split( pyoptions.counter_split)).most_common(vs_count) items_length = len(items) storepath = finalsavepath(paths.results_path, pystrs.COUNTER_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name) if vs_count > pyoptions.vs_counter_switcher: exit(pyoptions.CRLF + cool.fuchsia("[!] view items should Leq {0}".format( pyoptions.vs_counter_switcher))) elif items_length < vs_count: exit(pyoptions.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: item = filterforfun( _[0], 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) elif justview: print(pyoptions.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() - pystrs.startime)[:6]))) else: print(pyoptions.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(pyoptions.CRLF) with open(storepath, 'a') as f: for _ in items: f.write( pyoptions.operator.get(encodeflag)(head + _[0] + tail) + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def do_run(self, args): pystrs.startime = time.time() results = [] storepath = os.path.join( paths.results_path, '%s_%s%s' % (pystrs.SEDB_prefix, mybuildtime(), pyoptions.filextension)) with open(storepath, "a") as f: # 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) if not pyoptions.args_pick: for ur in unique(results): f.write(ur + pyoptions.CRLF) else: for ur in unique(results): if pyoptions.minlen <= len(ur) <= pyoptions.maxlen: f.write(ur + pyoptions.CRLF) finishprinter(finishcounter(storepath), storepath)
def do_run(self, args): 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]], 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) 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)
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)