pyarmor.cli 9.2.2__tar.gz → 9.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/PKG-INFO +3 -3
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/README.rst +2 -2
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/__init__.py +1 -1
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/__main__.py +9 -1
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/command.py +1 -1
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/core.data.2 +0 -0
- pyarmor_cli-9.2.4/pyarmor/cli/core.data.3 +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/default.cfg +8 -1
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/generate.py +67 -2
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/register.py +7 -3
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor.cli.egg-info/PKG-INFO +3 -3
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/setup.py +1 -1
- pyarmor_cli-9.2.2/pyarmor/cli/core.data.3 +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/batch.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/bootstrap.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/bug.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/config.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/context.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/core.data.1 +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/docker.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/hdinfo.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/merge.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/mixer.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/model.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/plugin.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/project.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/public_capsule.zip +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/repack.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/resource.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor/cli/shell.py +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor.cli.egg-info/SOURCES.txt +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor.cli.egg-info/dependency_links.txt +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor.cli.egg-info/entry_points.txt +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor.cli.egg-info/requires.txt +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/pyarmor.cli.egg-info/top_level.txt +0 -0
- {pyarmor_cli-9.2.2 → pyarmor_cli-9.2.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyarmor.cli
|
|
3
|
-
Version: 9.2.
|
|
3
|
+
Version: 9.2.4
|
|
4
4
|
Summary: A comand line tool to obfuscate python scripts
|
|
5
5
|
Home-page: https://github.com/dashingsoft/pyarmor
|
|
6
6
|
Author: Jondy Zhao
|
|
@@ -27,7 +27,7 @@ Pyarmor is a command line tool used to obfuscate python scripts, bind obfuscated
|
|
|
27
27
|
Key Features
|
|
28
28
|
------------
|
|
29
29
|
|
|
30
|
-
* The obfuscated
|
|
30
|
+
* The obfuscated script is still a normal `.py` script, in most of cases the original python scripts can be replaced with obfuscated scripts seamlessly.
|
|
31
31
|
* Provide many ways to obfuscate the scripts to balance security and performance
|
|
32
32
|
* Rename functions/methods/classes/variables/arguments, irreversible obfuscation
|
|
33
33
|
* Convert part of Python functions to C function, compile to binary by high optimize option, irreversible obfuscation
|
|
@@ -37,7 +37,7 @@ Key Features
|
|
|
37
37
|
Support Platforms
|
|
38
38
|
-----------------
|
|
39
39
|
|
|
40
|
-
* Python 3.7~3.
|
|
40
|
+
* Python 3.7~3.15
|
|
41
41
|
* Windows
|
|
42
42
|
* Many linuxs, include embedded systems
|
|
43
43
|
* Apple Intel and Apple Silicon
|
|
@@ -6,7 +6,7 @@ Pyarmor is a command line tool used to obfuscate python scripts, bind obfuscated
|
|
|
6
6
|
Key Features
|
|
7
7
|
------------
|
|
8
8
|
|
|
9
|
-
* The obfuscated
|
|
9
|
+
* The obfuscated script is still a normal `.py` script, in most of cases the original python scripts can be replaced with obfuscated scripts seamlessly.
|
|
10
10
|
* Provide many ways to obfuscate the scripts to balance security and performance
|
|
11
11
|
* Rename functions/methods/classes/variables/arguments, irreversible obfuscation
|
|
12
12
|
* Convert part of Python functions to C function, compile to binary by high optimize option, irreversible obfuscation
|
|
@@ -16,7 +16,7 @@ Key Features
|
|
|
16
16
|
Support Platforms
|
|
17
17
|
-----------------
|
|
18
18
|
|
|
19
|
-
* Python 3.7~3.
|
|
19
|
+
* Python 3.7~3.15
|
|
20
20
|
* Windows
|
|
21
21
|
* Many linuxs, include embedded systems
|
|
22
22
|
* Apple Intel and Apple Silicon
|
|
@@ -791,11 +791,19 @@ def main_entry(argv):
|
|
|
791
791
|
parser.print_help()
|
|
792
792
|
|
|
793
793
|
|
|
794
|
+
def map_error(e):
|
|
795
|
+
if str(e) == 'invalid license token':
|
|
796
|
+
return ('invalid license token or failed to update license token. '
|
|
797
|
+
'please make sure this device is online '
|
|
798
|
+
'and can connect to Pyarmor License Server')
|
|
799
|
+
return e
|
|
800
|
+
|
|
801
|
+
|
|
794
802
|
def main():
|
|
795
803
|
try:
|
|
796
804
|
main_entry(sys.argv[1:])
|
|
797
805
|
except Exception as e:
|
|
798
|
-
logger.error(e)
|
|
806
|
+
logger.error(map_error(e))
|
|
799
807
|
log_bug(e)
|
|
800
808
|
sys.exit(1 if isinstance(e, CliError) else 2)
|
|
801
809
|
|
|
@@ -442,7 +442,7 @@ class Commander:
|
|
|
442
442
|
logger.info('build target %s end', args.target)
|
|
443
443
|
|
|
444
444
|
def _build(self, project, target, output, value=None):
|
|
445
|
-
from .core import Pytransform3
|
|
445
|
+
from pyarmor.cli.core import Pytransform3
|
|
446
446
|
args = [self.ctx, target, project, output, value]
|
|
447
447
|
m = Pytransform3.init(self.ctx)
|
|
448
448
|
m.pre_build(args)
|
|
Binary file
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
;; Pyarmor version
|
|
4
4
|
major = 9
|
|
5
5
|
minor = 2
|
|
6
|
-
patch =
|
|
6
|
+
patch = 4
|
|
7
7
|
|
|
8
8
|
;; Compatible core version for package: pyarmor.cli.core
|
|
9
9
|
cli.core = 8.1.0
|
|
@@ -235,6 +235,13 @@ rft_mix_import_name = 0
|
|
|
235
235
|
;; Strip leading name package
|
|
236
236
|
strip_package_name = 1
|
|
237
237
|
|
|
238
|
+
;; Enable ProcessPoolExecuter to generate the obfuscated scripts
|
|
239
|
+
;;
|
|
240
|
+
;; 0: normal build
|
|
241
|
+
;; 1: use ProcessPoolExecutor with max_workers=None
|
|
242
|
+
;; N > 1: use ProcessPoolExecutor with max_workers=N
|
|
243
|
+
max_workers = 0
|
|
244
|
+
|
|
238
245
|
;;
|
|
239
246
|
;; Compatiable options
|
|
240
247
|
;;
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
import os
|
|
23
23
|
import shutil
|
|
24
24
|
|
|
25
|
+
from pyarmor.cli.core import Pytransform3
|
|
26
|
+
|
|
25
27
|
from . import logger, CliError
|
|
26
|
-
from .core import Pytransform3
|
|
27
28
|
from .resource import FileResource, PathResource
|
|
28
29
|
|
|
29
30
|
|
|
@@ -185,7 +186,71 @@ class Builder(object):
|
|
|
185
186
|
logger.info('generate runtime files OK')
|
|
186
187
|
|
|
187
188
|
logger.info('start to obfuscate scripts')
|
|
188
|
-
self.
|
|
189
|
+
n = self.ctx.cfg.getint('builder', 'max_workers')
|
|
190
|
+
async_obfuscate_scripts(self, n) if n else self._obfuscate_scripts()
|
|
189
191
|
logger.info('obfuscate scripts OK')
|
|
190
192
|
|
|
191
193
|
Pytransform3.post_build(self.ctx)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def async_obfuscate_scripts(builder, max_workers):
|
|
197
|
+
from concurrent.futures import ProcessPoolExecutor, wait
|
|
198
|
+
|
|
199
|
+
ctx = builder.ctx
|
|
200
|
+
rev = ctx.version_info()
|
|
201
|
+
template = ctx.bootstrap_template
|
|
202
|
+
relative = ctx.import_prefix
|
|
203
|
+
pkgname = ctx.runtime_package_name
|
|
204
|
+
bootpath = ctx.cfg.get('builder', 'bootstrap_file')
|
|
205
|
+
encoding = ctx.cfg.get('builder', 'encoding')
|
|
206
|
+
max_workers = None if max_workers < 2 else max_workers
|
|
207
|
+
|
|
208
|
+
plugins = [x for x in ctx.plugins if hasattr(x, 'post_script')]
|
|
209
|
+
|
|
210
|
+
namelist = []
|
|
211
|
+
futures = []
|
|
212
|
+
|
|
213
|
+
with ProcessPoolExecutor(max_workers=max_workers) as executor:
|
|
214
|
+
for res in ctx.resources + ctx.extra_resources:
|
|
215
|
+
logger.info('process resource "%s"', res.fullname)
|
|
216
|
+
name = res.name
|
|
217
|
+
path = builder.format_output(ctx.outputs, namelist.count(name))
|
|
218
|
+
namelist.append(name)
|
|
219
|
+
os.makedirs(path, exist_ok=True)
|
|
220
|
+
|
|
221
|
+
for r in res:
|
|
222
|
+
if not r.is_script():
|
|
223
|
+
logger.info('copy data file %s', r.fullpath)
|
|
224
|
+
data_path = os.path.join(path, r.output_path)
|
|
225
|
+
os.makedirs(data_path, exist_ok=True)
|
|
226
|
+
shutil.copy2(r.fullpath, data_path)
|
|
227
|
+
continue
|
|
228
|
+
|
|
229
|
+
logger.info('obfuscating %s', r)
|
|
230
|
+
futures.append(executor.submit(aysnc_generate_script, *(
|
|
231
|
+
r, path, ctx, template, relative, pkgname, bootpath,
|
|
232
|
+
rev, plugins, encoding)))
|
|
233
|
+
|
|
234
|
+
wait(futures)
|
|
235
|
+
for x in futures:
|
|
236
|
+
x.result()
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def aysnc_generate_script(r, path, ctx, template, relative,
|
|
240
|
+
pkgname, bootpath, rev, plugins, encoding):
|
|
241
|
+
code = Pytransform3.generate_obfuscated_script(ctx, r)
|
|
242
|
+
source = r.generate_output(
|
|
243
|
+
template, code, relative=relative, pkgname=pkgname,
|
|
244
|
+
bootpath=bootpath, rev=rev
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
fullpath = os.path.join(path, r.output_filename)
|
|
248
|
+
os.makedirs(os.path.dirname(fullpath), exist_ok=True)
|
|
249
|
+
|
|
250
|
+
for plugin in plugins:
|
|
251
|
+
patched_source = plugin.post_script(ctx, r, source)
|
|
252
|
+
if patched_source:
|
|
253
|
+
source = patched_source
|
|
254
|
+
|
|
255
|
+
with open(fullpath, 'w', encoding=encoding) as f:
|
|
256
|
+
f.write(source)
|
|
@@ -171,7 +171,7 @@ class Register(object):
|
|
|
171
171
|
return url
|
|
172
172
|
|
|
173
173
|
def update_token(self):
|
|
174
|
-
from .core import Pytransform3
|
|
174
|
+
from pyarmor.cli.core import Pytransform3
|
|
175
175
|
assert Pytransform3._pytransform3 is None
|
|
176
176
|
with open(self.ctx.license_token, 'wb') as f:
|
|
177
177
|
f.close()
|
|
@@ -208,6 +208,10 @@ class Register(object):
|
|
|
208
208
|
if len(line) == 192 and line.find(' ') == -1:
|
|
209
209
|
return regname, line
|
|
210
210
|
|
|
211
|
+
logger.error('please make sure the activation file is '
|
|
212
|
+
'pure text file, the content starts with `Dear `, '
|
|
213
|
+
'and includes the activation code'
|
|
214
|
+
'(its length is 192 and no line break)')
|
|
211
215
|
raise CliError('invalid activation file "%s"' % filename)
|
|
212
216
|
|
|
213
217
|
def _register_offline_license(self, fzip, namelist):
|
|
@@ -359,7 +363,7 @@ class Register(object):
|
|
|
359
363
|
logger.debug('%s:%d:%s', host, port, str(e))
|
|
360
364
|
|
|
361
365
|
def _get_machine_id(self, devflag=11):
|
|
362
|
-
from .core import Pytransform3
|
|
366
|
+
from pyarmor.cli.core import Pytransform3
|
|
363
367
|
try:
|
|
364
368
|
return Pytransform3.get_hd_info(devflag)
|
|
365
369
|
except SystemError:
|
|
@@ -817,7 +821,7 @@ class WebRegister(Register):
|
|
|
817
821
|
ucode = reginfo['ucode']
|
|
818
822
|
rcode = reginfo['rcode']
|
|
819
823
|
if len(ucode) != 192:
|
|
820
|
-
raise CliError('invalid registration file "%s"', regfile)
|
|
824
|
+
raise CliError('invalid ci registration file "%s"', regfile)
|
|
821
825
|
|
|
822
826
|
url = self.regurl('ci/%s' % ucode)
|
|
823
827
|
paras = ('rev', str(rev)), ('cirev', str(cirev))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyarmor.cli
|
|
3
|
-
Version: 9.2.
|
|
3
|
+
Version: 9.2.4
|
|
4
4
|
Summary: A comand line tool to obfuscate python scripts
|
|
5
5
|
Home-page: https://github.com/dashingsoft/pyarmor
|
|
6
6
|
Author: Jondy Zhao
|
|
@@ -27,7 +27,7 @@ Pyarmor is a command line tool used to obfuscate python scripts, bind obfuscated
|
|
|
27
27
|
Key Features
|
|
28
28
|
------------
|
|
29
29
|
|
|
30
|
-
* The obfuscated
|
|
30
|
+
* The obfuscated script is still a normal `.py` script, in most of cases the original python scripts can be replaced with obfuscated scripts seamlessly.
|
|
31
31
|
* Provide many ways to obfuscate the scripts to balance security and performance
|
|
32
32
|
* Rename functions/methods/classes/variables/arguments, irreversible obfuscation
|
|
33
33
|
* Convert part of Python functions to C function, compile to binary by high optimize option, irreversible obfuscation
|
|
@@ -37,7 +37,7 @@ Key Features
|
|
|
37
37
|
Support Platforms
|
|
38
38
|
-----------------
|
|
39
39
|
|
|
40
|
-
* Python 3.7~3.
|
|
40
|
+
* Python 3.7~3.15
|
|
41
41
|
* Windows
|
|
42
42
|
* Many linuxs, include embedded systems
|
|
43
43
|
* Apple Intel and Apple Silicon
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|