Skip to content

Commit 77daaa0

Browse files
committed
Refine doc
1 parent 0a43152 commit 77daaa0

File tree

5 files changed

+77
-66
lines changed

5 files changed

+77
-66
lines changed

pyarmor/docs/user/features.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ In order to get high performance after the scripts are obfuscated, Pyarmor 9.1 i
2424

2525
For example, use it in WASM, pass it to Nuitka, CPython, even Pyarmor to continue processing
2626

27-
Pyarmor 9.1 uses :term:`Project` to manage all the scripts to handle the complex relations between modules and packages, so that the scripts could be reformed correctly. Because new scripts need refactor to prevent scripts from be restored. If no refactor, the security level is almost same as .pyc file
27+
New scripts need refactor to prevent scripts from be reversed. If no refactor, the security level is almost same as .pyc file
28+
29+
Pyarmor 9.1 uses :term:`Project` to manage all the scripts to handle the complex relations between modules and packages, so that the scripts could be reformed correctly.

pyarmor/docs/user/man.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ In current path create project, update project and show project information
2020

2121
[#]_ pyarmor init -h
2222

23-
[#]_ pyarmor init [-s PATH] [-x PATTERN]
23+
[#]_ pyarmor init [-C] [-s PATH] [-x PATTERN]
2424

25-
[#]_ pyarmor init [-s PATH] [-e FILE] [-m FILE] [-p PATH]
25+
[#]_ pyarmor init [-e FILE] [-m FILE] [-p PATH]
2626

27-
[#]_ pyarmor init [-C]
27+
[#]_ pyarmor init
2828

2929
.. rubric:: Description
3030

3131
.. [#] Show help
3232
.. [#] Create project, set project src, add contents in the src to project
33-
.. [#] Create or update project, add specified items to project
33+
.. [#] Add specified items to project
3434
.. [#] Show project information
3535
3636
.. describe:: Option
@@ -476,7 +476,7 @@ Generate obfuscated scripts for project
476476
pyarmor__1 = 1
477477
pyarmor__2 = 'a'
478478

479-
If this option is enabled, the suffix will be random name. For exampl::
479+
If this option is enabled, the suffix will be random name. For example::
480480

481481
$ pyarmor build --randname 1
482482
$ pyarmor build --rft
@@ -485,7 +485,10 @@ Generate obfuscated scripts for project
485485
pyarmor20af2cdf6a = 1
486486
pyarmor5688af382c = 'a'
487487

488-
If need disable random name, run this command::
488+
If need disable random name mode, run this command::
489489

490490
$ pyarmor build --randname 0
491+
492+
Then build project again::
493+
491494
$ pyarmor build --rft

pyarmor/docs/user/tutorials.rst

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ When building the project, there are warnings::
9393

9494
WARNING There are variables of unknown type
9595
WARNING There are function calls which may use unknown arguments
96-
WARNING Please check file ".pyarmor/project/rft_extra_config.sh"
96+
WARNING Please check file ".pyarmor/project/rft_unknowns.json"
9797

9898
In the script `fibo.py`, there are the following lines:
9999

@@ -151,6 +151,27 @@ Now build project again::
151151

152152
$ pyarmor build --rft
153153
$ cat dist/fibo.py
154+
$ python dist/fibo.py
155+
156+
Solve Refactor Issues Automatically
157+
===================================
158+
159+
In above example, if you don't want to take these extra configurations, Pyarmor also supports auto-fix mode to make it works by simple and rough way::
160+
161+
$ pyarmor build --autofix 1
162+
163+
After that, build the project and test it again::
164+
165+
$ pyarmor build --rft
166+
$ python dist/fibo.py
167+
168+
If need disable auto-fix mode, run this command::
169+
170+
$ pyarmor build --autofix 0
171+
172+
Then build project again::
173+
174+
$ pyarmor build --rft
154175

155176
Generate Mini Script
156177
====================
@@ -243,29 +264,3 @@ Refactor this project::
243264
Run the final script::
244265

245266
$ python dist/jsontool.py
246-
247-
Solve Refactor Issues
248-
=====================
249-
250-
For complex scripts, it need some extra configuration to make it works.
251-
252-
Pyarmor supports auto-fix mode to take these configurations by simple and rough way::
253-
254-
$ pyarmor build --autofix 1
255-
256-
This command will implicitly run the following command::
257-
258-
$ pyarmor env -p set rft_option:rft_argument 1
259-
260-
It means only position-only arguments are renamed (the default value `3` means all the arguments are renamed)
261-
262-
This command also searchs all unknown attributes, and append them to option `rft_exclude_names`::
263-
264-
$ pyarmor env -p set rft_option:rft_exclude_names xxxx
265-
266-
So all the names like `xxxx` in any place won't be renamed.
267-
268-
After that, build the project and test it again::
269-
270-
$ pyarmor build --rft
271-
$ python dist/fibo.py

pyarmor/docs/zh/user/man.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ pyarmor init
2020

2121
[#]_ pyarmor init -h
2222

23-
[#]_ pyarmor init [-s PATH] [-x PATTERN]
23+
[#]_ pyarmor init [-C] [-s PATH] [-x PATTERN]
2424

25-
[#]_ pyarmor init [-s PATH] [-e FILE] [-m FILE] [-p PATH]
25+
[#]_ pyarmor init [-e FILE] [-m FILE] [-p PATH]
2626

27-
[#]_ pyarmor init [-C]
27+
[#]_ pyarmor init
2828

2929
.. rubric:: 说明
3030

3131
.. [#] 显示命令帮助
3232
.. [#] 创建工程,指定工程源路径,并把该路径下的模块和包增加到工程
33-
.. [#] 创建或者修改工程,增加指定的脚本,模块和包到工程
33+
.. [#] 增加指定的脚本,模块和包到工程
3434
.. [#] 显示当前目录的工程信息
3535
3636
.. describe:: 选项
@@ -485,7 +485,10 @@ pyarmor build
485485
pyarmor20af2cdf6a = 1
486486
pyarmor5688af382c = 'a'
487487

488-
如果需要禁用随机名称,那么::
488+
如果需要禁用随机名称,那么::
489489

490490
$ pyarmor build --randname 0
491+
492+
然后重构工程::
493+
491494
$ pyarmor build --rft

pyarmor/docs/zh/user/tutorials.rst

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Pyarmor 发布在 PyPI 上面,使用下面的命令直接安装::
9393

9494
WARNING There are variables of unknown type
9595
WARNING There are function calls which may use unknown arguments
96-
WARNING Please check file ".pyarmor/project/rft_extra_config.sh"
96+
WARNING Please check file ".pyarmor/project/rft_unknowns.json"
9797

9898
第一个警告::
9999

@@ -154,6 +154,40 @@ Pyarmor 发布在 PyPI 上面,使用下面的命令直接安装::
154154

155155
$ pyarmor env -p rft_option:rft_exclude_args fibo:show
156156

157+
配置好之后,在重新构建工程::
158+
159+
$ pyarmor build --rft
160+
$ cat dist/fibo.py
161+
$ python dist/fibo.py
162+
163+
自动重构模式
164+
============
165+
166+
在上面的工程中,我们如果不想去进行额外的配置,可以使用自动重构模式
167+
168+
自动重构模式可以省去人工的配置,自动进行配置以生成正确的脚本。
169+
170+
首先使用下面的命令自动创建规则::
171+
172+
$ pyarmor build --autofix 1
173+
174+
然后在执行相应的构建命令::
175+
176+
$ pyarmor build --rft
177+
178+
其基本的工作原理是
179+
180+
- 固定配置 rft_argument = 1
181+
- 如果发现某一个属性无法确定其类型,那么这个属性不进行重命名
182+
183+
如果不需要使用自动重构模式,那么使用下面的命令::
184+
185+
$ pyarmor build --autofix 0
186+
187+
然后在重新进行构建::
188+
189+
$ pyarmor build --rft
190+
157191
..
158192
使用自动生成的配置脚本
159193
----------------------
@@ -340,29 +374,3 @@ Pyarmor 发布在 PyPI 上面,使用下面的命令直接安装::
340374
$ pyarmor env -p set rft_option:rft_argument 1
341375

342376
然后在重新加密脚本,这样可以简化配置,但是大部分参数可能没有被重命名
343-
344-
自动重构模式
345-
============
346-
347-
自动重构模式可以省去人工的配置,自动进行配置以生成正确的脚本。
348-
349-
首先使用下面的命令自动创建规则::
350-
351-
$ pyarmor build --autofix 1
352-
353-
然后在执行相应的构建命令::
354-
355-
$ pyarmor build --rft
356-
357-
其基本的工作原理是
358-
359-
- 固定配置 rft_argument = 1
360-
- 如果发现某一个属性无法确定其类型,那么这个属性不进行重命名
361-
362-
如果不需要使用自动重构模式,那么使用下面的命令::
363-
364-
$ pyarmor build --autofix 0
365-
366-
然后在重新进行构建::
367-
368-
$ pyarmor build --rft

0 commit comments

Comments
 (0)