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)
def get_leet_cfg(): leet_mode = dict() leets = walk_pure_file(paths.leetmode_path, pure=False) for _ in leets: chunk = _.split(pyoptions.key_value_split) leet_mode[chunk[0].strip()] = chunk[1].strip() return leet_mode.items()
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)
def sedb_tricks(): for line in walk_pure_file(paths.sedbtrick_path, pure=False): trick = line.split(pyoptions.key_value_split) if len(trick) == 2: if trick[0].strip() == pystrs.sedb_trick_prefix: for _ in trick[1].strip().split(pyoptions.trick_split): pyoptions.sedb_trick_pre.append(_) elif trick[0].strip() == pystrs.sedb_trick_suffix: for _ in trick[1].strip().split(pyoptions.trick_split): pyoptions.sedb_trick_suf.append(_) elif trick[0].strip() == pystrs.sedb_trick_middle: for _ in trick[1].strip().split(pyoptions.trick_split): pyoptions.sedb_trick_mid.append(_)
ssl._create_default_https_context = ssl._create_unverified_context # in python3: urllib + urilib2 -> urllib, and # urllib2.urlopen() -> urllib.request.urlopen(), urllib2.Request() -> urllib.request.Request() try: if py_ver_egt_3(): from urllib.request import urlopen else: from urllib2 import urlopen except ImportError as e: print(e.message) exit( cool.red('[-] can not import urllib or urllib2 module:') + pyoptions.CRLF) passcratch_black_list = walk_pure_file(paths.scratch_blacklist) def stripHTMLTags(html): text = html rules = [ { r'>\s+': '>' }, # Remove spaces after a tag opens or closes. { r'\s+': ' ' }, # Replace consecutive spaces. { r'\s*<br\s*/?>\s*': '\n' }, # Newline after a <br>. {
ssl._create_default_https_context = ssl._create_unverified_context # in python3: urllib + urilib2 -> urllib, and # urllib2.urlopen() -> urllib.request.urlopen(), urllib2.Request() -> urllib.request.Request() try: if py_ver_egt_3(): from urllib.request import urlopen else: from urllib2 import urlopen except ImportError as e: print(e.message) exit( cool.red('[-] can not import urllib or urllib2 module:') + pyoptions.CRLF) passcratch_white_list = walk_pure_file(paths.scraperwhitelist_path) def stripHTMLTags(html): text = html rules = [ { r'>\s+': '>' }, # Remove spaces after a tag opens or closes. { r'\s+': ' ' }, # Replace consecutive spaces. { r'\s*<br\s*/?>\s*': '\n' }, # Newline after a <br>. {
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)