def rule(event):
    if all(
        [
            event.deep_get("ParentImage", default="").endswith("\\onenote.exe"),
            any(
                [
                    any(
                        [
                            event.deep_get("OriginalFileName", default="")
                            in [
                                "bitsadmin.exe",
                                "CertOC.exe",
                                "CertUtil.exe",
                                "Cmd.Exe",
                                "CMSTP.EXE",
                                "cscript.exe",
                                "curl.exe",
                                "HH.exe",
                                "IEExec.exe",
                                "InstallUtil.exe",
                                "javaw.exe",
                                "Microsoft.Workflow.Compiler.exe",
                                "msdt.exe",
                                "MSHTA.EXE",
                                "msiexec.exe",
                                "Msxsl.exe",
                                "odbcconf.exe",
                                "pcalua.exe",
                                "PowerShell.EXE",
                                "RegAsm.exe",
                                "RegSvcs.exe",
                                "REGSVR32.exe",
                                "RUNDLL32.exe",
                                "schtasks.exe",
                                "ScriptRunner.exe",
                                "wmic.exe",
                                "WorkFolders.exe",
                                "wscript.exe",
                            ],
                            any(
                                [
                                    event.deep_get("Image", default="").endswith("\\AppVLP.exe"),
                                    event.deep_get("Image", default="").endswith("\\bash.exe"),
                                    event.deep_get("Image", default="").endswith("\\bitsadmin.exe"),
                                    event.deep_get("Image", default="").endswith("\\certoc.exe"),
                                    event.deep_get("Image", default="").endswith("\\certutil.exe"),
                                    event.deep_get("Image", default="").endswith("\\cmd.exe"),
                                    event.deep_get("Image", default="").endswith("\\cmstp.exe"),
                                    event.deep_get("Image", default="").endswith("\\control.exe"),
                                    event.deep_get("Image", default="").endswith("\\cscript.exe"),
                                    event.deep_get("Image", default="").endswith("\\curl.exe"),
                                    event.deep_get("Image", default="").endswith("\\forfiles.exe"),
                                    event.deep_get("Image", default="").endswith("\\hh.exe"),
                                    event.deep_get("Image", default="").endswith("\\ieexec.exe"),
                                    event.deep_get("Image", default="").endswith(
                                        "\\installutil.exe"
                                    ),
                                    event.deep_get("Image", default="").endswith("\\javaw.exe"),
                                    event.deep_get("Image", default="").endswith("\\mftrace.exe"),
                                    event.deep_get("Image", default="").endswith(
                                        "\\Microsoft.Workflow.Compiler.exe"
                                    ),
                                    event.deep_get("Image", default="").endswith("\\msbuild.exe"),
                                    event.deep_get("Image", default="").endswith("\\msdt.exe"),
                                    event.deep_get("Image", default="").endswith("\\mshta.exe"),
                                    event.deep_get("Image", default="").endswith("\\msidb.exe"),
                                    event.deep_get("Image", default="").endswith("\\msiexec.exe"),
                                    event.deep_get("Image", default="").endswith("\\msxsl.exe"),
                                    event.deep_get("Image", default="").endswith("\\odbcconf.exe"),
                                    event.deep_get("Image", default="").endswith("\\pcalua.exe"),
                                    event.deep_get("Image", default="").endswith(
                                        "\\powershell.exe"
                                    ),
                                    event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                                    event.deep_get("Image", default="").endswith("\\regasm.exe"),
                                    event.deep_get("Image", default="").endswith("\\regsvcs.exe"),
                                    event.deep_get("Image", default="").endswith("\\regsvr32.exe"),
                                    event.deep_get("Image", default="").endswith("\\rundll32.exe"),
                                    event.deep_get("Image", default="").endswith("\\schtasks.exe"),
                                    event.deep_get("Image", default="").endswith("\\scrcons.exe"),
                                    event.deep_get("Image", default="").endswith(
                                        "\\scriptrunner.exe"
                                    ),
                                    event.deep_get("Image", default="").endswith("\\sh.exe"),
                                    event.deep_get("Image", default="").endswith("\\svchost.exe"),
                                    event.deep_get("Image", default="").endswith("\\verclsid.exe"),
                                    event.deep_get("Image", default="").endswith("\\wmic.exe"),
                                    event.deep_get("Image", default="").endswith(
                                        "\\workfolders.exe"
                                    ),
                                    event.deep_get("Image", default="").endswith("\\wscript.exe"),
                                ]
                            ),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("Image", default="").endswith("\\explorer.exe"),
                            any(
                                [
                                    ".hta" in event.deep_get("CommandLine", default=""),
                                    ".vb" in event.deep_get("CommandLine", default=""),
                                    ".wsh" in event.deep_get("CommandLine", default=""),
                                    ".js" in event.deep_get("CommandLine", default=""),
                                    ".ps" in event.deep_get("CommandLine", default=""),
                                    ".scr" in event.deep_get("CommandLine", default=""),
                                    ".pif" in event.deep_get("CommandLine", default=""),
                                    ".bat" in event.deep_get("CommandLine", default=""),
                                    ".cmd" in event.deep_get("CommandLine", default=""),
                                ]
                            ),
                        ]
                    ),
                    any(
                        [
                            "\\AppData\\" in event.deep_get("Image", default=""),
                            "\\Users\\Public\\" in event.deep_get("Image", default=""),
                            "\\ProgramData\\" in event.deep_get("Image", default=""),
                            "\\Windows\\Tasks\\" in event.deep_get("Image", default=""),
                            "\\Windows\\Temp\\" in event.deep_get("Image", default=""),
                            "\\Windows\\System32\\Tasks\\" in event.deep_get("Image", default=""),
                        ]
                    ),
                ]
            ),
            not any(
                [
                    all(
                        [
                            event.deep_get("Image", default="").endswith(
                                "\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe"
                            ),
                            event.deep_get("CommandLine", default="").endswith("-Embedding"),
                        ]
                    ),
                    all(
                        [
                            "\\AppData\\Local\\Microsoft\\OneDrive\\"
                            in event.deep_get("Image", default=""),
                            event.deep_get("Image", default="").endswith("\\FileCoAuth.exe"),
                            event.deep_get("CommandLine", default="").endswith("-Embedding"),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
