def rule(event):
    if all(
        [
            event.deep_get("TargetFilename", default="").startswith("C:\\Users\\"),
            "\\AppData\\" in event.deep_get("TargetFilename", default=""),
            any(
                [
                    event.deep_get("TargetFilename", default="").endswith(".bat"),
                    event.deep_get("TargetFilename", default="").endswith(".cmd"),
                    event.deep_get("TargetFilename", default="").endswith(".cpl"),
                    event.deep_get("TargetFilename", default="").endswith(".dll"),
                    event.deep_get("TargetFilename", default="").endswith(".exe"),
                    event.deep_get("TargetFilename", default="").endswith(".hta"),
                    event.deep_get("TargetFilename", default="").endswith(".iso"),
                    event.deep_get("TargetFilename", default="").endswith(".lnk"),
                    event.deep_get("TargetFilename", default="").endswith(".msi"),
                    event.deep_get("TargetFilename", default="").endswith(".ps1"),
                    event.deep_get("TargetFilename", default="").endswith(".psm1"),
                    event.deep_get("TargetFilename", default="").endswith(".scr"),
                    event.deep_get("TargetFilename", default="").endswith(".vbe"),
                    event.deep_get("TargetFilename", default="").endswith(".vbs"),
                ]
            ),
            not all(
                [
                    event.deep_get("TargetFilename", default="").startswith("C:\\Users\\"),
                    any(
                        [
                            "\\AppData\\Local\\" in event.deep_get("TargetFilename", default=""),
                            "\\AppData\\LocalLow\\" in event.deep_get("TargetFilename", default=""),
                            "\\AppData\\Roaming\\" in event.deep_get("TargetFilename", default=""),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
