/*
   Odin by Brandefense - Monograph 23 / 30 YARA Artifact Suite
   Scope: Configuration, relay, and workbench artifacts for JavaChains,
          p2s-pure Packet-to-Shell, Termirror QUIC-over-ICMP, and RuoYi SnakeYAML SPI.
   Classification: TLP:CLEAR
*/

rule ODIN_JavaChains_Deserialization_Controller_Config
{
    meta:
        author = "Odin by Brandefense"
        monograph = "23 / 30"
        classification = "TLP:CLEAR"
        description = "Matches JavaChains JNDI/LDAP/RMI/Hessian/JDBC weaponizer configuration manifests"
    strings:
        $jc1 = "javachains" ascii nocase
        $jc2 = "JavaChains" ascii
        $pt1 = "8011" ascii
        $pt2 = "8012" ascii
        $gd1 = "Hessian" ascii nocase
        $gd2 = "jndi" ascii nocase
    condition:
        filesize < 512KB and ($jc1 or $jc2) and ($pt1 or $pt2) and ($gd1 or $gd2)
}

rule ODIN_P2S_Pure_PacketToShell_Workbench_Manifest
{
    meta:
        author = "Odin by Brandefense"
        monograph = "23 / 30"
        classification = "TLP:CLEAR"
        description = "Matches p2s-pure Packet-to-Shell orchestration scripts and reverse listener logs"
    strings:
        $p1 = "p2s-pure" ascii
        $p2 = "p2s-remote" ascii
        $l1 = "rev_lst.log" ascii
        $l2 = "oob.log" ascii
        $n1 = "libAesJni.so" ascii
        $n2 = "leak.resp" ascii
    condition:
        filesize < 512KB and ($p1 or $p2) and ($l1 or $l2) and ($n1 or $n2)
}

rule ODIN_Termirror_Covert_ICMP_QUIC_Relay_Script
{
    meta:
        author = "Odin by Brandefense"
        monograph = "23 / 30"
        classification = "TLP:CLEAR"
        description = "Matches Termirror QUIC-over-ICMP automation scripts and TCP-to-UDP relay wrappers"
    strings:
        $t1 = "TERMIRROR_QUIC_TRANSPORT=icmp" ascii
        $t2 = "TERMIRROR_QUIC_DIRECT=1" ascii
        $q1 = "quic-exec" ascii
        $u1 = "17444" ascii
        $u2 = "7443" ascii
    condition:
        filesize < 512KB and (($t1 and $q1) or ($t2 and $q1) or ($u1 and $u2 and $q1))
}

rule ODIN_RuoYi_SnakeYAML_SPI_Gadget_Manifest
{
    meta:
        author = "Odin by Brandefense"
        monograph = "23 / 30"
        classification = "TLP:CLEAR"
        description = "Matches RuoYi and Spring SnakeYAML ScriptEngineManager SPI gadget builder artifacts"
    strings:
        $s1 = "javax.script.ScriptEngineManager" ascii
        $s2 = "META-INF/services/javax.script.ScriptEngineFactory" ascii
        $u1 = "java.net.URLClassLoader" ascii
        $r1 = "org.yaml.snakeyaml.Yaml" ascii
        $r2 = "yaml-payload-for-ruoyi" ascii nocase
    condition:
        filesize < 512KB and ($s1 or $s2) and ($u1 or $r1 or $r2)
}
