11# pyencrypt-pye
2+
23---
4+
35encrypt python source code and import module dynamically.
46
57```
@@ -16,10 +18,12 @@ encrypt python source code and import module dynamically.
1618```
1719
1820## Install
21+
1922``` bash
2023pip install git+https://github.com/ZhaoQi99/pyencrypt-pye.git
2124✨🍰✨
2225```
26+
2327## Usage
2428
2529``` shell
@@ -33,23 +37,45 @@ Commands:
3337 decrypt Decrypt encrypted pye file
3438 encrypt Encrypt your python code
3539 generate Generate loader file using specified key
40+ license Generate license file using specified key
3641```
3742
3843### Encrypt
44+
3945``` shell
4046~ $ pyencrypt encrypt -h
4147Usage: pyencrypt encrypt [OPTIONS] PATHNAME
4248
4349 Encrypt your python code
4450
4551Options:
46- -i, --in-place make changes to files in place
47- -k, --key TEXT Your encryption key.If you don‘t specify key, pyencrypt will
48- generate encryption key randomly.
49- --yes Automatically answer yes for confirm questions.
50- -h, --help Show this message and exit.
52+ -i, --in-place make changes to files in place
53+ -k, --key TEXT Your encryption key.If you don‘t specify
54+ key, pyencrypt will generate encryption key
55+ randomly.
56+ --with-license Add license to encrypted file
57+ -m, --bind-mac TEXT Bind mac address to encrypted file
58+ -4, --bind-ipv4 TEXT Bind ipv4 address to encrypted file
59+ -b, --before [%Y-%m-%dT%H:%M:%S %z| %Y-%m-%d %H:%M:%S| %Y-%m-%d]
60+ License is invalid before this date.
61+ -a, --after [%Y-%m-%dT%H:%M:%S %z| %Y-%m-%d %H:%M:%S| %Y-%m-%d]
62+ License is invalid after this date.
63+ -y, --yes Automatically answer yes for confirm
64+ questions.
65+ -h, --help Show this message and exit.
66+ ```
67+
68+ ### Entry File
69+
70+ In your entry file, you must import ` loader ` firstly, and then you can import encrypted modules as usual.
71+
72+ ``` python
73+ import loader
74+ from test import *
5175```
76+
5277### Decrypt
78+
5379``` shell
5480~ $ pyencrypt decrypt -h
5581Usage: pyencrypt decrypt [OPTIONS] PATHNAME
@@ -61,6 +87,7 @@ Options:
6187 -k, --key TEXT Your encryption key. [required]
6288 -h, --help Show this message and exit.
6389```
90+
6491### Generate
6592
6693``` shell
@@ -74,26 +101,63 @@ Options:
74101 -h, --help Show this message and exit.
75102```
76103
104+ ### License
105+
106+ pyencrypt's loader will search for the license file in the following manner:
107+
108+ 1 . ` ~/.licenses/license.lic ` file in your home directory.
109+
110+ 2 . ` licenses/license.lic ` file in ` loader ` file's directory.
111+
112+ 3 . ` licenses/license.lic ` file in the current working directory.
113+
114+ ``` shell
115+ ~ $ pyencrypt license -h
116+ Usage: pyencrypt license [OPTIONS]
117+
118+ Generate license file using specified key
119+
120+ Options:
121+ -h, --help Show this message and exit.
122+ -k, --key TEXT Your encryption key. [required]
123+ -m, --bind-mac TEXT Your mac address.
124+ -4, --bind-ipv4 TEXT Your ipv4 address.
125+ -b, --before [%Y-%m-%dT%H:%M:%S %z| %Y-%m-%d %H:%M:%S| %Y-%m-%d]
126+ License is invalid before this date.
127+ -a, --after [%Y-%m-%dT%H:%M:%S %z| %Y-%m-%d %H:%M:%S| %Y-%m-%d]
128+ License is invalid after this date.
129+ ```
130+
77131## Example
132+
78133### Encrypt
134+
79135``` shell
80136~ $ pyencrypt encrypt --in-place -y test.py
81137~ $ pyencrypt encrypt test/
138+ ~ $ pyencrypt encrypt test.py -y --with-license\
139+ --before=" 2000-01-01T00:00:00 +0800" --after=" 2030-01-01T00:00:00 +0800" \
140+ --bind-mac=" AC:DE:48:00:11:22" --bind-ipv4=" 192.168.0.1"
82141```
83142
84143### Decrypt
144+
85145``` shell
86146~ $ pyencrypt decrypt -k xxx test.pye
87147```
148+
88149### Generate
150+
89151``` shell
90152~ $ pyencrypt generate -k xxx
91153```
92154
93- ### Entry File
94- ``` python
95- import loader
96- from test import *
155+ ### License
156+
157+ ``` shell
158+ ~ $ pyencrypt license -k xxx\
159+ --before=" 2000-01-01T00:00:00 +0800" --after=" 2030-01-01T00:00:00 +0800" \
160+ --bind-mac=" AC:DE:48:00:11:22" --bind-ipv4=" 192.168.0.1"
97161```
98162
99163## Development
@@ -104,7 +168,11 @@ from test import *
104168yapf --recursive -i pyencrypt
105169isort pyencrypt
106170```
171+
107172## License
173+
108174[ GNU General Public License v3.0] ( https://github.com/ZhaoQi99/pyencrypt-pye/blob/main/LICENSE )
175+
109176## Author
177+
110178
0 commit comments