Skip to content

uw-dims/stix-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README file for stix-java, Stuart Maclean, Sep 2014

A Java binding to Mitre's STIX xsd file set. See http://stix.mitre.org.

The goal is to generate Java bindings to the .xsd files with a minimum of 'locally added' logic. We made zero edits to any xsd files. We preserve package names, etc. Where we simply MUST make decisions locally, essentially to resolve name clashes, we use a .xjb file as standard for xjc.

To answer the question 'Are these bindings any good?', we try to assert Yes by consuming into a Java program a series of 33 sample STIX documents. See the test cases here and the sample documents here. Most samples were obtained from Mitre.

PRE-REQUISITES

This codebase is Java, and so needs a Java compiler system, aka a 'Java Developmment Kit (JDK)'. A 1.6 or later JDK is required.

The build is via Maven, a build and project management tool for Java artifacts. So Maven is required too. All code dependencies are resolved by Maven. The author uses Maven 2.2.1 on Ubuntu 12.04 LTS.

INSTALLATION

Currently this codebase is organised as four Maven 'modules', with a parent pom at the root level.

  • Module 1: the jaxb bindings. Java classes auto-generated from .xsd file set via xjc. xjc is bundled with recent JDK releases (1.6+). This module includes some sample STIX documents (from Mitre and elsewhere). See under jaxb/src/test/resources.

Getting the xsd file set to build took some work. See ./jaxb/README.md for more details.

  • Module 2: utils. Example routines for document authoring (writing) and document ingesting (reading). Authoring utilities are at HashComposers. Ingest utilities are at HashExtractors.

  • Module 3: cli. Command line driver tools for invoking the utilities above. For authoring, see MD5Composer. For ingesting, see MD5Extractor.

  • Module 4: json. Experimenting whether STIX Java objects can be represented as JSON. The basic answer is no, at least for the complex STIX instance documents cited above. See the json sources and json test case for more details.

To build:

$ cd stix-java

$ mvn install

To then try out a bundled command line interface (cli) tool:

$ cd stix-java/cli

$ ./stix.md5 ../jaxb/src/test/resources/APT1/Appendix_G_IOCs_Full.xml

The tool simply loads the supplied file and extracts any md5 hashes found in Indicators and/or Observables. It should print a list of 1797 md5 hashes to stdout. The stix.md5 file is a simple bash script driving the JVM invocation of the appropriate class.

Observation: This whole jaxb lark is way too complicated. Just use grep!

eof

About

Java bindings and support tools for the manipulation of Mitre's STIX language (https://stix.mitre.org)

Resources

License

Stars

Watchers

Forks

Packages

No packages published