import re


def rule(event):
    if all(
        [
            any(
                [
                    re.match(r"^.*\\\\.*\\.*$.*$", event.deep_get("CommandLine", default="")),
                    "\\Sysvol\\" in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    any(
                        [
                            any(
                                [
                                    event.deep_get("Image", default="").endswith("\\robocopy.exe"),
                                    event.deep_get("Image", default="").endswith("\\xcopy.exe"),
                                ]
                            ),
                            event.deep_get("OriginalFileName", default="")
                            in ["robocopy.exe", "XCOPY.EXE"],
                        ]
                    ),
                    all(
                        [
                            any(
                                [
                                    event.deep_get("Image", default="").endswith("\\cmd.exe"),
                                    event.deep_get("OriginalFileName", default="") == "Cmd.Exe",
                                ]
                            ),
                            "copy" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    all(
                        [
                            any(
                                [
                                    any(
                                        [
                                            "\\powershell_ise.exe"
                                            in event.deep_get("Image", default=""),
                                            "\\powershell.exe"
                                            in event.deep_get("Image", default=""),
                                            "\\pwsh.exe" in event.deep_get("Image", default=""),
                                        ]
                                    ),
                                    event.deep_get("OriginalFileName", default="")
                                    in ["powershell_ise.exe", "PowerShell.EXE", "pwsh.dll"],
                                ]
                            ),
                            any(
                                [
                                    "copy-item" in event.deep_get("CommandLine", default=""),
                                    "copy " in event.deep_get("CommandLine", default=""),
                                    "cpi " in event.deep_get("CommandLine", default=""),
                                    " cp " in event.deep_get("CommandLine", default=""),
                                    "move " in event.deep_get("CommandLine", default=""),
                                    " move-item" in event.deep_get("CommandLine", default=""),
                                    " mi " in event.deep_get("CommandLine", default=""),
                                    " mv " in event.deep_get("CommandLine", default=""),
                                ]
                            ),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
