import re


def rule(event):
    if all(
        [
            "ProviderName=WSMan" in event.deep_get("Data", default=""),
            not any(
                [
                    any(
                        [
                            "HostApplication=powershell" in event.deep_get("Data", default=""),
                            "HostApplication=C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell"
                            in event.deep_get("Data", default=""),
                            "HostApplication=C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell"
                            in event.deep_get("Data", default=""),
                            "HostApplication=C:/Windows/System32/WindowsPowerShell/v1.0/powershell"
                            in event.deep_get("Data", default=""),
                            "HostApplication=C:/Windows/SysWOW64/WindowsPowerShell/v1.0/powershell"
                            in event.deep_get("Data", default=""),
                        ]
                    ),
                    re.match(
                        r"HostId=[a-zA-Z0-9-]{36}\\s+EngineVersion=",
                        event.deep_get("Data", default=""),
                    ),
                ]
            ),
            not "HostApplication=C:\\Hexnode\\Hexnode Agent\\Current\\HexnodeAgent.exe"
            in event.deep_get("Data", default=""),
        ]
    ):
        return True
    return False
