import re


def rule(event):
    if all(
        [
            event.deep_get("TargetFilename", default="").startswith("C:\\Windows\\Temp\\"),
            any(
                [
                    any(
                        [
                            event.deep_get("TargetFilename", default="").endswith("\\temp.ps1"),
                            event.deep_get("TargetFilename", default="").endswith("\\msol.ps1"),
                        ]
                    ),
                    any(
                        [
                            re.match(
                                r"\\\\[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.txt$",
                                event.deep_get("TargetFilename", default=""),
                            ),
                            re.match(
                                r"\\\\[a-zA-Z]{8}\\.tmp$",
                                event.deep_get("TargetFilename", default=""),
                            ),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
