def rule(event):
    if all(
        [
            "new-object" in event.deep_get("Payload", default=""),
            "text.encoding]::ascii" in event.deep_get("Payload", default=""),
            any(
                [
                    "system.io.compression.deflatestream" in event.deep_get("Payload", default=""),
                    "system.io.streamreader" in event.deep_get("Payload", default=""),
                ]
            ),
            event.deep_get("Payload", default="").endswith("readtoend"),
        ]
    ):
        return True
    return False
