Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted drivers #442

Open
nirs opened this issue Jul 9, 2022 · 0 comments
Open

Encrypted drivers #442

nirs opened this issue Jul 9, 2022 · 0 comments

Comments

@nirs
Copy link
Member

nirs commented Jul 9, 2022

The examples drivers are too easy to decompile. Change the code to support
encrypted drivers and add a tool to encrypt driver modules.

Examples for encrypting and decrypting:
https://pycryptodome.readthedocs.io/en/latest/src/examples.html

Change rose.client.main.load_driver_module() to read client data from file
and create a module without importing module from disk. This is better anyway
for plugins.

For loading module from decrypted bytes:
https://docs.python.org/3.6/library/functions.html#exec

$ cat load.py 
import sys

with open(sys.argv[1], "rb") as f:
    data = f.read()

env = {}
exec(data, env, env)

print(env["driver_name"])
print(env["drive"])


$ python load.py examples/none.py 
No Driver
<function drive at 0x7fb3ea287d90>

The example code does not support pyc files, they are not needed once we use
encrypted drivers and are also not portable between python versions so we
should stop using them.

The client needs new --key-file argument with the path to the key used to decrypt
the driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant