Skip to content

Conversation

@loonghao
Copy link
Owner

@loonghao loonghao commented Oct 17, 2025

功能描述

添加对 maya_secure_system 病毒的检测和清理支持。

变更内容

新增疫苗文件

  • 创建 maya_umbrella/vaccines/vaccine4.py 来检测和清理 maya_secure_system 病毒
  • 实现病毒特征检测逻辑
  • 支持检测受感染的 userSetup.py 文件
  • 支持检测 Maya 场景中的受感染 scriptNode
  • 自动删除恶意的 maya_secure_system.py 文件

病毒签名

  • 添加两个病毒签名到 maya_umbrella/signatures.py
    • import maya_secure_system 导入语句检测
    • maya_secure_system.MayaSecureSystem().startup() 启动调用检测

单元测试

  • 添加 tests/test_vaccine4.py 包含 pytest 兼容的测试
  • 添加 verify_vaccine4.py 用于独立验证
  • 所有测试均已通过

技术细节

maya_secure_system 病毒特征

  • 在 Maya 中创建 scriptNode
  • 在 site-packages 中写入 maya_secure_system.py 文件
  • 在 userSetup.py 中注入恶意代码
  • 使用 network 模块封装 string 类型的节点

检测方法

  • 扫描所有 script 类型的节点
  • 检查 userSetup.py 文件内容
  • 使用正则表达式匹配病毒签名

测试结果

✅ 所有验证测试通过

  • 病毒签名定义正确
  • 签名检测功能正常
  • 疫苗类属性正确
  • 系统能正确发现疫苗

相关信息

  • 基于 origin/main 分支
  • 2 个提交
  • 216 行代码新增

- Create vaccine4.py to detect and clean maya_secure_system virus
- Add virus signatures for maya_secure_system detection
- Detect infected userSetup.py files
- Detect infected script nodes containing virus signatures
- Remove malicious maya_secure_system.py files
- Add test_vaccine4.py with pytest-compatible tests
- Add verify_vaccine4.py for standalone verification
- Test virus signature detection
- Test vaccine class properties
- Test vaccine discovery by system
- All tests pass successfully

if __name__ == "__main__":
sys.exit(main())

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line at end of file

test_signature_detection()
test_vaccine_class()
test_vaccine_discovery()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

print("=" * 60)
print("Verifying maya_secure_system vaccine (vaccine4)")
print("=" * 60)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

def test_vaccine_discovery():
"""Test that vaccine4 can be loaded by the system."""
from maya_umbrella.filesystem import get_vaccines

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

def test_vaccine_class():
"""Test that vaccine4 has the correct virus name."""
from maya_umbrella.vaccines.vaccine4 import Vaccine

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

from maya_umbrella.filesystem import check_virus_by_signature

print("Testing signature detection...")

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

"""Test that maya_secure_system virus signatures can detect infected code."""
from maya_umbrella.signatures import MAYA_SECURE_SYSTEM_VIRUS_SIGNATURES
from maya_umbrella.filesystem import check_virus_by_signature

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

def test_signatures():
"""Test that maya_secure_system virus signatures are properly defined."""
from maya_umbrella.signatures import MAYA_SECURE_SYSTEM_VIRUS_SIGNATURES

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

# Add the project root to the path
sys.path.insert(0, os.path.dirname(__file__))

def test_signatures():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.25%. Comparing base (f4a4775) to head (88b2697).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
maya_umbrella/vaccines/vaccine4.py 68.75% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   68.98%   69.25%   +0.26%     
==========================================
  Files          15       16       +1     
  Lines         661      696      +35     
  Branches       70       78       +8     
==========================================
+ Hits          456      482      +26     
- Misses        186      194       +8     
- Partials       19       20       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add MockTranslator to mock translator dependency
- Add test for collect_issues with malicious files
- Add test for infected userSetup.py detection
- Add test for missing userSetup.py handling
- Add test for clean userSetup.py files
- Add test for both local and user script paths
- All 40 tests pass successfully
- Remove unused imports from test_vaccine4.py
- Fix continuation line indentation in test assertions
- Remove trailing blank lines from files
- Improve code formatting for PEP 8 compliance
- Add newline at end of vaccine4.py
- Add newline at end of test_vaccine4.py
- Fix binary operator line break in test assertions
assert len(api.malicious_files) == 2
assert (
maya_secure_system_py in api.malicious_files
or os.path.join(api.local_script_path, "maya_secure_system.py") in api.malicious_files
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line break before binary operator

- Project uses ruff for linting, not flake8
- Hound was causing false positives due to configuration mismatch
- Disabling Hound to maintain consistent code quality checks
- Windows Server 2019 has been retired as of 2025-06-30
- Update to windows-2022 (windows-latest) for continued support
- Resolves GitHub Actions deprecation warning
- Use collections.abc.Iterator instead of typing.Iterator
- Use tuple instead of Tuple for type hints
- Maintain compatibility with Python 2.7 and 3.6+
- verify_vaccine4.py was a temporary script used during development
- All verification is now covered by unit tests in tests/test_vaccine4.py
- Removes unnecessary file from repository
@loonghao loonghao merged commit 38ab951 into main Oct 17, 2025
9 checks passed
@loonghao loonghao deleted the feature/add-maya-secure-system-vaccine branch October 17, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants