I know python modules/scripts can be run from within a zip archive, as outlined here: https://www.python.org/dev/peps/pep-0441/ and https://blogs.gnome.org/jamesh/2012/05/21/python-zip-files/
But my question is:
Is it possible to password protect this archive or .pyz file and run it with another small python script that will send the password and then run the __main__.py
?
Thanks!
I needed something like this for myself, so I made it. You need the module found here: https://github.com/Dakkaron/ArchiveImporter
Then you can just use it like this:
python ArchiveImporter.py [zipfile] [-p=password] [args...]
Works for both Python2 and Python3.
The module can also be used from code:
# First import the ArchiveImporter module
import ArchiveImporter
# Then add the password encrypted file you want to import from using addZip(zippath, password)
ArchiveImporter.addZip("test.pyz", "password")
# Now import modules from the archive as usual
import testmod