loonghao / maya_umbrella

A better Autodesk Maya antivirus tool detects and removes malicious.
MIT License
62 stars 5 forks source link

scripts下的vaccine.py需要判断是文件还是文件夹 #21

Closed fyplclfkr closed 6 months ago

fyplclfkr commented 6 months ago

image 我们使用手动建立文件夹的方式来免疫病毒,这个工具扫描到后会报PermissionError // Error: line 0: PermissionError: file C:\maya_umbrella\scripts\maya_umbrella\filesystem.py line 39: [Errno 13] Permission denied: 'C:/Users/yuping.fan/Documents/maya/scripts\vaccine.py' // 判断一下是文件夹还是文件应该就能解决问题,不排除其他人或公司用类似的方法免疫病毒

Issues-translate-bot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: scripts. The vaccine.py under scripts needs to determine whether it is a file or a folder.

image We use manual creation of folders to immunize against viruses. This tool will report a PermissionError after scanning. // Error: line 0: PermissionError: file C:\maya_umbrella\scripts\maya_umbrella\filesystem.py line 39: [Errno 13] Permission denied: 'C:/Users/yuping.fan/Documents/maya/scripts\vaccine .py' // Determining whether it is a folder or a file should solve the problem. It is not ruled out that other people or companies can use similar methods to immunize against viruses

fyplclfkr commented 6 months ago
        """Collect all bad userSetup.py files related to the virus."""
        for usersetup_py in [
            os.path.join(self.api.local_script_path, "vaccine.py"),
            os.path.join(self.api.user_script_path, "vaccine.py"),
            os.path.join(self.api.local_script_path, "userSetup.py"),
            os.path.join(self.api.user_script_path, "userSetup.py"),
        ]:
            print(os.path.isfile(usersetup_py))
            if os.path.exists(usersetup_py):
                data = read_file(usersetup_py)
                if "petri_dish_path = cmds.internalVar(userAppDir=True) + 'scripts/userSetup.py" in data:
                    self.report_issue("vaccine.py")
                    self.api.add_bad_file(rename(usersetup_py))

                if (
                    "cmds.evalDeferred('leukocyte = vaccine.phage()')" in data
                    and "cmds.evalDeferred('leukocyte.occupation()')" in data
                ):
                    self.report_issue("userSetup.py")
                    self.api.add_bad_file(rename(usersetup_py))

vaccine.py这个其实不需要调用read_file,直接删除即可,我现在把列表里相关的两行删除后工作正常了,或者判断一下为文件夹的时候就不删除了

loonghao commented 6 months ago

@fyplclfkr 你能提供一个符合这个特征的userSetup.py给我么?我添加到代码的单元测试中

Issues-translate-bot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@fyplclfkr Can you provide me with a userSetup.py that meets this characteristic? I added to the unit test of the code

loonghao commented 6 months ago

@fyplclfkr 当前发布了新版本,可以解决这个问题 https://github.com/loonghao/maya_umbrella/releases/tag/v0.5.0

Issues-translate-bot commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@fyplclfkr A new version is currently released that can solve this problem https://github.com/loonghao/maya_umbrella/releases/tag/v0.5.0