コード例 #1
0
ファイル: pupyimporter.py プロジェクト: 5l1v3r1/backdoorme-1
#
import sys, imp, zlib, marshal

builtin_memimporter = False
try:
    import _memimporter
    builtin_memimporter = True
except ImportError:
    pass

modules = {}
try:
    import pupy
    if not (hasattr(pupy, 'pseudo') and pupy.pseudo):
        modules = marshal.loads(
            zlib.decompress(pupy._get_compressed_library_string()))
except ImportError:
    #modules = marshal.loads(zlib.decompress(open("resources\\library_compressed_string.txt",'rb').read()))
    pass


def get_module_files(fullname):
    """ return the file to load """
    f = fullname.replace(".", "/")
    files = []
    for x in modules.iterkeys():
        if x.rsplit(
                ".", 1
        )[0] == f or f + "/__init__.py" == x or f + "/__init__.pyc" == x:
            files.append(x)
    return files
コード例 #2
0
ファイル: pupyimporter.py プロジェクト: kai5263499/pupy
sep = '\\'
if 'linux' in sys.platform:
    sep = '/'

builtin_memimporter=False
try:
    import _memimporter
    builtin_memimporter=True
except ImportError:
    pass

modules={}
try:
    import pupy
    if not (hasattr(pupy, 'pseudo') and pupy.pseudo):
        modules = marshal.loads(zlib.decompress(pupy._get_compressed_library_string()))
except ImportError:
    #modules = marshal.loads(zlib.decompress(open("resources\\library_compressed_string.txt",'rb').read()))
    pass

def get_module_files(fullname):
    """ return the file to load """
    global modules
    f=fullname.replace(".","/")
    files=[]
    for x in modules.iterkeys():
        if x.rsplit(".",1)[0]==f or f+"/__init__.py"==x or f+"/__init__.pyc"==x or f+"/__init__.pyo"==x:
            files.append(x)
    return files

def pupy_add_package(pkdic):
コード例 #3
0
def dprint(msg):
    global __debug
    if __debug:
        print msg

try:
    import _memimporter
    builtin_memimporter = True
except ImportError:
    builtin_memimporter = False

modules={}
try:
    import pupy
    if not (hasattr(pupy, 'pseudo') and pupy.pseudo):
        modules = marshal.loads(zlib.decompress(pupy._get_compressed_library_string()))
except ImportError:
    pass

def get_module_files(fullname):
    """ return the file to load """
    global modules
    path = fullname.replace('.','/')

    return [
        module for module in modules.iterkeys() \
        if module.rsplit(".",1)[0] == path or any([
            path+'/__init__'+ext == module for ext in [
                '.py', '.pyc', '.pyo'
            ]
        ])