dataset = xdr_data | filter event_type = ENUM.PROCESS and event_sub_type = ENUM.PROCESS_START | filter (lowercase(actor_process_image_name) ~= "^(php-fpm|php-cgi|lsphp)[0-9.]*(.exe)?$" or lowercase(actor_process_image_name) in ("frankenphp", "apache2", "httpd", "httpd.exe")) and (lowercase(action_process_image_name) in ("sh", "bash", "dash", "zsh", "ksh", "busybox", "curl", "wget", "nc", "ncat", "netcat", "socat", "perl", "ruby", "cmd.exe", "powershell.exe", "pwsh.exe", "certutil.exe", "bitsadmin.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "wscript.exe", "cscript.exe") or lowercase(action_process_image_name) ~= "^python[0-9.]*$") and not (lowercase(action_process_image_command_line) contains "sendmail" or lowercase(action_process_image_command_line) contains "msmtp" or lowercase(action_process_image_command_line) contains "exim" or lowercase(action_process_image_command_line) contains "postdrop" or lowercase(action_process_image_command_line) contains "rotatelogs" or lowercase(action_process_image_command_line) contains "cronolog") | fields _time, agent_hostname, actor_effective_username, action_process_image_name, action_process_image_command_line, actor_process_image_name, causality_actor_process_image_name | sort desc _time