maya-umbrella 0.14.2__tar.gz → 0.16.0__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 (41) hide show
  1. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/PKG-INFO +65 -97
  2. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/README.md +59 -94
  3. maya_umbrella-0.16.0/maya_umbrella/__version__.py +1 -0
  4. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/filesystem.py +45 -1
  5. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/signatures.py +12 -0
  6. maya_umbrella-0.16.0/maya_umbrella/vaccines/vaccine4.py +55 -0
  7. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/pyproject.toml +2 -2
  8. maya_umbrella-0.14.2/maya_umbrella/__version__.py +0 -1
  9. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/LICENSE +0 -0
  10. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/__init__.py +0 -0
  11. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/__init__.py +0 -0
  12. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/atomicwrites/LICENSE +0 -0
  13. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/atomicwrites/__init__.py +0 -0
  14. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/atomicwrites.pyi +0 -0
  15. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/six/__init__.pyi +0 -0
  16. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/six/moves/__init__.pyi +0 -0
  17. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/six/moves/configparser.pyi +0 -0
  18. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/six.LICENSE +0 -0
  19. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/six.py +0 -0
  20. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/_vendor/vendor.txt +0 -0
  21. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/cleaner.py +0 -0
  22. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/collector.py +0 -0
  23. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/constants.py +0 -0
  24. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/defender.py +0 -0
  25. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/hooks/__init__.py +0 -0
  26. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/hooks/delete_turtle.py +0 -0
  27. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/hooks/delete_unknown_plugin_node.py +0 -0
  28. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/hooks/fix_model_panel.py +0 -0
  29. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/hooks/fix_no_scene_name.py +0 -0
  30. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/hooks/fix_on_model_change_3dc.py +0 -0
  31. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/i18n.py +0 -0
  32. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/locales/en_US.json +0 -0
  33. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/locales/zh_CN.json +0 -0
  34. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/log.py +0 -0
  35. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/maya_funs.py +0 -0
  36. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/scanner.py +0 -0
  37. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/vaccine.py +0 -0
  38. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/vaccines/__init__.py +0 -0
  39. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/vaccines/vaccine1.py +0 -0
  40. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/vaccines/vaccine2.py +0 -0
  41. {maya_umbrella-0.14.2 → maya_umbrella-0.16.0}/maya_umbrella/vaccines/vaccine3.py +0 -0
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: maya_umbrella
3
- Version: 0.14.2
3
+ Version: 0.16.0
4
4
  Summary: A better Autodesk Maya antivirus tool detects and removes malicious.
5
- Home-page: https://github.com/loonghao/maya_umbrella
6
5
  License: MIT
6
+ License-File: LICENSE
7
7
  Keywords: Autodesk Maya,python,Maya,dcc,antivirus,Security Tools,maya_umbrella
8
8
  Author: longhao
9
9
  Author-email: hal.long@outlook.com
@@ -19,11 +19,16 @@ Classifier: Programming Language :: Python :: 3.9
19
19
  Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
22
24
  Project-URL: Documentation, https://github.com/loonghao/maya_umbrella
25
+ Project-URL: Homepage, https://github.com/loonghao/maya_umbrella
23
26
  Project-URL: Repository, https://github.com/loonghao/maya_umbrella
24
27
  Description-Content-Type: text/markdown
25
28
 
26
- ![maya_umbrella.ing Banner](https://raw.githubusercontent.com/loonghao/maya_umbrella/main/resources/banner.png)
29
+ ![Maya Umbrella Banner](https://raw.githubusercontent.com/loonghao/maya_umbrella/main/resources/banner.png)
30
+
31
+ [English](https://github.com/loonghao/maya_umbrella/blob/main/README.md) | [中文](https://github.com/loonghao/maya_umbrella/blob/main/README_zh.md)
27
32
 
28
33
  [![Python Version](https://img.shields.io/pypi/pyversions/maya-umbrella)](https://img.shields.io/pypi/pyversions/maya-umbrella)
29
34
  [![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)
@@ -31,6 +36,7 @@ Description-Content-Type: text/markdown
31
36
  [![Downloads](https://static.pepy.tech/badge/maya-umbrella)](https://pepy.tech/project/maya-umbrella)
32
37
  [![Downloads](https://static.pepy.tech/badge/maya-umbrella/month)](https://pepy.tech/project/maya-umbrella)
33
38
  [![Downloads](https://static.pepy.tech/badge/maya-umbrella/week)](https://pepy.tech/project/maya-umbrella)
39
+ [![GitHub Release](https://img.shields.io/github/downloads/loonghao/maya_umbrella/total?label=GitHub%20Downloads)](https://github.com/loonghao/maya_umbrella/releases)
34
40
  [![License](https://img.shields.io/pypi/l/maya-umbrella)](https://pypi.org/project/maya-umbrella/)
35
41
  [![PyPI Format](https://img.shields.io/pypi/format/maya-umbrella)](https://pypi.org/project/maya-umbrella/)
36
42
  [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/loonghao/maya-umbrella/graphs/commit-activity)
@@ -46,7 +52,7 @@ Description-Content-Type: text/markdown
46
52
  [![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
47
53
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
48
54
 
49
- A better Autodesk Maya antivirus tool detects and removes malicious.
55
+ A better Autodesk Maya antivirus tool that detects and removes malicious code.
50
56
 
51
57
  This tool is designed to provide a robust solution for identifying and resolving any potential viruses within Autodesk
52
58
  Maya.
@@ -54,144 +60,107 @@ It ensures a secure and seamless user experience by proactively scanning for thr
54
60
 
55
61
  It can be provided as an API for seamless integration into your existing pipeline.
56
62
 
57
- # 安装
63
+ # Installation
58
64
 
59
- ## pip 安装
65
+ ## pip installation
60
66
  maya_umbrella is distributed as a standard pipy package, so we can install it via pip install.
61
-
62
- maya_umbrella是以标准pipy包去发布的,所以我们可以通过pip install去安装
63
67
  ```shell
64
68
  your/maya-root/mayapy -m pip install maya-umbrella
65
69
  ```
66
- ## 一键安装
70
+ ## One-click installation
67
71
  Download the corresponding version of the zip package in the release, unzip it and double-click `install.bat` to install it.
68
72
 
69
- 在release里面下载对应版本的zip包,解压后双击`install.bat`即可安装
70
-
71
- 更新版本
73
+ Update version
72
74
  ```shell
73
75
  your/maya-root/mayapy -m pip install maya-umbrella --upgrade
74
76
  ```
75
- 卸载
77
+ Uninstall
76
78
  ```shell
77
79
  your/maya-root/mayapy -m pip uninstall maya-umbrella
78
80
  ```
79
81
 
80
- # 开发环境设置
82
+ # Development Environment Setup
81
83
 
82
84
  Set up the development environment using a virtual environment,
83
85
  and it is recommended to use Python 3.8 or higher versions.
84
86
 
85
- 通过虚拟环境去设置开发环境, 推荐python-3.8以上的版本
86
-
87
- 通过pip安装相关开发依赖
87
+ Install development dependencies via pip
88
88
 
89
89
  ```shell
90
90
  pip install -r requirements-dev.txt
91
91
  ```
92
92
 
93
- # 开发调试
94
-
93
+ # Development Debugging
95
94
 
96
- ## 在maya中测试
97
- With `nox -s maya -- <maya version>`, start maya.
98
- Nox will dynamically register a nox session based on your local installation of maya,
99
- e.g. if you have `maya-2018` installed locally, then you can start maya with a test environment.
100
- Then you can start maya with a test environment via
101
95
 
102
- 通过`nox -s maya -- <maya version>`, 启动maya.
103
- nox会动态根据你本地安装得maya去注册nox session, 比如你本地安装了`maya-2018`,
104
- 那么通过可以启动带有测试环境的maya
96
+ ## Testing in Maya
97
+ With `nox -s maya -- <maya version>`, start Maya.
98
+ Nox will dynamically register a nox session based on your local installation of Maya,
99
+ e.g. if you have `maya-2018` installed locally, then you can start Maya with a test environment.
105
100
 
106
101
  ```shell
107
102
  nox -s maya -- 2018
108
103
  ```
109
104
  **Note: there are two `-` between maya and the version number**.
110
105
 
111
- Starting maya and executing the following code in the script editor will dynamically open the ma file from `<repo>/tests/virus/` to test it.
112
-
113
- **注意:maya 与 版本号之间有 俩个`-`**
114
-
115
- 启动maya后在脚本编辑器中执行下面得代码,就会动态的从`<repo>/tests/virus/`里面去open ma文件去进行测试.
106
+ After starting Maya, executing the following code in the script editor will dynamically open the ma file from `<repo>/tests/virus/` to test it.
116
107
 
117
108
  ```python
118
109
  import manual_test_in_maya
119
110
 
120
111
  manual_test_in_maya.start()
121
112
  ```
122
- It is also possible to execute the corresponding tests via pytest, which also requires a local installation of the corresponding maya
123
-
124
- 也可以通过pytest去执行对应的测试,也需要本地安装了对应的maya
113
+ It is also possible to execute the corresponding tests via pytest, which also requires a local installation of the corresponding Maya
125
114
 
126
115
  ```shell
127
116
  nox -s maya -- 2018 --test
128
117
  ```
129
118
  **Note: Command line crash may occur in versions below maya-2022 (PY2)**.
130
119
 
131
- **注意:在maya-2022 (PY2) 以下的版本可能会出现命令行crash的情况**
132
-
133
120
 
134
- ## 增加新的疫苗
135
- Create a new py in `<repo>/maya_umbrella/vaccines/`, since many viruses don't have a specific name, we'll use `vaccine<id>.py`.
121
+ ## Adding New Vaccines
122
+ Create a new py in `<repo>/maya_umbrella/vaccines/`. Since many viruses don't have a specific name, we'll use `vaccine<id>.py`.
136
123
  Inherit `from maya_umbrella.vaccine import AbstractVaccine` and call the class `Vaccine`, and then write the virus collection logic.
137
124
 
138
- 在`<repo>/maya_umbrella/vaccines/` 新建一个py, 因为有很多病毒没有具体的名字代号,我们统一以`vaccine<id>.py`
139
- 继承`from maya_umbrella.vaccine import AbstractVaccine`并且class名字叫`Vaccine`即可, 然后去写具体的收集病毒逻辑
140
-
141
- ## 代码检查
125
+ ## Code Check
142
126
 
143
127
  We can use the encapsulated `nox` command to perform a code check.
144
128
 
145
- 我们可以利用封装好的`nox`命令去执行进行代码检查
146
-
147
129
  ```shell
148
130
  nox -s lint
149
131
  ```
150
132
 
151
- 进行代码整理
133
+ Format code
152
134
  ```shell
153
135
  nox -s lint-fix
154
136
  ```
155
137
 
156
- # 生成安装包
138
+ # Generate Installation Package
157
139
  Execute the following command to create a zip under <repo>/.zip, with `--version` the version number of the current tool.
158
140
 
159
141
  **Note: between `make-zip` and `--version` there are two `-`**.
160
142
 
161
- 执行下面的命令可以在<repo>/.zip下面创建zip,参数 `--version` 当前工具的版本号
162
-
163
- **注意:`make-zip` 与 `--version`之间有 俩个`-`**
164
-
165
143
  ```shell
166
144
  nox -s make-zip -- --version 0.5.0
167
145
  ```
168
146
 
169
- # 环境变量
170
- We can use the following environment variables to modify some of the settings of maya_umbrella,
171
-
147
+ # Environment Variables
148
+ We can use the following environment variables to modify some of the settings of maya_umbrella,
172
149
  so that companies with pipelines can better integrate them.
173
150
 
174
151
  Modify the log saving directory of maya umbrella, the default is the windows temp directory.
175
152
 
176
- 我们可以通过下列环境变量去修改maya_umbrella的一些设置,方便有pipeline的公司可以更好的集成
177
-
178
- 修改maya umbrella的日志保存目录,默认是windows temp目录
179
-
180
153
  ```shell
181
154
  MAYA_UMBRELLA_LOG_ROOT
182
155
  ```
183
156
  Change the name of the log file for maya umbrella, default is `maya_umbrella`.
184
157
 
185
- 修改maya umbrella的日志文件名称, 默认是`maya_umbrella`
186
-
187
158
  ```shell
188
159
  MAYA_UMBRELLA_LOG_NAME
189
160
  ```
190
161
 
191
162
  Set the log level, the default is info, can be debug can see more log information.
192
163
 
193
- 设置日志级别,默认是info, 可以是debug可以看到更多的日志信息.
194
-
195
164
  ```shell
196
165
  MAYA_UMBRELLA_LOG_LEVEL
197
166
  ```
@@ -202,64 +171,73 @@ For example:
202
171
  Your file path is `c:/your/path/file.ma`.
203
172
 
204
173
  Then the backup file path is `c:/your/path/_virus/file.ma`.
205
-
206
- 修改杀毒后文件的备份文件夹名称, 默认是`_virus`
207
- 比如:
208
- 你文件路径是 `c:/your/path/file.ma`
209
- 那么备份文件路径是 `c:/your/path/_virus/file.ma`
210
174
  ```shell
211
175
  MAYA_UMBRELLA_BACKUP_FOLDER_NAME
212
176
  ```
213
177
  The default display language, including logging printouts, etc.
214
-
215
- is set by default according to your current maya interface language,
216
-
178
+ is set by default according to your current maya interface language,
217
179
  but of course we can also set it via the following environment variables.
218
-
219
- 默认的显示语言,包含日志打印输出等,默认是根据你当前maya的界面语言来设置的,当然我们也可以通过下面的环境变量去设置.
220
180
  ```shell
221
181
  MAYA_UMBRELLA_LANG
222
182
  ```
223
183
  Ignore saving to the backup folder,
224
- *please note that if you are not clear about the consequences of this please do not modify it easily*,
225
- the default batch antivirus will automatically back up the source file to the current file's backup folder
184
+ *please note that if you are not clear about the consequences of this please do not modify it easily*,
185
+ the default batch antivirus will automatically back up the source file to the current file's backup folder
226
186
  after the batch antivirus.
227
187
 
228
- 忽略保存到备份文件夹,*请注意,如果你不清楚这个会导致的后果请不要轻易修改*,默认批量杀毒后会把源文件自动备份到当前文件的备份文件夹.
229
-
230
188
  ```shell
231
189
  MAYA_UMBRELLA_IGNORE_BACKUP
232
190
  ```
233
191
  If ignored please set to
234
-
235
- 如果忽略请设置为
236
192
  ```shell
237
193
  SET MAYA_UMBRELLA_IGNORE_BACKUP=true
238
194
  ```
239
195
 
240
- For the portable version of Maya,
196
+ For the portable version of Maya,
241
197
  you can specify the Maya path by adding the `MAYA_LOCATION` environment variable.
242
198
 
243
- 如果是便携版Maya,可以通过添加 `MAYA_LOCATION` 环境变量指定Maya路径
244
-
245
199
  ```shell
246
200
  SET MAYA_LOCATION=d:/your/path/maya_version/
247
201
  ```
248
202
  You can also specify a directory from the command line.
249
203
 
250
- 也可以通过命令行指定目录
251
-
252
204
  ```shell
253
205
  nox -s maya -- 2018 --install-root /your/local/maya/root
254
206
 
255
207
  ```
256
208
 
209
+ ## Hooks Control
210
+
211
+ Disable all hooks. When set to `true`, no hooks will be executed.
212
+ ```shell
213
+ MAYA_UMBRELLA_DISABLE_ALL_HOOKS
214
+ ```
215
+ If you want to disable all hooks:
216
+ ```shell
217
+ SET MAYA_UMBRELLA_DISABLE_ALL_HOOKS=true
218
+ ```
219
+
220
+ Disable specific hooks by name. Use a comma-separated list of hook names (without `.py` extension).
221
+
222
+ Available hooks:
223
+ - `delete_turtle` - Remove Turtle plugin and related nodes
224
+ - `delete_unknown_plugin_node` - Remove unknown plugin nodes
225
+ - `fix_model_panel` - Fix model panel issues
226
+ - `fix_no_scene_name` - Fix scenes without names
227
+ - `fix_on_model_change_3dc` - Fix 3D Coat model change callback
228
+
229
+ ```shell
230
+ MAYA_UMBRELLA_DISABLE_HOOKS
231
+ ```
232
+ For example, to disable the `delete_turtle` and `delete_unknown_plugin_node` hooks:
233
+ ```shell
234
+ SET MAYA_UMBRELLA_DISABLE_HOOKS=delete_turtle,delete_unknown_plugin_node
235
+ ```
236
+
257
237
  # API
258
238
 
259
239
  Get virus files that have not been repaired in the current scenario.
260
240
 
261
- 获取当前场景没有被修复的病毒文件
262
-
263
241
  ```python
264
242
  from maya_umbrella import MayaVirusDefender
265
243
 
@@ -268,8 +246,6 @@ print(api.get_unfixed_references())
268
246
  ```
269
247
 
270
248
  Batch repair of files, via regular expressions.
271
-
272
- 批量修复文件, 通过正则表达式
273
249
  ```python
274
250
  from maya_umbrella import MayaVirusScanner
275
251
 
@@ -278,7 +254,7 @@ print(api.scan_files_from_pattern("your/path/*.m[ab]"))
278
254
 
279
255
  ```
280
256
 
281
- # 案例
257
+ # Examples
282
258
 
283
259
  If you want to quickly go through maya standalone and batch clean up maya files.
284
260
 
@@ -291,14 +267,6 @@ For example, if you have `2018` installed locally, Then `nox -s maya -- 2018 --s
291
267
 
292
268
  The following syntax starts a maya-2020 environment to dynamically check for viruses from the `c:/test` folder.
293
269
 
294
- 如果你想要快速通过maya standalone去批量清理maya文件,
295
- 可以`下载`或者`git clone`当前`main`分支的工程,
296
- 根据上面指引设置好开发环境,
297
- 通过`nox`命令去启动maya `standalone`环境,maya版本根据你当前本地安装的maya为准,
298
- 比如你本地安装了`2018`,
299
- 那么就是 `nox -s maya -- 2018 --standalone`
300
- 下面的语法是启动一个maya-2020的环境去动态从`c:/test`文件夹下去查杀病毒
301
-
302
270
  ```shell
303
271
  nox -s maya -- 2018 --standalone --pattern c:/test/*.m[ab]
304
272
  ```
@@ -1,4 +1,6 @@
1
- ![maya_umbrella.ing Banner](https://raw.githubusercontent.com/loonghao/maya_umbrella/main/resources/banner.png)
1
+ ![Maya Umbrella Banner](https://raw.githubusercontent.com/loonghao/maya_umbrella/main/resources/banner.png)
2
+
3
+ [English](https://github.com/loonghao/maya_umbrella/blob/main/README.md) | [中文](https://github.com/loonghao/maya_umbrella/blob/main/README_zh.md)
2
4
 
3
5
  [![Python Version](https://img.shields.io/pypi/pyversions/maya-umbrella)](https://img.shields.io/pypi/pyversions/maya-umbrella)
4
6
  [![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)
@@ -6,6 +8,7 @@
6
8
  [![Downloads](https://static.pepy.tech/badge/maya-umbrella)](https://pepy.tech/project/maya-umbrella)
7
9
  [![Downloads](https://static.pepy.tech/badge/maya-umbrella/month)](https://pepy.tech/project/maya-umbrella)
8
10
  [![Downloads](https://static.pepy.tech/badge/maya-umbrella/week)](https://pepy.tech/project/maya-umbrella)
11
+ [![GitHub Release](https://img.shields.io/github/downloads/loonghao/maya_umbrella/total?label=GitHub%20Downloads)](https://github.com/loonghao/maya_umbrella/releases)
9
12
  [![License](https://img.shields.io/pypi/l/maya-umbrella)](https://pypi.org/project/maya-umbrella/)
10
13
  [![PyPI Format](https://img.shields.io/pypi/format/maya-umbrella)](https://pypi.org/project/maya-umbrella/)
11
14
  [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/loonghao/maya-umbrella/graphs/commit-activity)
@@ -21,7 +24,7 @@
21
24
  [![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
22
25
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
23
26
 
24
- A better Autodesk Maya antivirus tool detects and removes malicious.
27
+ A better Autodesk Maya antivirus tool that detects and removes malicious code.
25
28
 
26
29
  This tool is designed to provide a robust solution for identifying and resolving any potential viruses within Autodesk
27
30
  Maya.
@@ -29,144 +32,107 @@ It ensures a secure and seamless user experience by proactively scanning for thr
29
32
 
30
33
  It can be provided as an API for seamless integration into your existing pipeline.
31
34
 
32
- # 安装
35
+ # Installation
33
36
 
34
- ## pip 安装
37
+ ## pip installation
35
38
  maya_umbrella is distributed as a standard pipy package, so we can install it via pip install.
36
-
37
- maya_umbrella是以标准pipy包去发布的,所以我们可以通过pip install去安装
38
39
  ```shell
39
40
  your/maya-root/mayapy -m pip install maya-umbrella
40
41
  ```
41
- ## 一键安装
42
+ ## One-click installation
42
43
  Download the corresponding version of the zip package in the release, unzip it and double-click `install.bat` to install it.
43
44
 
44
- 在release里面下载对应版本的zip包,解压后双击`install.bat`即可安装
45
-
46
- 更新版本
45
+ Update version
47
46
  ```shell
48
47
  your/maya-root/mayapy -m pip install maya-umbrella --upgrade
49
48
  ```
50
- 卸载
49
+ Uninstall
51
50
  ```shell
52
51
  your/maya-root/mayapy -m pip uninstall maya-umbrella
53
52
  ```
54
53
 
55
- # 开发环境设置
54
+ # Development Environment Setup
56
55
 
57
56
  Set up the development environment using a virtual environment,
58
57
  and it is recommended to use Python 3.8 or higher versions.
59
58
 
60
- 通过虚拟环境去设置开发环境, 推荐python-3.8以上的版本
61
-
62
- 通过pip安装相关开发依赖
59
+ Install development dependencies via pip
63
60
 
64
61
  ```shell
65
62
  pip install -r requirements-dev.txt
66
63
  ```
67
64
 
68
- # 开发调试
69
-
65
+ # Development Debugging
70
66
 
71
- ## 在maya中测试
72
- With `nox -s maya -- <maya version>`, start maya.
73
- Nox will dynamically register a nox session based on your local installation of maya,
74
- e.g. if you have `maya-2018` installed locally, then you can start maya with a test environment.
75
- Then you can start maya with a test environment via
76
67
 
77
- 通过`nox -s maya -- <maya version>`, 启动maya.
78
- nox会动态根据你本地安装得maya去注册nox session, 比如你本地安装了`maya-2018`,
79
- 那么通过可以启动带有测试环境的maya
68
+ ## Testing in Maya
69
+ With `nox -s maya -- <maya version>`, start Maya.
70
+ Nox will dynamically register a nox session based on your local installation of Maya,
71
+ e.g. if you have `maya-2018` installed locally, then you can start Maya with a test environment.
80
72
 
81
73
  ```shell
82
74
  nox -s maya -- 2018
83
75
  ```
84
76
  **Note: there are two `-` between maya and the version number**.
85
77
 
86
- Starting maya and executing the following code in the script editor will dynamically open the ma file from `<repo>/tests/virus/` to test it.
87
-
88
- **注意:maya 与 版本号之间有 俩个`-`**
89
-
90
- 启动maya后在脚本编辑器中执行下面得代码,就会动态的从`<repo>/tests/virus/`里面去open ma文件去进行测试.
78
+ After starting Maya, executing the following code in the script editor will dynamically open the ma file from `<repo>/tests/virus/` to test it.
91
79
 
92
80
  ```python
93
81
  import manual_test_in_maya
94
82
 
95
83
  manual_test_in_maya.start()
96
84
  ```
97
- It is also possible to execute the corresponding tests via pytest, which also requires a local installation of the corresponding maya
98
-
99
- 也可以通过pytest去执行对应的测试,也需要本地安装了对应的maya
85
+ It is also possible to execute the corresponding tests via pytest, which also requires a local installation of the corresponding Maya
100
86
 
101
87
  ```shell
102
88
  nox -s maya -- 2018 --test
103
89
  ```
104
90
  **Note: Command line crash may occur in versions below maya-2022 (PY2)**.
105
91
 
106
- **注意:在maya-2022 (PY2) 以下的版本可能会出现命令行crash的情况**
107
-
108
92
 
109
- ## 增加新的疫苗
110
- Create a new py in `<repo>/maya_umbrella/vaccines/`, since many viruses don't have a specific name, we'll use `vaccine<id>.py`.
93
+ ## Adding New Vaccines
94
+ Create a new py in `<repo>/maya_umbrella/vaccines/`. Since many viruses don't have a specific name, we'll use `vaccine<id>.py`.
111
95
  Inherit `from maya_umbrella.vaccine import AbstractVaccine` and call the class `Vaccine`, and then write the virus collection logic.
112
96
 
113
- 在`<repo>/maya_umbrella/vaccines/` 新建一个py, 因为有很多病毒没有具体的名字代号,我们统一以`vaccine<id>.py`
114
- 继承`from maya_umbrella.vaccine import AbstractVaccine`并且class名字叫`Vaccine`即可, 然后去写具体的收集病毒逻辑
115
-
116
- ## 代码检查
97
+ ## Code Check
117
98
 
118
99
  We can use the encapsulated `nox` command to perform a code check.
119
100
 
120
- 我们可以利用封装好的`nox`命令去执行进行代码检查
121
-
122
101
  ```shell
123
102
  nox -s lint
124
103
  ```
125
104
 
126
- 进行代码整理
105
+ Format code
127
106
  ```shell
128
107
  nox -s lint-fix
129
108
  ```
130
109
 
131
- # 生成安装包
110
+ # Generate Installation Package
132
111
  Execute the following command to create a zip under <repo>/.zip, with `--version` the version number of the current tool.
133
112
 
134
113
  **Note: between `make-zip` and `--version` there are two `-`**.
135
114
 
136
- 执行下面的命令可以在<repo>/.zip下面创建zip,参数 `--version` 当前工具的版本号
137
-
138
- **注意:`make-zip` 与 `--version`之间有 俩个`-`**
139
-
140
115
  ```shell
141
116
  nox -s make-zip -- --version 0.5.0
142
117
  ```
143
118
 
144
- # 环境变量
145
- We can use the following environment variables to modify some of the settings of maya_umbrella,
146
-
119
+ # Environment Variables
120
+ We can use the following environment variables to modify some of the settings of maya_umbrella,
147
121
  so that companies with pipelines can better integrate them.
148
122
 
149
123
  Modify the log saving directory of maya umbrella, the default is the windows temp directory.
150
124
 
151
- 我们可以通过下列环境变量去修改maya_umbrella的一些设置,方便有pipeline的公司可以更好的集成
152
-
153
- 修改maya umbrella的日志保存目录,默认是windows temp目录
154
-
155
125
  ```shell
156
126
  MAYA_UMBRELLA_LOG_ROOT
157
127
  ```
158
128
  Change the name of the log file for maya umbrella, default is `maya_umbrella`.
159
129
 
160
- 修改maya umbrella的日志文件名称, 默认是`maya_umbrella`
161
-
162
130
  ```shell
163
131
  MAYA_UMBRELLA_LOG_NAME
164
132
  ```
165
133
 
166
134
  Set the log level, the default is info, can be debug can see more log information.
167
135
 
168
- 设置日志级别,默认是info, 可以是debug可以看到更多的日志信息.
169
-
170
136
  ```shell
171
137
  MAYA_UMBRELLA_LOG_LEVEL
172
138
  ```
@@ -177,64 +143,73 @@ For example:
177
143
  Your file path is `c:/your/path/file.ma`.
178
144
 
179
145
  Then the backup file path is `c:/your/path/_virus/file.ma`.
180
-
181
- 修改杀毒后文件的备份文件夹名称, 默认是`_virus`
182
- 比如:
183
- 你文件路径是 `c:/your/path/file.ma`
184
- 那么备份文件路径是 `c:/your/path/_virus/file.ma`
185
146
  ```shell
186
147
  MAYA_UMBRELLA_BACKUP_FOLDER_NAME
187
148
  ```
188
149
  The default display language, including logging printouts, etc.
189
-
190
- is set by default according to your current maya interface language,
191
-
150
+ is set by default according to your current maya interface language,
192
151
  but of course we can also set it via the following environment variables.
193
-
194
- 默认的显示语言,包含日志打印输出等,默认是根据你当前maya的界面语言来设置的,当然我们也可以通过下面的环境变量去设置.
195
152
  ```shell
196
153
  MAYA_UMBRELLA_LANG
197
154
  ```
198
155
  Ignore saving to the backup folder,
199
- *please note that if you are not clear about the consequences of this please do not modify it easily*,
200
- the default batch antivirus will automatically back up the source file to the current file's backup folder
156
+ *please note that if you are not clear about the consequences of this please do not modify it easily*,
157
+ the default batch antivirus will automatically back up the source file to the current file's backup folder
201
158
  after the batch antivirus.
202
159
 
203
- 忽略保存到备份文件夹,*请注意,如果你不清楚这个会导致的后果请不要轻易修改*,默认批量杀毒后会把源文件自动备份到当前文件的备份文件夹.
204
-
205
160
  ```shell
206
161
  MAYA_UMBRELLA_IGNORE_BACKUP
207
162
  ```
208
163
  If ignored please set to
209
-
210
- 如果忽略请设置为
211
164
  ```shell
212
165
  SET MAYA_UMBRELLA_IGNORE_BACKUP=true
213
166
  ```
214
167
 
215
- For the portable version of Maya,
168
+ For the portable version of Maya,
216
169
  you can specify the Maya path by adding the `MAYA_LOCATION` environment variable.
217
170
 
218
- 如果是便携版Maya,可以通过添加 `MAYA_LOCATION` 环境变量指定Maya路径
219
-
220
171
  ```shell
221
172
  SET MAYA_LOCATION=d:/your/path/maya_version/
222
173
  ```
223
174
  You can also specify a directory from the command line.
224
175
 
225
- 也可以通过命令行指定目录
226
-
227
176
  ```shell
228
177
  nox -s maya -- 2018 --install-root /your/local/maya/root
229
178
 
230
179
  ```
231
180
 
181
+ ## Hooks Control
182
+
183
+ Disable all hooks. When set to `true`, no hooks will be executed.
184
+ ```shell
185
+ MAYA_UMBRELLA_DISABLE_ALL_HOOKS
186
+ ```
187
+ If you want to disable all hooks:
188
+ ```shell
189
+ SET MAYA_UMBRELLA_DISABLE_ALL_HOOKS=true
190
+ ```
191
+
192
+ Disable specific hooks by name. Use a comma-separated list of hook names (without `.py` extension).
193
+
194
+ Available hooks:
195
+ - `delete_turtle` - Remove Turtle plugin and related nodes
196
+ - `delete_unknown_plugin_node` - Remove unknown plugin nodes
197
+ - `fix_model_panel` - Fix model panel issues
198
+ - `fix_no_scene_name` - Fix scenes without names
199
+ - `fix_on_model_change_3dc` - Fix 3D Coat model change callback
200
+
201
+ ```shell
202
+ MAYA_UMBRELLA_DISABLE_HOOKS
203
+ ```
204
+ For example, to disable the `delete_turtle` and `delete_unknown_plugin_node` hooks:
205
+ ```shell
206
+ SET MAYA_UMBRELLA_DISABLE_HOOKS=delete_turtle,delete_unknown_plugin_node
207
+ ```
208
+
232
209
  # API
233
210
 
234
211
  Get virus files that have not been repaired in the current scenario.
235
212
 
236
- 获取当前场景没有被修复的病毒文件
237
-
238
213
  ```python
239
214
  from maya_umbrella import MayaVirusDefender
240
215
 
@@ -243,8 +218,6 @@ print(api.get_unfixed_references())
243
218
  ```
244
219
 
245
220
  Batch repair of files, via regular expressions.
246
-
247
- 批量修复文件, 通过正则表达式
248
221
  ```python
249
222
  from maya_umbrella import MayaVirusScanner
250
223
 
@@ -253,7 +226,7 @@ print(api.scan_files_from_pattern("your/path/*.m[ab]"))
253
226
 
254
227
  ```
255
228
 
256
- # 案例
229
+ # Examples
257
230
 
258
231
  If you want to quickly go through maya standalone and batch clean up maya files.
259
232
 
@@ -266,14 +239,6 @@ For example, if you have `2018` installed locally, Then `nox -s maya -- 2018 --s
266
239
 
267
240
  The following syntax starts a maya-2020 environment to dynamically check for viruses from the `c:/test` folder.
268
241
 
269
- 如果你想要快速通过maya standalone去批量清理maya文件,
270
- 可以`下载`或者`git clone`当前`main`分支的工程,
271
- 根据上面指引设置好开发环境,
272
- 通过`nox`命令去启动maya `standalone`环境,maya版本根据你当前本地安装的maya为准,
273
- 比如你本地安装了`2018`,
274
- 那么就是 `nox -s maya -- 2018 --standalone`
275
- 下面的语法是启动一个maya-2020的环境去动态从`c:/test`文件夹下去查杀病毒
276
-
277
242
  ```shell
278
243
  nox -s maya -- 2018 --standalone --pattern c:/test/*.m[ab]
279
244
  ```
@@ -0,0 +1 @@
1
+ __version__ = "0.16.0"
@@ -123,14 +123,58 @@ def load_hook(hook_file):
123
123
  return module
124
124
 
125
125
 
126
+ def is_hooks_disabled():
127
+ """Check if all hooks are disabled via environment variable.
128
+
129
+ Returns:
130
+ bool: True if hooks are disabled, False otherwise.
131
+ """
132
+ return os.getenv("MAYA_UMBRELLA_DISABLE_ALL_HOOKS", "false").lower() == "true"
133
+
134
+
135
+ def get_disabled_hooks():
136
+ """Get the list of disabled hook names from environment variable.
137
+
138
+ The environment variable MAYA_UMBRELLA_DISABLE_HOOKS should be a comma-separated
139
+ list of hook names (without .py extension).
140
+
141
+ Example:
142
+ SET MAYA_UMBRELLA_DISABLE_HOOKS=delete_turtle,delete_unknown_plugin_node
143
+
144
+ Returns:
145
+ list: A list of disabled hook names.
146
+ """
147
+ disabled = os.getenv("MAYA_UMBRELLA_DISABLE_HOOKS", "")
148
+ if not disabled:
149
+ return []
150
+ return [name.strip() for name in disabled.split(",") if name.strip()]
151
+
152
+
126
153
  def get_hooks():
127
154
  """Return a list of paths to all hook files in the 'hooks' directory.
128
155
 
156
+ This function respects the following environment variables:
157
+ - MAYA_UMBRELLA_DISABLE_ALL_HOOKS: Set to "true" to disable all hooks.
158
+ - MAYA_UMBRELLA_DISABLE_HOOKS: Comma-separated list of hook names to disable.
159
+
129
160
  Returns:
130
161
  list: A list of paths to all hook files in the 'hooks' directory.
131
162
  """
163
+ if is_hooks_disabled():
164
+ return []
165
+
132
166
  pattern = os.path.join(this_root(), "hooks", "*.py")
133
- return [hook for hook in glob.glob(pattern) if "__init__" not in hook]
167
+ disabled_hooks = get_disabled_hooks()
168
+
169
+ hooks = []
170
+ for hook in glob.glob(pattern):
171
+ if "__init__" in hook:
172
+ continue
173
+ hook_name = os.path.basename(hook).replace(".py", "")
174
+ if hook_name in disabled_hooks:
175
+ continue
176
+ hooks.append(hook)
177
+ return hooks
134
178
 
135
179
 
136
180
  def get_vaccines():
@@ -9,16 +9,28 @@ virus20240430_sig1 = VirusSignature("virus20240430", "python(.*);.+exec.+(pyCode
9
9
  # https://regex101.com/r/2D14UA/1
10
10
  virus20240430_sig2 = VirusSignature("virus20240430", r"^\['.+']")
11
11
 
12
+ # maya_secure_system virus signatures
13
+ maya_secure_system_sig1 = VirusSignature("maya_secure_system", "import maya_secure_system")
14
+ maya_secure_system_sig2 = VirusSignature("maya_secure_system", r"maya_secure_system\.MayaSecureSystem\(\)\.startup\(\)")
15
+
12
16
  JOB_SCRIPTS_VIRUS_SIGNATURES = [
13
17
  "petri_dish_path.+cmds.internalVar.+",
14
18
  "userSetup",
15
19
  "fuckVirus",
16
20
  virus20240430_sig1.signature,
17
21
  virus20240430_sig2.signature,
22
+ maya_secure_system_sig1.signature,
23
+ maya_secure_system_sig2.signature,
18
24
  ]
19
25
 
20
26
  FILE_VIRUS_SIGNATURES = [
21
27
  "import vaccine",
22
28
  "cmds.evalDeferred.*leukocyte.+",
23
29
  virus20240430_sig1.signature,
30
+ maya_secure_system_sig1.signature,
31
+ ]
32
+
33
+ MAYA_SECURE_SYSTEM_VIRUS_SIGNATURES = [
34
+ maya_secure_system_sig1.signature,
35
+ maya_secure_system_sig2.signature,
24
36
  ]
@@ -0,0 +1,55 @@
1
+ # Import built-in modules
2
+ import os
3
+
4
+ # Import local modules
5
+ from maya_umbrella.filesystem import check_virus_by_signature
6
+ from maya_umbrella.filesystem import check_virus_file_by_signature
7
+ from maya_umbrella.maya_funs import check_reference_node_exists
8
+ from maya_umbrella.maya_funs import cmds
9
+ from maya_umbrella.maya_funs import get_attr_value
10
+ from maya_umbrella.signatures import MAYA_SECURE_SYSTEM_VIRUS_SIGNATURES
11
+ from maya_umbrella.vaccine import AbstractVaccine
12
+
13
+
14
+ class Vaccine(AbstractVaccine):
15
+ """A class for handling the maya_secure_system virus."""
16
+
17
+ virus_name = "maya_secure_system"
18
+
19
+ def collect_infected_nodes(self):
20
+ """Collect all bad nodes related to the virus."""
21
+ for script_node in cmds.ls(type="script"):
22
+ if check_reference_node_exists(script_node):
23
+ continue
24
+ for attr_name in ("before", "after"):
25
+ script_string = get_attr_value(script_node, attr_name)
26
+ if not script_string:
27
+ continue
28
+ if check_virus_by_signature(script_string, MAYA_SECURE_SYSTEM_VIRUS_SIGNATURES):
29
+ self.report_issue(script_node)
30
+ self.api.add_infected_node(script_node)
31
+
32
+ def collect_issues(self):
33
+ """Collect all issues related to the virus."""
34
+ # Add malicious files that need to be deleted
35
+ self.api.add_malicious_files(
36
+ [
37
+ os.path.join(self.api.local_script_path, "maya_secure_system.py"),
38
+ os.path.join(self.api.local_script_path, "maya_secure_system.pyc"),
39
+ ],
40
+ )
41
+ self.collect_infected_user_setup_py()
42
+ self.collect_infected_nodes()
43
+
44
+ def collect_infected_user_setup_py(self):
45
+ """Collect all bad userSetup.py files related to the virus."""
46
+ user_setup_py_files = [
47
+ os.path.join(self.api.local_script_path, "userSetup.py"),
48
+ os.path.join(self.api.user_script_path, "userSetup.py"),
49
+ ]
50
+
51
+ for user_setup_py in user_setup_py_files:
52
+ if os.path.exists(user_setup_py):
53
+ if check_virus_file_by_signature(user_setup_py):
54
+ self.report_issue(user_setup_py)
55
+ self.api.add_infected_file(user_setup_py)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "maya_umbrella"
3
- version = "0.14.2"
3
+ version = "0.16.0"
4
4
  description = "A better Autodesk Maya antivirus tool detects and removes malicious."
5
5
  homepage = "https://github.com/loonghao/maya_umbrella"
6
6
  repository = "https://github.com/loonghao/maya_umbrella"
@@ -36,7 +36,7 @@ nox = { version = "^2024.3.2", python = ">=3.8.1,<3.11" }
36
36
 
37
37
  [tool.commitizen]
38
38
  name = "cz_conventional_commits"
39
- version = "0.14.2"
39
+ version = "0.16.0"
40
40
  tag_format = "v$version"
41
41
  version_files = [
42
42
  "pyproject.toml:version",
@@ -1 +0,0 @@
1
- __version__ = "0.14.2"
File without changes