Skip to content

Rebuild with clean interfaces and java objects #14

Open

Description

@StephenOTT

Hey everyone

still a work in progress but wanted to share WIP:

https://github.com/StephenOTT/charon-stix/tree/master/src/main/java/io/digitalstate/stix/sdo

I have re-built/re-implemented all of the STIX objects with clean interfaces, attributes, etc, same for the Vocabs, most of the Types, and next will be adding the relationships and validator support.

Goal was a very clear implementation of STIXX in Java so it can be easily reused.

Enjoy

Activity

  1. StephenOTT commented on Nov 20, 2018

    @StephenOTT
    Author

    Java to Json conversions and mappings of all Object types has been completed.
    SDOs, Data Markings, Cyber Observable Objects, Vocabs, Bundle, specific STIX datatypes, etc.

    some examples of current work:

    AttackPattern attackPattern = new AttackPattern("some pattern");
    attackPattern.setKillChainPhases(
            new KillChainPhase("Chain1", "phase1"),
            new KillChainPhase("Chain1", "phase2"));
    
    attackPattern.setModified(attackPattern.getCreated().plusDays(3));
    
    MarkingDefinition markingDefinition = new MarkingDefinition(
            new TlpMarking("white"));
    
    attackPattern.addObjectMarkingRefs(markingDefinition);
    
    MarkingDefinition statement1 = new MarkingDefinition(
            new StatementMarking("Internal review of data allows for sharing as per ABC-009 Standard"));
    
    markingDefinition.addObjectMarkingRefs(statement1);
    
    ZonedDateTime observedTime = ZonedDateTime.now();
    ObservedData observedData = new ObservedData(observedTime, observedTime, 3,
            new Artifact(){{
                setUrl("someURL");
            }},
            new AutonomousSystem(3){{
                setRir("someRIR");
            }});
    observedData.addObjectMarkingRefs(statement1);
    
    Bundle bundle = new Bundle(attackPattern);
    
    bundle.addObjects(observedData);
    
    bundle.autoAddDataMarkingsToBundle();
    
    bundle.toJsonString();

    which will convert to:

    {
      "type": "bundle",
      "id": "bundle--0fcdfa2c-18e0-4f43-8083-b2c3db71ee1d",
      "objects": [
        {
          "type": "attack-pattern",
          "id": "attack-pattern--3bd7d7a8-a8cf-43d2-b7d2-2c18143aa690",
          "created": "2018-11-20T12:34:42.887-0500",
          "modified": "2018-11-23T12:34:42.887-0500",
          "revoked": false,
          "name": "some pattern",
          "kill_chain_phases": [
            {
              "kill_chain_name": "Chain1",
              "phase_name": "phase1"
            },
            {
              "kill_chain_name": "Chain1",
              "phase_name": "phase2"
            }
          ],
          "object_marking_refs": [
            "marking-definition--18dc13e0-a509-4766-a6b7-8f6422f410d7"
          ]
        },
        {
          "type": "observed-data",
          "id": "observed-data--811ef6c8-4c1d-4d1c-a0db-a6f5f0d5834d",
          "created": "2018-11-20T12:34:42.929-0500",
          "modified": "2018-11-20T12:34:42.929-0500",
          "revoked": false,
          "objects": [
            {
              "type": "artifact",
              "url": "someURL"
            },
            {
              "type": "autonomous-system",
              "number": 3,
              "rir": "someRIR"
            }
          ],
          "first_observed": "2018-11-20T12:34:42.918-0500",
          "last_observed": "2018-11-20T12:34:42.918-0500",
          "number_observed": 3,
          "object_marking_refs": [
            "marking-definition--2f6f7e50-ec7c-41c6-82de-28dc87878938"
          ]
        },
        {
          "type": "marking-definition",
          "id": "marking-definition--18dc13e0-a509-4766-a6b7-8f6422f410d7",
          "created": "2018-11-20T12:34:42.916-0500",
          "definition": {
            "tlp": "white"
          },
          "definition_type": "tlp",
          "object_marking_refs": [
            "marking-definition--2f6f7e50-ec7c-41c6-82de-28dc87878938"
          ]
        },
        {
          "type": "marking-definition",
          "id": "marking-definition--2f6f7e50-ec7c-41c6-82de-28dc87878938",
          "created": "2018-11-20T12:34:42.918-0500",
          "definition": {
            "statement": "Internal review of data allows for sharing as per ABC-009 Standard"
          },
          "definition_type": "statement"
        }
      ],
      "spec_version": "2.0"
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions