pyarmor 2.5.2__tar.gz → 9.0.7__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.
Files changed (187) hide show
  1. pyarmor-9.0.7/MANIFEST.in +4 -0
  2. pyarmor-9.0.7/PKG-INFO +76 -0
  3. pyarmor-9.0.7/README.md +115 -0
  4. pyarmor-9.0.7/pyarmor/README.rst +53 -0
  5. pyarmor-9.0.7/pyarmor/__init__.py +4 -0
  6. pyarmor-9.0.7/pyarmor/benchmark.py +382 -0
  7. pyarmor-9.0.7/pyarmor/build_meta.py +126 -0
  8. pyarmor-9.0.7/pyarmor/cli/__init__.py +46 -0
  9. pyarmor-9.0.7/pyarmor/cli/__main__.py +792 -0
  10. pyarmor-9.0.7/pyarmor/cli/bootstrap.py +207 -0
  11. pyarmor-9.0.7/pyarmor/cli/bug.py +137 -0
  12. pyarmor-9.0.7/pyarmor/cli/config.py +306 -0
  13. pyarmor-9.0.7/pyarmor/cli/context.py +784 -0
  14. pyarmor-9.0.7/pyarmor/cli/core.data.1 +0 -0
  15. pyarmor-9.0.7/pyarmor/cli/core.data.2 +0 -0
  16. pyarmor-9.0.7/pyarmor/cli/core.data.3 +0 -0
  17. pyarmor-9.0.7/pyarmor/cli/default.cfg +527 -0
  18. pyarmor-9.0.7/pyarmor/cli/docker.py +192 -0
  19. pyarmor-9.0.7/pyarmor/cli/generate.py +191 -0
  20. pyarmor-9.0.7/pyarmor/cli/hdinfo.py +81 -0
  21. pyarmor-9.0.7/pyarmor/cli/merge.py +232 -0
  22. pyarmor-9.0.7/pyarmor/cli/mixer.py +109 -0
  23. pyarmor-9.0.7/pyarmor/cli/plugin.py +292 -0
  24. pyarmor-9.0.7/pyarmor/cli/public_capsule.zip +0 -0
  25. pyarmor-9.0.7/pyarmor/cli/register.py +852 -0
  26. pyarmor-9.0.7/pyarmor/cli/repack.py +793 -0
  27. pyarmor-9.0.7/pyarmor/cli/resource.py +253 -0
  28. pyarmor-9.0.7/pyarmor/cli/shell.py +80 -0
  29. pyarmor-9.0.7/pyarmor/cobuilder.py +154 -0
  30. pyarmor-9.0.7/pyarmor/config.py +58 -0
  31. pyarmor-9.0.7/pyarmor/examples/README-ZH.md +188 -0
  32. pyarmor-9.0.7/pyarmor/examples/README.md +201 -0
  33. pyarmor-9.0.7/pyarmor/examples/build-for-exe.bat +166 -0
  34. pyarmor-9.0.7/pyarmor/examples/build-for-freeze.bat +166 -0
  35. pyarmor-9.0.7/pyarmor/examples/build-with-project.bat +152 -0
  36. pyarmor-9.0.7/pyarmor/examples/build-with-project.sh +110 -0
  37. pyarmor-9.0.7/pyarmor/examples/cx_Freeze/hello.py +5 -0
  38. pyarmor-9.0.7/pyarmor/examples/cx_Freeze/queens.py +87 -0
  39. pyarmor-9.0.7/pyarmor/examples/cx_Freeze/setup.py +23 -0
  40. pyarmor-9.0.7/pyarmor/examples/helloworld/foo.py +68 -0
  41. pyarmor-9.0.7/pyarmor/examples/obfuscate-app.bat +65 -0
  42. pyarmor-9.0.7/pyarmor/examples/obfuscate-app.sh +45 -0
  43. pyarmor-9.0.7/pyarmor/examples/obfuscate-pkg.bat +82 -0
  44. pyarmor-9.0.7/pyarmor/examples/obfuscate-pkg.sh +60 -0
  45. pyarmor-9.0.7/pyarmor/examples/pack-obfuscated-scripts.bat +38 -0
  46. pyarmor-9.0.7/pyarmor/examples/pack-obfuscated-scripts.sh +31 -0
  47. pyarmor-9.0.7/pyarmor/examples/py2exe/hello.py +5 -0
  48. pyarmor-9.0.7/pyarmor/examples/py2exe/queens.py +87 -0
  49. pyarmor-9.0.7/pyarmor/examples/py2exe/setup.py +36 -0
  50. pyarmor-9.0.7/pyarmor/examples/pybench/Arithmetic.py +777 -0
  51. pyarmor-9.0.7/pyarmor/examples/pybench/Calls.py +560 -0
  52. pyarmor-9.0.7/pyarmor/examples/pybench/CommandLine.py +642 -0
  53. pyarmor-9.0.7/pyarmor/examples/pybench/Constructs.py +564 -0
  54. pyarmor-9.0.7/pyarmor/examples/pybench/Dict.py +504 -0
  55. pyarmor-9.0.7/pyarmor/examples/pybench/Exceptions.py +699 -0
  56. pyarmor-9.0.7/pyarmor/examples/pybench/Imports.py +138 -0
  57. pyarmor-9.0.7/pyarmor/examples/pybench/Instances.py +66 -0
  58. pyarmor-9.0.7/pyarmor/examples/pybench/Lists.py +350 -0
  59. pyarmor-9.0.7/pyarmor/examples/pybench/Lookups.py +945 -0
  60. pyarmor-9.0.7/pyarmor/examples/pybench/NewInstances.py +75 -0
  61. pyarmor-9.0.7/pyarmor/examples/pybench/Numbers.py +784 -0
  62. pyarmor-9.0.7/pyarmor/examples/pybench/Setup.py +43 -0
  63. pyarmor-9.0.7/pyarmor/examples/pybench/Strings.py +568 -0
  64. pyarmor-9.0.7/pyarmor/examples/pybench/Tuples.py +360 -0
  65. pyarmor-9.0.7/pyarmor/examples/pybench/With.py +190 -0
  66. pyarmor-9.0.7/pyarmor/examples/pybench/clockres.py +42 -0
  67. pyarmor-9.0.7/pyarmor/examples/pybench/package/__init__.py +0 -0
  68. pyarmor-9.0.7/pyarmor/examples/pybench/package/submodule.py +0 -0
  69. pyarmor-9.0.7/pyarmor/examples/pybench/pybench.py +954 -0
  70. pyarmor-9.0.7/pyarmor/examples/pybench/systimes.py +214 -0
  71. pyarmor-9.0.7/pyarmor/examples/simple/queens.py +87 -0
  72. pyarmor-9.0.7/pyarmor/examples/testmod/hello.py +66 -0
  73. pyarmor-9.0.7/pyarmor/examples/testmod/queens.py +159 -0
  74. pyarmor-9.0.7/pyarmor/examples/testpkg/main.py +4 -0
  75. pyarmor-9.0.7/pyarmor/examples/testpkg/mypkg/__init__.py +13 -0
  76. pyarmor-9.0.7/pyarmor/examples/testpkg/mypkg/foo.py +2 -0
  77. pyarmor-9.0.7/pyarmor/helper/__init__.py +1 -0
  78. pyarmor-9.0.7/pyarmor/helper/build_data_module.py +130 -0
  79. pyarmor-9.0.7/pyarmor/helper/buildext.py +446 -0
  80. pyarmor-9.0.7/pyarmor/helper/get_bind_key.py +29 -0
  81. pyarmor-9.0.7/pyarmor/helper/get_license_info.py +25 -0
  82. pyarmor-9.0.7/pyarmor/helper/get_platform_name.py +82 -0
  83. pyarmor-9.0.7/pyarmor/helper/merge.py +298 -0
  84. pyarmor-9.0.7/pyarmor/helper/repack.py +395 -0
  85. pyarmor-9.0.7/pyarmor/helper/superuntime.py +58 -0
  86. pyarmor-2.5.2/license.lic → pyarmor-9.0.7/pyarmor/license.tri +0 -0
  87. pyarmor-9.0.7/pyarmor/packer.py +720 -0
  88. pyarmor-9.0.7/pyarmor/platforms/darwin/x86_64/_pytransform.dylib +0 -0
  89. pyarmor-9.0.7/pyarmor/platforms/linux/x86/_pytransform.so +0 -0
  90. pyarmor-9.0.7/pyarmor/platforms/linux/x86_64/_pytransform.so +0 -0
  91. pyarmor-9.0.7/pyarmor/platforms/windows/x86/_pytransform.dll +0 -0
  92. pyarmor-9.0.7/pyarmor/platforms/windows/x86_64/_pytransform.dll +0 -0
  93. pyarmor-9.0.7/pyarmor/plugins/README.md +176 -0
  94. pyarmor-9.0.7/pyarmor/plugins/check_ntp_time.py +482 -0
  95. pyarmor-9.0.7/pyarmor/polyfills/__init__.py +62 -0
  96. pyarmor-9.0.7/pyarmor/polyfills/argparse.py +2360 -0
  97. {pyarmor-2.5.2 → pyarmor-9.0.7/pyarmor}/product.key +0 -0
  98. pyarmor-9.0.7/pyarmor/project.py +249 -0
  99. pyarmor-9.0.7/pyarmor/protect_code.pt +68 -0
  100. pyarmor-9.0.7/pyarmor/protect_code2.pt +47 -0
  101. {pyarmor-2.5.2 → pyarmor-9.0.7/pyarmor}/public.key +0 -0
  102. pyarmor-9.0.7/pyarmor/public_capsule.zip +0 -0
  103. pyarmor-9.0.7/pyarmor/pyarmor-deprecated.py +843 -0
  104. pyarmor-9.0.7/pyarmor/pyarmor-webui.py +2 -0
  105. pyarmor-9.0.7/pyarmor/pyarmor.py +1647 -0
  106. pyarmor-9.0.7/pyarmor/pyimcore.py +65 -0
  107. {pyarmor-2.5.2 → pyarmor-9.0.7/pyarmor}/pyshield.key +0 -0
  108. {pyarmor-2.5.2 → pyarmor-9.0.7/pyarmor}/pyshield.lic +0 -0
  109. pyarmor-9.0.7/pyarmor/pytransform.py +483 -0
  110. pyarmor-9.0.7/pyarmor/reform.py +81 -0
  111. pyarmor-9.0.7/pyarmor/register.py +220 -0
  112. pyarmor-9.0.7/pyarmor/sppmode.py +105 -0
  113. pyarmor-9.0.7/pyarmor/utils.py +1871 -0
  114. pyarmor-9.0.7/pyarmor.egg-info/PKG-INFO +76 -0
  115. pyarmor-9.0.7/pyarmor.egg-info/SOURCES.txt +119 -0
  116. pyarmor-9.0.7/pyarmor.egg-info/dependency_links.txt +1 -0
  117. pyarmor-9.0.7/pyarmor.egg-info/entry_points.txt +6 -0
  118. pyarmor-9.0.7/pyarmor.egg-info/requires.txt +1 -0
  119. pyarmor-9.0.7/pyarmor.egg-info/top_level.txt +1 -0
  120. pyarmor-9.0.7/setup.cfg +4 -0
  121. pyarmor-9.0.7/setup.py +127 -0
  122. pyarmor-2.5.2/PKG-INFO +0 -69
  123. pyarmor-2.5.2/README +0 -57
  124. pyarmor-2.5.2/examples/beer.py +0 -20
  125. pyarmor-2.5.2/examples/cgi/README +0 -11
  126. pyarmor-2.5.2/examples/cgi/cgi0.sh +0 -8
  127. pyarmor-2.5.2/examples/cgi/cgi1.py +0 -14
  128. pyarmor-2.5.2/examples/cgi/cgi2.py +0 -22
  129. pyarmor-2.5.2/examples/cgi/cgi3.py +0 -10
  130. pyarmor-2.5.2/examples/cgi/wiki.py +0 -123
  131. pyarmor-2.5.2/examples/example1.json +0 -26
  132. pyarmor-2.5.2/examples/example2.json +0 -26
  133. pyarmor-2.5.2/examples/example3.json +0 -26
  134. pyarmor-2.5.2/examples/example4.json +0 -26
  135. pyarmor-2.5.2/examples/example5.json +0 -26
  136. pyarmor-2.5.2/examples/example6.json +0 -26
  137. pyarmor-2.5.2/examples/sample.key +0 -4
  138. pyarmor-2.5.2/extensions/cygtfm-0.dll +0 -0
  139. pyarmor-2.5.2/extensions/cygtomcrypt-0.dll +0 -0
  140. pyarmor-2.5.2/extensions/libgcc_s_seh-1.dll +0 -0
  141. pyarmor-2.5.2/extensions/libtfm-0.dll +0 -0
  142. pyarmor-2.5.2/extensions/libtomcrypt-0.dll +0 -0
  143. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-arm-py2.7.so +0 -0
  144. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-arm-py3.2.so +0 -0
  145. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-armv6-py2.7.so +0 -0
  146. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py2.4.so +0 -0
  147. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py2.5.so +0 -0
  148. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py2.6.so +0 -0
  149. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py2.7.so +0 -0
  150. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py3.0.so +0 -0
  151. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py3.1.so +0 -0
  152. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py3.2.so +0 -0
  153. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py3.3.so +0 -0
  154. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86-py3.4.so +0 -0
  155. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py2.3.so +0 -0
  156. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py2.4.so +0 -0
  157. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py2.5.so +0 -0
  158. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py2.6.so +0 -0
  159. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py2.7.so +0 -0
  160. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py3.0.so +0 -0
  161. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py3.1.so +0 -0
  162. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py3.2.so +0 -0
  163. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py3.3.so +0 -0
  164. pyarmor-2.5.2/extensions/pytransform-2.3.2.linux-x86_64-py3.4.so +0 -0
  165. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py2.3.pyd +0 -0
  166. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py2.4.pyd +0 -0
  167. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py2.5.pyd +0 -0
  168. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py2.6.pyd +0 -0
  169. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py2.7.pyd +0 -0
  170. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py3.0.pyd +0 -0
  171. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py3.1.pyd +0 -0
  172. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py3.2.pyd +0 -0
  173. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py3.3.pyd +0 -0
  174. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86-py3.4.pyd +0 -0
  175. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py2.5.pyd +0 -0
  176. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py2.6.pyd +0 -0
  177. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py2.7.pyd +0 -0
  178. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py3.0.pyd +0 -0
  179. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py3.1.pyd +0 -0
  180. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py3.2.pyd +0 -0
  181. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py3.3.pyd +0 -0
  182. pyarmor-2.5.2/extensions/pytransform-2.3.2.win32-x86_64-py3.4.pyd +0 -0
  183. pyarmor-2.5.2/pyarmor.py +0 -791
  184. pyarmor-2.5.2/pyarmor.rst +0 -428
  185. pyarmor-2.5.2/pyimcore.py +0 -79
  186. pyarmor-2.5.2/setup.py +0 -37
  187. pyarmor-2.5.2/wizard.py +0 -1212
@@ -0,0 +1,4 @@
1
+ # recursive-include docs/examples *.py *.xml README* LICENSE
2
+ # include docs/user-guide.html docs/rationale.html
3
+ # include LICENSE LICENSE-ZH
4
+ exclude src/pyarmor-deprecated.py src/pyimcore.py
pyarmor-9.0.7/PKG-INFO ADDED
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 1.1
2
+ Name: pyarmor
3
+ Version: 9.0.7
4
+ Summary: A tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
5
+ Home-page: https://github.com/dashingsoft/pyarmor
6
+ Author: Jondy Zhao
7
+ Author-email: pyarmor@163.com
8
+ License: Free To Use But Restricted
9
+ Description: Protect Python Scripts By Pyarmor
10
+ =================================
11
+
12
+ Pyarmor is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
13
+
14
+ Key Features
15
+ ------------
16
+
17
+ * The obfuscated scritpt is still a normal `.py` script, in most of cases the original python scripts can be replaced with obfuscated scripts seamlessly.
18
+ * Provide many ways to obfuscate the scripts to balance security and performance
19
+ * Rename functions/methods/classes/variables/arguments, irreversible obfuscation
20
+ * Convert part of Python functions to C function, compile to binary by high optimize option, irreversible obfuscation
21
+ * Bind obfuscated scripts to fixed machine or expire obfuscted scripts
22
+ * Protect obfuscated scripts by Themida (Only for Windows)
23
+
24
+ Support Platforms
25
+ -----------------
26
+
27
+ * Python 3.7~3.13
28
+ * Windows
29
+ * Many linuxs, include embedded systems
30
+ * Apple Intel and Apple Silicon
31
+
32
+ Quick Start
33
+ -----------
34
+
35
+ Install::
36
+
37
+ pip install pyarmor
38
+
39
+ Obfuscate the script `foo.py`::
40
+
41
+ pyarmor gen foo.py
42
+
43
+ This command generates an obfuscated script `dist/foo.py` like this:
44
+
45
+ .. code:: python
46
+
47
+ from pyarmor_runtime import __pyarmor__
48
+ __pyarmor__(__name__, __file__, b'\x28\x83\x20\x58....')
49
+
50
+ Run it::
51
+
52
+ python dist/foo.py
53
+
54
+ More Resources
55
+ --------------
56
+
57
+ - `Home <https://github.com/dashingsoft/pyarmor>`_
58
+ - `Website <http://pyarmor.dashingsoft.com>`_
59
+ - `中文网站 <http://pyarmor.dashingsoft.com/index-zh.html>`_
60
+ - `Issues <https://github.com/dashingsoft/pyarmor/issues>`_
61
+ - `Documentation <https://pyarmor.readthedocs.io/>`_
62
+
63
+ Keywords: protect obfuscate encrypt obfuscation distribute
64
+ Platform: UNKNOWN
65
+ Classifier: Development Status :: 4 - Beta
66
+ Classifier: Intended Audience :: Developers
67
+ Classifier: Topic :: Software Development :: Build Tools
68
+ Classifier: Topic :: Utilities
69
+ Classifier: Topic :: Security
70
+ Classifier: Topic :: System :: Software Distribution
71
+ Classifier: License :: Free To Use But Restricted
72
+ Classifier: Operating System :: MacOS
73
+ Classifier: Operating System :: Microsoft :: Windows
74
+ Classifier: Operating System :: POSIX
75
+ Classifier: Programming Language :: Python :: 2
76
+ Classifier: Programming Language :: Python :: 3
@@ -0,0 +1,115 @@
1
+ # Pyarmor
2
+
3
+ Pyarmor is a command-line tool designed for obfuscating Python scripts, binding obfuscated scripts to specific machines, and setting expiration dates for obfuscated scripts.
4
+
5
+ ## Key Features
6
+
7
+ - **Seamless Replacement**: Obfuscated scripts remain as standard `.py` files, allowing them to seamlessly replace the original Python scripts in most cases.
8
+ - **Balanced Obfuscation**: Offers multiple ways to obfuscate scripts to balance security and performance.
9
+ - **Irreversible Obfuscation**: Renames functions, methods, classes, variables, and arguments.
10
+ - **C Function Conversion**: Converts some Python functions to C functions and compiles them into machine instructions using high optimization options for irreversible obfuscation.
11
+ - **Script Binding**: Binds obfuscated scripts to specific machines or sets expiration dates for obfuscated scripts.
12
+ - **Themida Protection**: Protects obfuscated scripts using Themida (Windows only).
13
+
14
+ ## Supported Platforms
15
+
16
+ - Python 2 and Python 3[^1]
17
+ - Windows
18
+ - Various Linux distributions, including embedded systems and Raspberry Pi
19
+ - Apple Intel and Apple Silicon
20
+ - Supported architectures: x86_64, aarch64, armv7, etc.[^2]
21
+
22
+ For more information, check out the [Pyarmor Environments][encironments].
23
+
24
+ [^1]: Some features may be exclusive to Python 3.
25
+ [^2]: Some features may be exclusive to specific architectures.
26
+
27
+ [encironments]: https://pyarmor.readthedocs.io/en/stable/reference/environments.html
28
+
29
+ ## Quick start
30
+
31
+ 1. **Install Pyarmor**:
32
+ ```shell
33
+ pip install pyarmor
34
+ ```
35
+
36
+ 2. **Obfuscate the `foo.py` script**:
37
+ ```shell
38
+ pyarmor gen foo.py
39
+ ```
40
+
41
+ This command generates an obfuscated script like this at `dist/foo.py`:
42
+
43
+ ```python
44
+ from pyarmor_runtime import __pyarmor__
45
+ __pyarmor__(__name__, __file__, b'\x28\x83\x20\x58....')
46
+ ```
47
+
48
+ 3. **Run the obfuscated script**:
49
+ ```shell
50
+ python dist/foo.py
51
+ ```
52
+
53
+ For more information, check out the [getting started tutorial][tutorial].
54
+
55
+ [tutorial]: https://pyarmor.readthedocs.io/en/stable/tutorial/getting-started.html
56
+
57
+ ## License
58
+
59
+ Pyarmor is published as shareware. The free trial version never expires, but has some limitations.
60
+
61
+ Refer to [Pyarmor licenses][licenses] for information on license types, features, limitations, and purchasing a Pyarmor license.
62
+
63
+ Please read the [Pyarmor EULA](LICENSE).
64
+
65
+ [licenses]: https://pyarmor.readthedocs.io/en/latest/licenses.html
66
+
67
+ ## Getting Help
68
+
69
+ 1. **Consult the [Pyarmor Documentation][doc].**
70
+ 2. **Check the [FAQ][faq] for answers to common questions.**
71
+ 3. **Try the documentation [index][genindex] or the [detailed table of contents][mastertoc].**
72
+ 4. **If you still can't find the information you need, see [asking questions on GitHub][asking].**
73
+ 5. **[Report bugs][issues] following the issue template.**
74
+ 6. **For business and security inquiries, send an email to <pyarmor@163.com>.**
75
+
76
+ There are also some third-party learn platforms (not Pyarmor offical)
77
+
78
+ - **[Ask Pyarmor Guru][gurubase], it is a Pyarmor-focused AI to answer your questions**
79
+
80
+ [faq]: https://pyarmor.readthedocs.io/en/latest/questions.html
81
+ [issues]: https://github.com/dashingsoft/pyarmor/issues
82
+ [genindex]: https://pyarmor.readthedocs.io/en/stable/genindex.html
83
+ [mastertoc]: https://pyarmor.readthedocs.io/en/stable/index.html#table-of-contents
84
+ [asking]: https://pyarmor.readthedocs.io/en/latest/questions.html#asking-questions-in-github
85
+ [doc]: https://pyarmor.readthedocs.io/
86
+ [gurubase]: https://gurubase.io/g/pyarmor
87
+
88
+ ## Resources
89
+
90
+ * [Website](https://pyarmor.dashingsoft.com)
91
+ * [Documentation][doc]
92
+ * [Documentation 8.x](https://pyarmor.readthedocs.io/en/v8.5.12/)
93
+ * [Documentation 7.x](https://pyarmor.readthedocs.io/en/v7.7/)
94
+
95
+ 中文资源
96
+
97
+ * [Pyarmor 网站](https://pyarmor.dashingsoft.com/index-zh.html)
98
+ * [Pyarmor 在线文档](https://pyarmor.readthedocs.io/zh/latest/)
99
+ * [Pyarmor 8.x 在线文档](https://pyarmor.readthedocs.io/zh/v8.5.12/)
100
+ * [Pyarmor 7.x 在线文档](https://pyarmor.readthedocs.io/zh/v7.x/)
101
+
102
+ ## Changelog
103
+
104
+ Each major version comes with a separate changelog file, detailing fixed issues, new features, and compatibility issues between different versions.
105
+
106
+ Make sure to read the changelog carefully before upgrading Pyarmor:
107
+
108
+ - [Pyarmor 8.x Changelog](docs/ChangeLogs.8)
109
+ - [Pyarmor 9.x Changelog](docs/ChangeLogs.9)
110
+
111
+ **Full changelogs** at [releases][releases]
112
+
113
+ **Upcoming features** at [Pyarmor Release Plan](docs/ReleasePlan.md)
114
+
115
+ [releases]: https://github.com/dashingsoft/pyarmor/releases
@@ -0,0 +1,53 @@
1
+ Protect Python Scripts By Pyarmor
2
+ =================================
3
+
4
+ Pyarmor is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
5
+
6
+ Key Features
7
+ ------------
8
+
9
+ * The obfuscated scritpt is still a normal `.py` script, in most of cases the original python scripts can be replaced with obfuscated scripts seamlessly.
10
+ * Provide many ways to obfuscate the scripts to balance security and performance
11
+ * Rename functions/methods/classes/variables/arguments, irreversible obfuscation
12
+ * Convert part of Python functions to C function, compile to binary by high optimize option, irreversible obfuscation
13
+ * Bind obfuscated scripts to fixed machine or expire obfuscted scripts
14
+ * Protect obfuscated scripts by Themida (Only for Windows)
15
+
16
+ Support Platforms
17
+ -----------------
18
+
19
+ * Python 3.7~3.13
20
+ * Windows
21
+ * Many linuxs, include embedded systems
22
+ * Apple Intel and Apple Silicon
23
+
24
+ Quick Start
25
+ -----------
26
+
27
+ Install::
28
+
29
+ pip install pyarmor
30
+
31
+ Obfuscate the script `foo.py`::
32
+
33
+ pyarmor gen foo.py
34
+
35
+ This command generates an obfuscated script `dist/foo.py` like this:
36
+
37
+ .. code:: python
38
+
39
+ from pyarmor_runtime import __pyarmor__
40
+ __pyarmor__(__name__, __file__, b'\x28\x83\x20\x58....')
41
+
42
+ Run it::
43
+
44
+ python dist/foo.py
45
+
46
+ More Resources
47
+ --------------
48
+
49
+ - `Home <https://github.com/dashingsoft/pyarmor>`_
50
+ - `Website <http://pyarmor.dashingsoft.com>`_
51
+ - `中文网站 <http://pyarmor.dashingsoft.com/index-zh.html>`_
52
+ - `Issues <https://github.com/dashingsoft/pyarmor/issues>`_
53
+ - `Documentation <https://pyarmor.readthedocs.io/>`_
@@ -0,0 +1,4 @@
1
+ # Package pyarmor
2
+ import sys
3
+ from os.path import abspath, dirname
4
+ sys.path.insert(0, abspath(dirname(__file__)))
@@ -0,0 +1,382 @@
1
+ #! /usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ #############################################################
5
+ # #
6
+ # Copyright @ 2013 - 2017 Dashingsoft corp. #
7
+ # All rights reserved. #
8
+ # #
9
+ # pyarmor #
10
+ # #
11
+ # Version: 1.7.0 - #
12
+ # #
13
+ #############################################################
14
+ #
15
+ #
16
+ # @File: benchmark.py
17
+ #
18
+ # @Author: Jondy Zhao(jondy.zhao@gmail.com)
19
+ #
20
+ # @Create Date: 2017/11/21
21
+ #
22
+ # @Description:
23
+ #
24
+ # Check performance of pyarmor.
25
+ #
26
+ import logging
27
+ import os
28
+ import shutil
29
+ import sys
30
+ import subprocess
31
+ import time
32
+
33
+ from ctypes import c_int, c_void_p, py_object, pythonapi, PYFUNCTYPE
34
+
35
+ import pytransform
36
+
37
+ OBF_MODULE_MODE = 'none', 'des', 'aes'
38
+ OBF_CODE_MODE = 'none', 'fast', 'aes', 'wrap'
39
+
40
+ PYARMOR_PATH = os.path.dirname(__file__)
41
+ PYARMOR = 'pyarmor.py'
42
+
43
+
44
+ def make_test_script(filename):
45
+ lines = [
46
+ 'def empty():',
47
+ ' return 0',
48
+ '',
49
+ 'def call_1k_function(n):',
50
+ ' for i in range(n):',
51
+ ' one_thousand()',
52
+ '',
53
+ 'def call_10k_function(n):',
54
+ ' for i in range(n):',
55
+ ' ten_thousand()',
56
+ '',
57
+ 'def one_thousand():',
58
+ ' if True:',
59
+ ' i = 0',
60
+ ]
61
+ lines.extend([' i += 1'] * 100)
62
+ lines.append('\n return 1000\n')
63
+ lines.extend(['def ten_thousand():',
64
+ ' if True:',
65
+ ' i = 0'])
66
+ lines.extend([' i += 1'] * 1000)
67
+ lines.append('\n return 10000\n')
68
+
69
+ with open(filename, 'wb') as f:
70
+ f.write('\n'.join(lines).encode())
71
+
72
+
73
+ def call_pyarmor(args):
74
+ p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
75
+ p.wait()
76
+
77
+
78
+ def obffuscate_scripts(output, filename,
79
+ mod_mode, code_mode, wrap_mode, adv_mode):
80
+ project = os.path.join(output, 'project')
81
+ if os.path.exists(project):
82
+ shutil.rmtree(project)
83
+
84
+ args = [sys.executable, PYARMOR, 'init', '--src', output,
85
+ '--entry', filename, project]
86
+ call_pyarmor(args)
87
+
88
+ args = [sys.executable, PYARMOR, 'config',
89
+ '--manifest', 'include %s' % filename,
90
+ '--obf-mod', mod_mode,
91
+ '--obf-code', code_mode,
92
+ '--wrap-mode', wrap_mode,
93
+ '--advanced', adv_mode,
94
+ '--restrict-mode', '0',
95
+ '--package-runtime', '0',
96
+ project]
97
+ call_pyarmor(args)
98
+
99
+ args = [sys.executable, PYARMOR, 'build', '-B', project]
100
+ call_pyarmor(args)
101
+
102
+ for s in os.listdir(os.path.join(project, 'dist')):
103
+ shutil.copy(os.path.join(project, 'dist', s), output)
104
+
105
+
106
+ def metricmethod(func):
107
+ if not hasattr(time, 'process_time'):
108
+ time.process_time = time.clock
109
+
110
+ def wrap(*args, **kwargs):
111
+ t1 = time.process_time()
112
+ result = func(*args, **kwargs)
113
+ t2 = time.process_time()
114
+ logging.info('%-50s: %10.6f ms', func.__name__, (t2 - t1) * 1000)
115
+ return result
116
+ return wrap
117
+
118
+
119
+ @metricmethod
120
+ def verify_license(m):
121
+ try:
122
+ prototype = PYFUNCTYPE(py_object)
123
+ dlfunc = prototype(('get_registration_code', m))
124
+ code = dlfunc()
125
+ except Exception:
126
+ logging.warning('Verify license failed')
127
+ code = ''
128
+ return code
129
+
130
+
131
+ @metricmethod
132
+ def init_pytransform(m):
133
+ major, minor = sys.version_info[0:2]
134
+ # Python2.5 no sys.maxsize but sys.maxint
135
+ # bitness = 64 if sys.maxsize > 2**32 else 32
136
+ prototype = PYFUNCTYPE(c_int, c_int, c_int, c_void_p)
137
+ init_module = prototype(('init_module', m))
138
+ init_module(major, minor, pythonapi._handle)
139
+
140
+ prototype = PYFUNCTYPE(c_int, c_int, c_int, c_int)
141
+ init_runtime = prototype(('init_runtime', m))
142
+ init_runtime(0, 0, 0, 0)
143
+
144
+
145
+ @metricmethod
146
+ def load_pytransform():
147
+ return pytransform._load_library(PYARMOR_PATH, is_runtime=1)
148
+
149
+
150
+ @metricmethod
151
+ def total_extra_init_time():
152
+ m = load_pytransform()
153
+ init_pytransform(m)
154
+ verify_license(m)
155
+
156
+
157
+ @metricmethod
158
+ def import_first_no_obfuscated_module(name):
159
+ return __import__(name)
160
+
161
+
162
+ @metricmethod
163
+ def import_first_obfuscated_module(name):
164
+ return __import__(name)
165
+
166
+
167
+ @metricmethod
168
+ def re_import_no_obfuscated_module(name):
169
+ return __import__(name)
170
+
171
+
172
+ @metricmethod
173
+ def re_import_obfuscated_module(name):
174
+ return __import__(name)
175
+
176
+
177
+ @metricmethod
178
+ def run_empty_obfuscated_code_object(foo):
179
+ return foo.empty()
180
+
181
+
182
+ @metricmethod
183
+ def run_obfuscated_1k_bytecode(foo):
184
+ return foo.one_thousand()
185
+
186
+
187
+ @metricmethod
188
+ def run_obfuscated_10k_bytecode(foo):
189
+ return foo.ten_thousand()
190
+
191
+
192
+ @metricmethod
193
+ def run_empty_no_obfuscated_code_object(foo):
194
+ return foo.empty()
195
+
196
+
197
+ @metricmethod
198
+ def run_no_obfuscated_1k_bytecode(foo):
199
+ return foo.one_thousand()
200
+
201
+
202
+ @metricmethod
203
+ def run_no_obfuscated_10k_bytecode(foo):
204
+ return foo.ten_thousand()
205
+
206
+
207
+ @metricmethod
208
+ def import_many_obfuscated_modules(name, n=100):
209
+ for i in range(n):
210
+ __import__(name % i)
211
+
212
+
213
+ @metricmethod
214
+ def import_many_no_obfuscated_modules(name, n=100):
215
+ for i in range(n):
216
+ __import__(name % i)
217
+
218
+
219
+ @metricmethod
220
+ def call_1000_no_obfuscated_1k_bytecode(foo):
221
+ return foo.call_1k_function(1000)
222
+
223
+
224
+ @metricmethod
225
+ def call_1000_obfuscated_1k_bytecode(foo):
226
+ return foo.call_1k_function(1000)
227
+
228
+
229
+ @metricmethod
230
+ def call_1000_no_obfuscated_10k_bytecode(foo):
231
+ return foo.call_10k_function(1000)
232
+
233
+
234
+ @metricmethod
235
+ def call_1000_obfuscated_10k_bytecode(foo):
236
+ return foo.call_10k_function(1000)
237
+
238
+
239
+ @metricmethod
240
+ def call_10000_no_obfuscated_1k_bytecode(foo):
241
+ return foo.call_1k_function(10000)
242
+
243
+
244
+ @metricmethod
245
+ def call_10000_obfuscated_1k_bytecode(foo):
246
+ return foo.call_1k_function(10000)
247
+
248
+
249
+ @metricmethod
250
+ def call_10000_no_obfuscated_10k_bytecode(foo):
251
+ return foo.call_10k_function(10000)
252
+
253
+
254
+ @metricmethod
255
+ def call_10000_obfuscated_10k_bytecode(foo):
256
+ return foo.call_10k_function(10000)
257
+
258
+
259
+ def main():
260
+ if not os.path.exists('benchmark.py'):
261
+ logging.warning('Please change current path to %s', PYARMOR_PATH)
262
+ return
263
+
264
+ output = '.benchtest'
265
+ name = 'bfoo'
266
+ filename = os.path.join(output, name + '.py')
267
+
268
+ obname = 'obfoo'
269
+ obfilename = os.path.join(output, obname + '.py')
270
+
271
+ if len(sys.argv) > 1 and 'bootstrap'.startswith(sys.argv[1]):
272
+ if len(sys.argv) < 6:
273
+ sys.argv.extend(['1', '1', '1', '0'])
274
+ obf_mod, obf_code, wrap_mode, adv_mode = sys.argv[2:6]
275
+
276
+ if os.path.exists(output) and output.endswith('.benchtest'):
277
+ logging.info('Clean output path: %s', output)
278
+ shutil.rmtree(output)
279
+ logging.info('Create output path: %s', output)
280
+ os.makedirs(output)
281
+
282
+ logging.info('Generate test script %s ...', filename)
283
+ make_test_script(filename)
284
+
285
+ logging.info('Obffuscate test script ...')
286
+ shutil.copy(filename, obfilename)
287
+ obffuscate_scripts(output, os.path.basename(obfilename),
288
+ obf_mod, obf_code, wrap_mode, adv_mode)
289
+ if not os.path.exists(obfilename):
290
+ logging.info('Something is wrong to obsfucate the script')
291
+ return
292
+ logging.info('Generate obffuscated script %s', obfilename)
293
+
294
+ logging.info('Copy benchmark.py to %s', output)
295
+ shutil.copy('benchmark.py', output)
296
+
297
+ logging.info('')
298
+ logging.info('Now change to "%s"', output)
299
+ logging.info('Run "%s benchmark.py".', sys.executable)
300
+ return
301
+
302
+ filename = os.path.basename(filename)
303
+ if os.path.exists(filename):
304
+ logging.info('Test script: %s', filename)
305
+ else:
306
+ logging.warning('Test script: %s not found', filename)
307
+ logging.info('Run "%s benchmark.py bootstrap" first.', sys.executable)
308
+ return
309
+
310
+ obfilename = os.path.basename(obfilename)
311
+ if os.path.exists(obfilename):
312
+ logging.info('Obfuscated script: %s', obfilename)
313
+ else:
314
+ logging.warning('Obfuscated script: %s not found', obfilename)
315
+ logging.info('Run "%s benchmark.py bootstrap" first.', sys.executable)
316
+ return
317
+
318
+ logging.info('--------------------------------------')
319
+
320
+ # It doens't work for super mode
321
+ # logging.info('')
322
+ # total_extra_init_time()
323
+
324
+ logging.info('')
325
+ foo = import_first_no_obfuscated_module(name)
326
+ obfoo = import_first_obfuscated_module(obname)
327
+
328
+ logging.info('')
329
+ foo = re_import_no_obfuscated_module(name)
330
+ obfoo = re_import_obfuscated_module(obname)
331
+
332
+ logging.info('')
333
+ n = 10
334
+ logging.info('--- Import %d modules ---', n)
335
+ for i in range(n):
336
+ shutil.copy(filename, filename.replace('.py', '_%s.py' % i))
337
+ with open(obfilename) as f:
338
+ lines = f.readlines()
339
+ with open(obfilename.replace('.py', '_%s.py' % i), 'w') as f:
340
+ f.write(lines[2] if lines[0].find('pyarmor_runtime') > 0 \
341
+ else ''.join(lines))
342
+ import_many_no_obfuscated_modules('bfoo_%s', n)
343
+ import_many_obfuscated_modules('obfoo_%s', n)
344
+
345
+ logging.info('')
346
+ run_empty_no_obfuscated_code_object(foo)
347
+ run_empty_obfuscated_code_object(obfoo)
348
+
349
+ logging.info('')
350
+ run_no_obfuscated_1k_bytecode(foo)
351
+ run_obfuscated_1k_bytecode(obfoo)
352
+
353
+ logging.info('')
354
+ run_no_obfuscated_10k_bytecode(foo)
355
+ run_obfuscated_10k_bytecode(obfoo)
356
+
357
+ logging.info('')
358
+ call_1000_no_obfuscated_1k_bytecode(foo)
359
+ call_1000_obfuscated_1k_bytecode(obfoo)
360
+
361
+ logging.info('')
362
+ call_1000_no_obfuscated_10k_bytecode(foo)
363
+ call_1000_obfuscated_10k_bytecode(obfoo)
364
+
365
+ logging.info('')
366
+ call_10000_no_obfuscated_1k_bytecode(foo)
367
+ call_10000_obfuscated_1k_bytecode(obfoo)
368
+
369
+ logging.info('')
370
+ call_10000_no_obfuscated_10k_bytecode(foo)
371
+ call_10000_obfuscated_10k_bytecode(obfoo)
372
+
373
+ logging.info('')
374
+ logging.info('--------------------------------------')
375
+
376
+
377
+ if __name__ == '__main__':
378
+ logging.basicConfig(
379
+ level=logging.INFO,
380
+ format='%(message)s',
381
+ )
382
+ main()