/*
   Odin by Brandefense - Monograph 28 / 30 YARA Artifact Suite
   Scope: Sanitized configuration, relay, and provisioning manifests for Artex (:8787/:8790/:443)
          and DarkSword (:443/:8888/:2000) regional C2 clusters.
   Classification: TLP:CLEAR
*/

rule ODIN_Artex_8787_8790_Relay_Listener_Config
{
    meta:
        author = "Odin by Brandefense"
        monograph = "28 / 30"
        classification = "TLP:CLEAR"
        description = "Matches Artex non-standard port 8787/8790 relay and beacon listener manifests"
    strings:
        $a1 = "ARTEX_RELAY" ascii
        $a2 = "artex_task" ascii nocase
        $p1 = "8787" ascii
        $p2 = "8790" ascii
        $u1 = "/api/artex/" ascii
    condition:
        filesize < 512KB and ($a1 or $a2) and ($p1 or $p2) and $u1
}

rule ODIN_Artex_TLS_Controller_Session_Manifest
{
    meta:
        author = "Odin by Brandefense"
        monograph = "28 / 30"
        classification = "TLP:CLEAR"
        description = "Matches Artex leased TLS controller sync and session headers"
    strings:
        $s1 = "/artex/v1/sync" ascii
        $s2 = "X-Artex-Session" ascii
        $c1 = "beacon_int" ascii nocase
        $c2 = "jitter_ms" ascii nocase
    condition:
        filesize < 512KB and $s1 and $s2 and ($c1 or $c2)
}

rule ODIN_DarkSword_MultiPort_Controller_Config
{
    meta:
        author = "Odin by Brandefense"
        monograph = "28 / 30"
        classification = "TLP:CLEAR"
        description = "Matches DarkSword primary (:443), relay (:8888), and module (:2000) controller configs"
    strings:
        $d1 = "X-DarkSword-ID" ascii
        $d2 = "/ds/v2/session" ascii
        $q1 = "/darksword/queue" ascii
        $q2 = "task_opcode" ascii nocase
        $m1 = "/ds/module/pull" ascii
        $m2 = "DarkSword-Node/" ascii
    condition:
        filesize < 512KB and (($d1 and $d2) or ($q1 and $q2) or ($m1 and $m2))
}

rule ODIN_Regional_C2_Cohosted_Staging_Panel_Manifest
{
    meta:
        author = "Odin by Brandefense"
        monograph = "28 / 30"
        classification = "TLP:CLEAR"
        description = "Matches regional C2 management panels or co-hosted staging manifests"
    strings:
        $h1 = "/api/syndicate/health" ascii
        $h2 = "X-Syndicate-Token" ascii
        $o1 = "artex_staging_root" ascii nocase
        $o2 = "cohosted_opendir" ascii nocase
    condition:
        filesize < 512KB and (($h1 and $h2) or ($o1 and $o2))
}
