pyarmor.cli 8.3.5__zip → 8.3.7__zip

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.
Files changed (34) hide show
  1. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/PKG-INFO +1 -1
  2. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/__init__.py +1 -1
  3. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/__main__.py +2 -2
  4. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/context.py +25 -0
  5. pyarmor.cli-8.3.7/pyarmor/cli/core.data.1 +0 -0
  6. pyarmor.cli-8.3.7/pyarmor/cli/core.data.2 +0 -0
  7. pyarmor.cli-8.3.7/pyarmor/cli/core.data.3 +0 -0
  8. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/default.cfg +5 -4
  9. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/docker.py +2 -1
  10. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/register.py +8 -5
  11. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/resource.py +20 -1
  12. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor.cli.egg-info/PKG-INFO +1 -1
  13. pyarmor.cli-8.3.7/pyarmor.cli.egg-info/requires.txt +1 -0
  14. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/setup.py +2 -2
  15. pyarmor.cli-8.3.5/pyarmor/cli/core.data.1 +0 -0
  16. pyarmor.cli-8.3.5/pyarmor/cli/core.data.2 +0 -0
  17. pyarmor.cli-8.3.5/pyarmor/cli/core.data.3 +0 -0
  18. pyarmor.cli-8.3.5/pyarmor.cli.egg-info/requires.txt +0 -1
  19. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/README.rst +0 -0
  20. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/bootstrap.py +0 -0
  21. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/config.py +0 -0
  22. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/generate.py +0 -0
  23. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/group.py +0 -0
  24. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/merge.py +0 -0
  25. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/mixer.py +0 -0
  26. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/plugin.py +0 -0
  27. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/public_capsule.zip +0 -0
  28. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/repack.py +0 -0
  29. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor/cli/shell.py +0 -0
  30. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor.cli.egg-info/SOURCES.txt +0 -0
  31. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor.cli.egg-info/dependency_links.txt +0 -0
  32. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor.cli.egg-info/entry_points.txt +0 -0
  33. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/pyarmor.cli.egg-info/top_level.txt +0 -0
  34. {pyarmor.cli-8.3.5 → pyarmor.cli-8.3.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: pyarmor.cli
3
- Version: 8.3.5
3
+ Version: 8.3.7
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
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
 
3
- __VERSION__ = '8.3.5'
3
+ __VERSION__ = '8.3.7'
4
4
 
5
5
  logger = logging.getLogger('cli')
6
6
 
@@ -502,8 +502,8 @@ https://pyarmor.readthedocs.io/en/stable/reference/man.html#pyarmor-gen
502
502
  help='bind obfuscated scripts to device'
503
503
  )
504
504
  group.add_argument(
505
- '--bind-data', metavar='FILE',
506
- help=argparse.SUPPRESS
505
+ '--bind-data', metavar='STRING or @FILENAME',
506
+ help='store user data to runtime key'
507
507
  )
508
508
 
509
509
  cparser.add_argument(
@@ -664,3 +664,28 @@ class Context(object):
664
664
  @property
665
665
  def core_data_3(self):
666
666
  return self._core_data('core.data.3')
667
+
668
+ #
669
+ # Get http proxy of token server
670
+ #
671
+ @property
672
+ def token_http_proxy(self):
673
+ http_proxy = os.environb.get(b'http_proxy', b'')
674
+ if not http_proxy:
675
+ return b''
676
+ i = http_proxy.find(b'@')
677
+ if i > 0:
678
+ from base64 import b64encode
679
+ header = b'Authorization: Basic %s\r\n' % b64encode(http_proxy[:i])
680
+ else:
681
+ header = b''
682
+ i += 1
683
+ j = http_proxy.find(b':', i)
684
+ if j == -1:
685
+ host = http_proxy[i:]
686
+ port = b'80'
687
+ else:
688
+ host = http_proxy[i:j]
689
+ port = http_proxy[j+1:]
690
+ url = b'http://pyarmor.dashingsoft.com'
691
+ return b'\x00'.join([host, port, url, header, b'\x00'])
@@ -3,10 +3,10 @@
3
3
  ;; Pyarmor version
4
4
  major = 8
5
5
  minor = 3
6
- patch = 5
6
+ patch = 7
7
7
 
8
8
  ;; Compatible core version
9
- cli.core = 4.3.2
9
+ cli.core = 4.3.4
10
10
 
11
11
  ;; Deprecated since Pyarmor 8.2.5
12
12
  ; cli.runtime = 3.2.5
@@ -112,7 +112,7 @@ rft_dev_mode = 0
112
112
  ; support_nuitka = 0
113
113
 
114
114
  ;; Group device flag for machine id
115
- group_device_flag = 20
115
+ group_device_flag = 18
116
116
 
117
117
  ;;
118
118
  ;; Part 2: global/local/module level options
@@ -296,7 +296,8 @@ no_matched_pyc = error
296
296
  unsupported_functions = exec eval super locals __assert_armored__
297
297
  unsupported_nodes = AsyncFunctionDef AsyncFor AsyncWith Await Yield YieldFrom GeneratorExp NamedExpr MatchValue MatchSingleton MatchSequence MatchMapping MatchClass MatchStar MatchAs MatchOr
298
298
 
299
- ;; Exclude co_names
299
+ ;; Include and exclude function/method names
300
+ ; includes =
300
301
  ; excludes =
301
302
 
302
303
  ;; Use opcode CALL_FUNCTION_EX to patch call
@@ -90,7 +90,8 @@ def main_entry():
90
90
  register_pyarmor(ctx, args.regfile[0])
91
91
  CONFIG['ctx'] = ctx
92
92
 
93
- CONFIG['machid'] = [Pytransform3.get_hd_info(x) for x in (20, 16, 11, 10)]
93
+ mflags = 20, 18, 16, 11, 10
94
+ CONFIG['machid'] = [Pytransform3.get_hd_info(x) for x in mflags]
94
95
  logging.debug('machine id: %s', CONFIG['machid'])
95
96
 
96
97
  host, port = '0.0.0.0', args.port
@@ -155,7 +155,7 @@ class Register(object):
155
155
  if 'group.tokens' in namelist:
156
156
  logger.debug('group license for machines: %s',
157
157
  [x for x in namelist if x.startswith('tokens')])
158
- for idver in (20, 16, 11):
158
+ for idver in (18, 20, 16, 11):
159
159
  machid = self._get_machine_id(idver).decode('utf-8')
160
160
  logger.debug('got machine id: %s', machid)
161
161
  name = '/'.join(['tokens', machid])
@@ -195,7 +195,7 @@ class Register(object):
195
195
  s.sendall(b'PADH' + b'x' * 60)
196
196
  while True:
197
197
  flag = s.recv(1)
198
- if flag in (b'a', b'b', b'g', b'k'):
198
+ if flag in (b'a', b'b', b'i', b'g', b'k'):
199
199
  data = s.recv(32)
200
200
  machid = (flag + data).decode('utf-8')
201
201
  logger.info('got docker host machine id: %s', machid)
@@ -217,7 +217,9 @@ class Register(object):
217
217
  logger.info('generating device file "%s"', path)
218
218
  os.makedirs(os.path.dirname(path), exist_ok=True)
219
219
  uinfo = uname()
220
- devflag = self.ctx.cfg['builder'].getint('group_device_flag', 16)
220
+ devflag = self.ctx.cfg['builder'].getint('group_device_flag', 18)
221
+ machid = self._get_machine_id(devflag).decode('utf-8')
222
+ logger.debug('current machine id is "%s"', machid)
221
223
  tpl = Template('\n'.join([
222
224
  '# Generated by Pyarmor $rev, $timestamp',
223
225
  'host: $node',
@@ -229,7 +231,7 @@ class Register(object):
229
231
  host=uinfo.system,
230
232
  version=uinfo.version,
231
233
  timestamp=datetime.now().isoformat(),
232
- machine=self._get_machine_id(devflag).decode('utf-8')
234
+ machine=machid,
233
235
  )
234
236
  with open(path, "wb") as f:
235
237
  f.write(tpl.encode('utf-8'))
@@ -498,8 +500,9 @@ class WebRegister(Register):
498
500
  licdata = f.read('license.lic')
499
501
  capsule = f.read('.pyarmor_capsule.zip')
500
502
 
503
+ # Ignore token cache
501
504
  tokencache = os.path.join(os.path.dirname(devfile), 'tokens', machid)
502
- if os.path.exists(tokencache):
505
+ if False and os.path.exists(tokencache):
503
506
  logger.info('read cached "%s"', tokencache)
504
507
  with open(tokencache, 'rb') as f:
505
508
  data = f.read()
@@ -105,11 +105,30 @@ class FileResource(Resource):
105
105
  def is_pyc(self):
106
106
  return self.pyext.lower() == '.pyc'
107
107
 
108
+ def _get_encoding(self, encoding):
109
+ from codecs import BOM_UTF8
110
+ from re import search as research
111
+ with open(self.fullpath, 'rb') as f:
112
+ line = f.read(80)
113
+ if line and line[:3] == BOM_UTF8:
114
+ return 'utf-8'
115
+ if line and line[0] == 35:
116
+ n = line.find(b'\n')
117
+ m = research(r'coding[=:]\s*([-\w.]+)', line[:n].decode())
118
+ if m:
119
+ return m.group(1)
120
+ if n > -1 and len(line) > (n+1) and line[n+1] == 35:
121
+ k = n + 1
122
+ n = line.find(b'\n', k)
123
+ m = research(r'coding[=:]\s*([-\w.]+)', line[k:n].decode())
124
+ return m and m.group(1)
125
+ return encoding
126
+
108
127
  def readlines(self, encoding=None):
109
128
  if not os.path.exists(self.fullpath):
110
129
  raise RuntimeError('file "%s" doesn\'t exists' % self.fullpath)
111
130
 
112
- with open(self.fullpath, encoding=encoding) as f:
131
+ with open(self.fullpath, encoding=self._get_encoding(encoding)) as f:
113
132
  # file.read() can't read the whole data of big files
114
133
  return f.readlines()
115
134
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: pyarmor.cli
3
- Version: 8.3.5
3
+ Version: 8.3.7
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
@@ -0,0 +1 @@
1
+ pyarmor.cli.core~=4.3.4
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup
2
2
 
3
- __VERSION__ = ' 8.3.5'
3
+ __VERSION__ = ' 8.3.7'
4
4
 
5
5
  with open('README.rst') as f:
6
6
  long_description = f.read()
@@ -50,7 +50,7 @@ setup(
50
50
  package_data={"pyarmor.cli": ["default.cfg", "public_capsule.zip", "core.data.*"]},
51
51
 
52
52
  install_requires=[
53
- 'pyarmor.cli.core~=4.3.2'
53
+ 'pyarmor.cli.core~=4.3.4'
54
54
  ],
55
55
 
56
56
  entry_points={
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- pyarmor.cli.core~=4.3.2
File without changes
File without changes