How To Build Your Project
secupy build
takes in input the clear source code (.py, .pyw) or compiled bytecode (.pyc) and puts in output a cyphered and protected bundle.
Below there is the help:
$ secupy build --help
usage: secupy build [-h] -s SOURCE -d DESTINATION [--ttl TTL] [--password PASSWORD] [--salt SALT] [-e EXCLUDE] [-i INCLUDE] [-u UNPROTECT] [-v]
options:
-h, --help show this help message and exit
-s SOURCE, --source SOURCE
source directory or single file
-d DESTINATION, --destination DESTINATION
destination directory
--ttl TTL ttl in days
--password PASSWORD user aes password
--salt SALT user aes salt
-e EXCLUDE, --exclude EXCLUDE
can be multiple. Patterns are the same as for fnmatch, with the addition of "**" which means "src directory and all subdirectories, recursively"
-i INCLUDE, --include INCLUDE
can be multiple. Patterns are the same as for fnmatch, with the addition of "**" which means "src directory and all subdirectories, recursively"
-u UNPROTECT, --unprotect UNPROTECT
can be multiple. Patterns are the same as for fnmatch, with the addition of "**" which means "src directory and all subdirectories, recursively"
-v, --verbose enable debug
Protect a single file called entrypoint.py and put it in protected_src
directory
$ secupy build -s entrypoint.py -d protected_src
License 'team' is valid for 323 day(s) 4 hour(s) 9 minute(s) and 41 second(s)
100%|███████████████████████████████████████████| 1/1 [00:00<00:00, 85.95file/s]
$ tree
.
├── entrypoint.py
└── protected_src
└── entrypoint.spy
1 directory, 2 files
Protect a package with user defined aes password and salt and put it in protected_src
directory
Warning
The user defined aes password and salt must be decleared as environment variables during the run phase
$ secupy build -s package -d protected_src/package --password mypassword --salt mysalt
License 'team' is valid for 323 day(s) 2 hour(s) 32 minute(s) and 20 second(s)
User defined password for encryption. (SECUPY_PASSPHRASE env needed for decrypt)
User defined salt for encryption. (SECUPY_SALT env needed for decrypt)
100%|██████████████████████████████████████████| 2/2 [00:00<00:00, 189.34file/s]
$ tree
.
├── package
│ ├── __init__.py
│ └── __main__.py
└── protected_src
└── package
├── __init__.spy
└── __main__.spy
3 directories, 4 files
Protect a single file called entrypoint.py, set a limitetd time to live and put it in protected_src
directory
Note
In this example, TTL is set to 365 days. After this time, software can’t be executed
$ secupy build -s entrypoint.py -d protected_src --ttl 365
License 'team' is valid for 323 day(s) 2 hour(s) 26 minute(s) and 59 second(s)
Code Time To Live is 365 day(s) 0 hour(s) 0 minute(s) and 0 second(s)
100%|███████████████████████████████████████████| 1/1 [00:00<00:00, 97.74file/s]
$ tree
.
├── entrypoint.py
└── protected_src
└── entrypoint.spy
1 directory, 2 files
Protect a package, with a combination of flags exclude, include and unprotect. Finally put it in protected_src
directory
Warning
The include flag is active only on excluded elements. By default all not .py, .pyw and .pyc files are copied without encryption
$ secupy build -s package -d protected_src/package --exclude subpackage_2 --exclude subpackage_1 --include subpackage_1/__init__.py --unprotect subpackage_0/__init__.py
License 'team' is valid for 323 day(s) 2 hour(s) 19 minute(s) and 22 second(s)
100%|████████████████████████████████████████| 11/11 [00:00<00:00, 759.08file/s]
$ tree
.
├── package
│ ├── __init__.py
│ ├── __main__.py
│ ├── subpackage_0
│ │ ├── __init__.py
│ │ └── __main__.py
│ ├── subpackage_1
│ │ ├── __init__.py
│ │ └── __main__.py
│ └── subpackage_2
│ ├── __init__.py
│ └── __main__.py
└── protected_src
└── package
├── __init__.spy
├── __main__.spy
├── subpackage_0
│ ├── __init__.py
│ └── __main__.spy
└── subpackage_1
└── __init__.py
8 directories, 13 files