Ejemplo n.º 1
0
 def printabler():
     is_py3 = py_ver_egt_3()
     if is_py3:
         f = open(filepath, 'r', encoding='utf8', errors='replace')
     else:
         import codecs
         f = codecs.open(filepath, 'r', encoding='utf8', errors='replace')
     for item in f:
         item = item.strip()
         if item:
             ret = filter(lambda x: x in string.printable, item)
             if is_py3:
                 if len(list(ret)) == len(item):
                     yield item
             else:
                 if len(ret) == len(item):
                     yield item
     f.close()
def leet_mode_magic(strings, code, *args):
    intab = outtab = ""
    if code == 0:
        for leet in get_leet_cfg():
            intab += leet[0]
            outtab += leet[1]
        if not py_ver_egt_3():
            maptab = string.maketrans(intab, outtab)
            ret = str(strings).translate(maptab)
        else:
            maptab = str.maketrans(intab, outtab)
            ret = strings.translate(maptab)
        return ret
    elif 11 <= code <= 29 or 1 <= code <= 2:
        if 21 <= code <= 29 or code == 2:
            searchstrs = strings[::-1]
        else:
            searchstrs = strings

        search = 0
        ret = strings
        searchover = len(searchstrs)
        for s in searchstrs:
            search += 1
            for leet in get_leet_cfg():
                if leet[0] == s:
                    if code == 1:
                        ret = strings.replace(leet[0], leet[1])
                        return ret
                    elif code == 2:
                        ret = rreplace(strings, leet[0], leet[1])
                        return ret
                    elif 11 <= code <= 19:
                        ret = strings.replace(leet[0], leet[1], code % 10)
                        return ret
                    elif 21 <= code <= 29:
                        ret = rreplace(strings, leet[0], leet[1], code % 20)
                        return ret
                    else:
                        return strings
            if search >= searchover:
                return ret
    else:
        return strings
Ejemplo n.º 3
0
"""
Copyright (c) 2016-2017 LandGrey (https://github.com/LandGrey/pydictor)
License: GNU GENERAL PUBLIC LICENSE Version 3
"""

from __future__ import unicode_literals

import os
import re
import itertools
from core.CONF import confcore
from lib.fun.osjudger import py_ver_egt_3
from lib.fun.leetmode import leet_mode_magic
from lib.data.data import paths, pystrs, pyoptions
from lib.fun.fun import cool, finishprinter, finishcounter, walks_all_files, mybuildtime, unique, charanger
if not py_ver_egt_3():
    import ConfigParser
else:
    import configparser as ConfigParser


def wordsharker(raw, leet=True):
    # raw word maybe strange case, both not lowercase and uppercase, such as 'myName'
    #
    init_word_res = []
    raw = str(raw).strip()

    # level {format}
    if pyoptions.level <= 5:
        # 5 {raw}
        init_word_res.append(raw)
Ejemplo n.º 4
0
def range_compatible(minlength, maxlength_plus_one):
    if py_ver_egt_3():
        return range(minlength, maxlength_plus_one)
    else:
        return xrange(minlength, maxlength_plus_one)
Ejemplo n.º 5
0
from __future__ import unicode_literals

import os
import re
import ssl
from lib.fun.decorator import magic
from lib.fun.osjudger import py_ver_egt_3
from lib.data.data import paths, pyoptions
from lib.fun.fun import unique, cool, walk_pure_file

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 = [