Skip to main content

Load module from zip

Project description

zip_import

  • 推荐(最新的版本)
pip install https://github.com/cn-kali-team/zip_import/archive/master.zip
  • 内存加载Python模块
import io
import sys
import zipfile
from zip_import import ZipPathFinder


def _get_zip(path, password=None):
    with open(path, "rb") as f:
        zip_bytes = io.BytesIO(f.read())
        zip_instantiation = zipfile.ZipFile(zip_bytes)
        if password is not None:
            zip_instantiation.setpassword(pwd=bytes(str(password), 'utf-8'))
        return zip_instantiation


sys.meta_path.append(
    ZipPathFinder(zip_path='zip://pocsuite3.zip', zip_ins=_get_zip(path='pocsuite3.zip', password="11")))
import pocsuite3

print(dir(pocsuite3))
  • zip_path随意字符串,zip_ins是zipfile.ZipFile返回的实例化对象

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zip_import-0.0.1.tar.gz (16.9 kB view details)

Uploaded Source

File details

Details for the file zip_import-0.0.1.tar.gz.

File metadata

  • Download URL: zip_import-0.0.1.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for zip_import-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8001d6afb8cef41aacf0d97442b8771d6c0fe3704655970815011d2a317b8da4
MD5 283f32b72841a718975679f1fcba21b6
BLAKE2b-256 fd66ba55f7a9e0d11304c3668ab2878793c9561352396c0de95766bf35b3452c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page