moonstix

    OASIS STIX 2.1 cyber threat intelligence objects, bundles, and patterning for MoonBit

    stix
    stix2
    cti
    threat-intelligence
    bundle
    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    2 hours ago
    Downloads
    1

    #2200732518gjy/moonstix

    CompOp

    pub(all) enum CompOp {
    Eq
    Ne
    Gt
    Lt
    Ge
    Le
    } derive(Eq,
    Debug
    )

    Comparison operator in a STIX observation.

    ComparisonExpr

    pub(all) enum ComparisonExpr {
    Compare(ObjectPath, CompOp, PatternValue)
    In(ObjectPath, Array[PatternValue])
    Like(ObjectPath, String)
    Matches(ObjectPath, String)
    IsSubset(ObjectPath, String)
    IsSuperset(ObjectPath, String)
    Exists(ObjectPath)
    Not(ComparisonExpr)
    And(ComparisonExpr, ComparisonExpr)
    Or(ComparisonExpr, ComparisonExpr)
    } derive(Eq,
    Debug
    )

    Boolean comparison expression inside [...].

    Document

    pub(all) enum Document {
    Bundle(StixBundle)
    Object(StixObject)
    } derive(
    Debug
    )

    A document is either a bundle or a single object.

    FieldSpec

    pub(all) struct FieldSpec {
    name : String
    required : Bool
    shape : ValueShape
    } derive(Eq,
    Debug
    )

    One named property in a type table.

    Issue

    pub(all) struct Issue {
    code : String
    path : String
    message : String
    } derive(Eq,
    Debug
    )

    Diagnostic collected while parsing or validating STIX JSON.

    Issue::at

    fn Issue::at(self : Issue) -> String

    Issue::code_name

    fn Issue::code_name(self : Issue) -> String

    ObjectKind

    pub(all) enum ObjectKind {
    Sdo
    Sro
    Sco
    Meta
    Bundle
    Custom
    } derive(Eq,
    Debug
    )

    High-level STIX object family.

    ObjectPath

    pub(all) struct ObjectPath {
    object_type : String
    steps : Array[PathStep]
    } derive(Eq,
    Debug
    )

    type:property... path used by STIX patterning.

    PathStep

    pub(all) enum PathStep {
    Property(String)
    Index(Int)
    AnyIndex
    } derive(Eq,
    Debug
    )

    One step of an object path after the type name.

    PatternExpr

    pub(all) enum PatternExpr {
    Observation(ComparisonExpr)
    And(PatternExpr, PatternExpr)
    Or(PatternExpr, PatternExpr)
    FollowedBy(PatternExpr, PatternExpr)
    StartStop(PatternExpr, String, String)
    Within(PatternExpr, String)
    Repeats(PatternExpr, String)
    } derive(Eq,
    Debug
    )

    Observation expression tree, including qualifiers.

    PatternValue

    pub(all) enum PatternValue {
    String(String)
    Bool(Bool)
    Number(String)
    Timestamp(String)
    Null
    } derive(Eq,
    Debug
    )

    Constant on the right-hand side of a comparison.

    StixBundle

    pub(all) struct StixBundle {
    id : String
    objects : Array[StixObject]
    raw : Json
    } derive(
    Debug
    )

    Bundle of STIX objects.

    StixError

    pub(all) enum StixError {
    JsonSyntax(String)
    NotObject
    UnexpectedRoot(String)
    Pattern(String)
    } derive(Eq,
    Debug
    )

    Fatal document-level failure. Property problems are reported as Issue.

    StixError::message

    fn StixError::message(self : StixError) -> String

    StixId

    pub(all) struct StixId {
    type_name : String
    uuid : String
    text : String
    } derive(Eq,
    Debug
    )

    Parsed STIX identifier: <type>--<uuid>.

    StixObject

    pub(all) struct StixObject {
    stix_type : String
    id : String
    spec_version : String
    kind : ObjectKind
    properties : Map[String, Json]
    raw : Json
    } derive(
    Debug
    )

    One STIX object, including custom x-* types.

    Timestamp

    pub(all) struct Timestamp {
    year : Int
    month : Int
    day : Int
    hour : Int
    minute : Int
    second : Int
    fraction : String
    offset_minutes : Int
    text : String
    } derive(Eq,
    Debug
    )

    Parsed RFC 3339 timestamp used by STIX 2.1 datetime properties.

    Tok

    pub(all) enum Tok {
    Eof
    Ident(String)
    String(String)
    Number(String)
    Timestamp(String)
    LBrack
    RBrack
    LParen
    RParen
    Colon
    Dot
    Star
    Comma
    Eq
    Ne
    Gt
    Lt
    Ge
    Le
    } derive(Eq,
    Debug
    )

    Tokens produced by the STIX patterning lexer.

    TypeSpec

    pub(all) struct TypeSpec {
    type_name : String
    kind : ObjectKind
    fields : Array[FieldSpec]
    require_any : Array[String]
    } derive(Eq,
    Debug
    )

    Per-type property table used by the validator.

    ValueShape

    pub(all) enum ValueShape {
    String
    Boolean
    Integer
    NonNegativeInteger
    Timestamp
    Identifier
    IdentifierOf(String)
    StringList
    IdentifierList
    IdentifierListOf(String)
    OpenVocab(String)
    ClosedVocab(String)
    OpenVocabList(String)
    Hashes
    Dictionary
    ObjectList
    ExternalReferences
    KillChainPhases
    GranularMarkings
    Extensions
    Pattern
    HexBinary
    IPv4
    IPv6
    Mac
    Email
    Url
    Any
    } derive(Eq,
    Debug
    )

    Expected JSON shape of one property.

    common_relationship_types

    fn common_relationship_types() -> Array[String]

    Common STIX 2.1 relationship_type values.

    document_objects

    fn document_objects(doc : Document) -> Array[StixObject]

    id_type_matches

    fn id_type_matches(id : StixId, expected : String) -> Bool

    is_common_relationship_type

    fn is_common_relationship_type(name : String) -> Bool

    is_open_vocab_value

    fn is_open_vocab_value(value : String) -> Bool

    issue

    fn issue(code : String, path : String, message : String) -> Issue

    known_type_names

    fn known_type_names() -> Array[String]

    lookup_type_spec

    fn lookup_type_spec(type_name : String) -> TypeSpec?

    object_kind_of

    fn object_kind_of(type_name : String) -> ObjectKind

    parse_and_validate

    fn parse_and_validate(text : String) -> Result[(Document, Array[Issue]), StixError]

    Parse JSON and collect STIX validation issues.

    parse_document

    fn parse_document(text : String) -> Result[Document, StixError]

    parse_document_json

    fn parse_document_json(value : Json) -> Result[Document, StixError]

    parse_pattern

    fn parse_pattern(text : String) -> Result[PatternExpr, String]

    Parse a STIX 2.1 patterning expression.

    parse_stix_id

    fn parse_stix_id(text : String) -> Result[StixId, String]

    parse_timestamp

    fn parse_timestamp(text : String) -> Result[Timestamp, String]

    pattern_object_types

    fn pattern_object_types(expr : PatternExpr) -> Array[String]

    relationship_allowed

    fn relationship_allowed(source_type : String, rel : String, target_type : String) -> Bool

    Whether a (source type, relationship, target type) triple is in the built-in STIX 2.1 constraint table. "*" matches any type.

    stringify_document

    fn stringify_document(doc : Document) -> String

    timestamp_is_rfc3339

    fn timestamp_is_rfc3339(text : String) -> Bool

    valid_email

    fn valid_email(text : String) -> Bool

    valid_hex_binary

    fn valid_hex_binary(text : String) -> Bool

    valid_ipv4

    fn valid_ipv4(text : String) -> Bool

    valid_ipv6

    fn valid_ipv6(text : String) -> Bool

    valid_mac

    fn valid_mac(text : String) -> Bool

    valid_stix_type_name

    fn valid_stix_type_name(name : String) -> Bool

    valid_stix_uuid

    fn valid_stix_uuid(text : String) -> Bool

    valid_url

    fn valid_url(text : String) -> Bool

    validate_document

    fn validate_document(doc : Document) -> Array[Issue]

    validate_pattern_paths

    fn validate_pattern_paths(expr : PatternExpr) -> Array[Issue]

    vocab_contains

    fn vocab_contains(name : String, value : String) -> Bool

    vocab_values

    fn vocab_values(name : String) -> Array[String]

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io