Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cn-kali-team/zip_import
Load module from zip
https://github.com/cn-kali-team/zip_import
Last synced: 18 days ago
JSON representation
Load module from zip
- Host: GitHub
- URL: https://github.com/cn-kali-team/zip_import
- Owner: cn-kali-team
- License: gpl-3.0
- Created: 2021-01-09T11:18:54.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-09T11:24:38.000Z (almost 4 years ago)
- Last Synced: 2024-11-19T02:23:30.691Z (about 1 month ago)
- Language: Python
- Size: 18.6 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zip_import
- 推荐(最新的版本)
```bash
pip install https://github.com/cn-kali-team/zip_import/archive/master.zip
```- 内存加载Python模块
```python
import io
import sys
import zipfile
from zip_import import ZipPathFinderdef _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_instantiationsys.meta_path.append(
ZipPathFinder(zip_path='zip://pocsuite3.zip', zip_ins=_get_zip(path='pocsuite3.zip', password="11")))
import pocsuite3print(dir(pocsuite3))
```- zip_path随意字符串,zip_ins是zipfile.ZipFile返回的实例化对象