/*
   Odin by Brandefense - Report #22 YARA Implant, Extender & Staging Suite
   Classification: TLP:CLEAR
   Scope: SuperShell rssh implants/configs, AdaptixC2 Extender/Beacon manifests,
          MITRE Caldera Sandcat/Manx stagers, and Pyramid signed-Python memory loaders.
*/

rule ODIN_SuperShell_RSSH_Implant_And_Console
{
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-19"
        tlp = "CLEAR"
        description = "Detects SuperShell containerized web console artifacts and compiled rssh reverse-SSH implants"
    strings:
        $s1 = "tdragon6/supershell" ascii nocase
        $s2 = "/supershell/login" ascii nocase
        $s3 = "SSH-2.0-rssh" ascii
        $s4 = "compile_client" ascii
        $s5 = ":3232" ascii
    condition:
        filesize < 25MB and (2 of ($s1, $s2, $s3, $s4)) and ($s3 or $s5 or $s1)
}

rule ODIN_AdaptixC2_Extender_And_Beacon_Config
{
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-19"
        tlp = "CLEAR"
        description = "Detects AdaptixC2 teamserver JSON profiles, ExtenderListener/ExtenderAgent plugins, and AxScript BOF tasking"
    strings:
        $a1 = "AdaptixC2" ascii nocase
        $a2 = "ExtenderListener" ascii
        $a3 = "ExtenderAgent" ascii
        $a4 = "AxScript" ascii
        $a5 = "execute bof" ascii nocase
    condition:
        filesize < 15MB and 3 of ($a*)
}

rule ODIN_Caldera_Sandcat_And_Manx_Agent
{
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-19"
        tlp = "CLEAR"
        description = "Detects MITRE Caldera Sandcat (54ndc47) and Manx agent binaries or dynamic delivery headers"
    strings:
        $c1 = "sandcat.go" ascii nocase
        $c2 = "54ndc47" ascii
        $c3 = "/file/download" ascii
        $c4 = "contact_http" ascii
        $c5 = "listenP2P" ascii
    condition:
        filesize < 20MB and 3 of ($c*)
}

rule ODIN_PyramidC2_Python_InMemory_Stager
{
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-19"
        tlp = "CLEAR"
        description = "Detects Pyramid Living-off-the-Blindspot Python memory-import stagers and PythonMemoryModule loaders"
    strings:
        $p1 = "PythonMemoryModule" ascii
        $p2 = "zipimport" ascii
        $p3 = "urllib.request" ascii
        $p4 = "VirtualAlloc" ascii
        $p5 = "BG_LOAD" ascii
    condition:
        filesize < 5MB and ($p1 or $p5) and 2 of ($p2, $p3, $p4)
}
