Run Application
There are several ways to run a secupy cyphered code. All secupy build is a module, so the main way to run it is:
$ secupy -m package # package is a directory containing __main__.spy or __main__.py
OR
$ secupy -m entrypoint # entrypoint is a module
Note
Secupy is able to execute this code:
if __name__ == "__main__":
main()
Run a simple script called entrypoint.spy
$ secupy -m entrypoint
OR
$ python -m secupy -m entrypoint
Run a code builded with user defined aes password and salt
First of all you need to set values in the environment variables:
export SECUPY_PASSPHRASE=mypassword
export SECUPY_SALT=mysalt
set SECUPY_PASSPHRASE=mypassword
set SECUPY_SALT=mysalt
$env:SECUPY_PASSPHRASE=mypassword
$env:SECUPY_SALT=mysalt
Now run the code:
$ secupy -m entrypoint
OR
$ python -m secupy -m entrypoint
Run application from remote origin
We have remote_hello.spy
under remote_example
directory. This is the clear content:
print(f"Downloaded {__name__} from remote origin")
def say_hello():
print("Hello from www.secupy.com")
With this snippet you can execute code downloaded from a remote endpoint
import secupy
with secupy.SecupyRemoteUtil("https://www.secupy.com/documentation/_static/remote_example") as session:
from remote_hello import say_hello
say_hello()
# Interactive Shell
$ python
Python 3.10.5 (v3.10.5:f377153967, Jun 6 2022, 12:36:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import secupy
>>> with secupy.SecupyRemoteUtil("https://www.secupy.com/documentation/_static/remote_example") as session:
... from remote_hello import say_hello
...
Downloaded remote_hello from remote origin
>>> say_hello()
Hello from www.secupy.com
Note
SecupyRemoteUtil
returns an instance of a Requests - Session object