diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 3f5987de7e4d49d21da6bdbfbcefc71122da2891..da1cd90931f32e775d44ecbda911421c7ecedbdc --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,11 @@ !/bindings/java/nbproject/project.xml !/bindings/java/nbproject/project.properties +# CASE-UCO build and release folder +/case-uco/java/build/ +/case-uco/java/dist/ +/case-uco/java/nbproject/private/ + # Windows build folders /win32/Debug_NoLibs/ /win32/*/Debug_NoLibs/ @@ -183,4 +188,4 @@ unit_tests/base/test_base #Test data folder -tests/data +tests/data \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 9fc3414ceda99605eda9e9263e97c84c96aa938c..dd6d057d4a4803bd63a7c5ec8a99c6c9f28c96a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,6 +65,7 @@ script: - javac -version - ./bootstrap && ./configure --prefix=/usr && make - pushd bindings/java/ && ant -q dist && popd + - pushd case-uco/java/ && ant -q && popd - make check && if [ -f "tests/test-suite.log" ];then cat tests/test-suite.log; fi ; if [ -f "unit_tests/base/test-suite.log" ];then cat unit_tests/base/test-suite.log; fi - if test ${TRAVIS_OS_NAME} = "linux"; then pushd release && ./release-unix.pl ci && popd; diff --git a/Makefile.am b/Makefile.am index bc377efc069939e44537fdf9f6c0bd2e5afbf28a..77531b3e1cd8ca02249d1472996a74f7b3aa7a0a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,11 @@ EXTRA_DIST = README_win32.txt README.md INSTALL.txt ChangeLog.txt NEWS.txt API-C bindings/java/src/org/sleuthkit/datamodel/blackboardutils/*.java \ bindings/java/src/org/sleuthkit/datamodel/blackboardutils/attributes/*.java \ bindings/java/src/org/sleuthkit/datamodel/Examples/*.java \ - bindings/java/src/*.html + bindings/java/src/*.html \ + case-uco/java/*.xml \ + case-uco/java/nbproject/*.xml \ + case-uco/java/nbproject/*.properties \ + case-uco/java/src/org/sleuthkit/caseuco/*.java ACLOCAL_AMFLAGS = -I m4 @@ -34,11 +38,13 @@ endif # Compile java bindings if all of the dependencies existed if X_JNI JAVA_BINDINGS=bindings/java + JAVA_CASEUCO=case-uco/java else JAVA_BINDINGS= + JAVA_CASEUCO= endif -SUBDIRS = tsk tools tests samples man $(UNIT_TESTS) $(JAVA_BINDINGS) +SUBDIRS = tsk tools tests samples man $(UNIT_TESTS) $(JAVA_BINDINGS) $(JAVA_CASEUCO) nobase_include_HEADERS = tsk/libtsk.h tsk/tsk_incs.h \ tsk/base/tsk_base.h tsk/base/tsk_os.h \ diff --git a/appveyor.yml b/appveyor.yml index 387db669d5231616393f27a27029ef7bc522d63a..3990c1b11a626116d2482b27add92c67a59cba14 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -34,5 +34,8 @@ build_script: - ps: pushd bindings/java - cmd: ant -q dist - ps: popd + - ps: pushd case-uco/java + - cmd: ant -q + - ps: popd test: off diff --git a/case-uco/java/Makefile.am b/case-uco/java/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..b3f2439ac9de0ada13f9b270c3e1a427c063f98c --- /dev/null +++ b/case-uco/java/Makefile.am @@ -0,0 +1,20 @@ +tsk_caseuco_jar = $(top_builddir)/case-uco/java/dist/sleuthkit-caseuco-$(PACKAGE_VERSION).jar +jardir = $(prefix)/share/java +jar_DATA = $(tsk_caseuco_jar) + +if OFFLINE + ant_args=-Doffline=true +else + +endif + + +$(tsk_caseuco_jar): + +all-local: + ant $(ant_args) + +CLEANFILES = $(tsk_caseuco_jar) + +clean-local: + ant clean diff --git a/case-uco/java/build.xml b/case-uco/java/build.xml new file mode 100755 index 0000000000000000000000000000000000000000..f73bb0a4094a866318eea8267614f45d5adcb2bd --- /dev/null +++ b/case-uco/java/build.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:ivy="antlib:org.apache.ivy.ant" name="SleuthkitCaseUco" default="default" basedir="." > + <description>Builds, tests, and runs the project SleuthkitCaseUco.</description> + <import file="nbproject/build-impl.xml"/> + <include file="../../bindings/java/build.xml" as="datamodel"/> + + <!-- Hook into the compilation phase of the build process to ensure compile + time dependencies are present --> + <target name="-pre-compile" depends="get-ivy-dependencies, copy-sleuthkit-java-bindings-jar" + description="Resolves ivy dependencies before compilation"> + </target> + + <!-- Hook into the clean phase of the build process to ensure the lib + folder is being cleared. --> + <target name="-post-clean"> + <delete dir="lib" /> + </target> + + <!-- Copy the sleuthkit jar into lib --> + <target name="copy-sleuthkit-java-bindings-jar"> + <!-- VERSION here is being sourced from the build.xml in DataModel, which + is actively maintained with the current TSK version --> + <copy file="../../bindings/java/dist/sleuthkit-${VERSION}.jar" + tofile="lib\sleuthkit-${VERSION}.jar"/> + </target> + + <!-- Ivy related boilerplate --> + <property name="ivy.install.version" value="2.3.0-rc2"/> + <condition property="ivy.home" value="${env.IVY_HOME}"> + <isset property="env.IVY_HOME"/> + </condition> + <property name="ivy.home" value="${user.home}/.ant"/> + <property name="ivy.jar.dir" value="${ivy.home}/lib"/> + <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/> + + <target name="download-ivy" unless="offline"> + <available file="${ivy.jar.file}" property="ivy.available"/> + <antcall target="-download-ivy"/> + </target> + + <target name="-download-ivy" unless="ivy.available"> + <mkdir dir="${ivy.jar.dir}"/> + <get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/> + </target> + + <target name="init-ivy" depends="download-ivy" unless="ivy.lib.path"> + <path id="ivy.lib.path"> + <fileset dir="${ivy.jar.dir}" includes="*.jar"/> + </path> + <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> + </target> + + <target name="get-ivy-dependencies" description="retrieve jar dependencies using ivy" depends="init-ivy" unless="offline"> + <ivy:settings file="ivysettings.xml"/> + <ivy:resolve/> + <ivy:retrieve sync="true" pattern="lib/[artifact]-[revision](-[classifier]).[ext]"/> + </target> +</project> diff --git a/case-uco/java/ivy.xml b/case-uco/java/ivy.xml new file mode 100755 index 0000000000000000000000000000000000000000..965825449307ec99ab8f2e7ba717e707b861fae5 --- /dev/null +++ b/case-uco/java/ivy.xml @@ -0,0 +1,7 @@ +<ivy-module version="2.0"> + <info organisation="org.sleuthkit" module="SleuthkitCaseUco"/> + <dependencies> + <dependency org="com.google.code.gson" name="gson" rev="2.8.5"/> + </dependencies> +</ivy-module> + diff --git a/case-uco/java/ivysettings.xml b/case-uco/java/ivysettings.xml new file mode 100755 index 0000000000000000000000000000000000000000..002a6a53cf8facf9ff9c5220fb06db2245dd96df --- /dev/null +++ b/case-uco/java/ivysettings.xml @@ -0,0 +1,9 @@ +<ivysettings> + <settings defaultResolver="default"/> + <resolvers> + <chain name="default"> + <ibiblio name="central" root="https://repo1.maven.org/maven2" m2compatible="true"/> + <ibiblio name="ibiblio" m2compatible="true"/> + </chain> + </resolvers> +</ivysettings> diff --git a/case-uco/java/manifest.mf b/case-uco/java/manifest.mf new file mode 100755 index 0000000000000000000000000000000000000000..2f4b56835b31b2d541d1edbb0aee718d72852d0e --- /dev/null +++ b/case-uco/java/manifest.mf @@ -0,0 +1 @@ +Manifest-Version: 1.0 diff --git a/case-uco/java/nbproject/build-impl.xml b/case-uco/java/nbproject/build-impl.xml new file mode 100755 index 0000000000000000000000000000000000000000..92ae884c824b551c61b0e59eaed2cb4fbe15d676 --- /dev/null +++ b/case-uco/java/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +*** GENERATED FROM project.xml - DO NOT EDIT *** +*** EDIT ../build.xml INSTEAD *** + +For the purpose of easier reading the script +is divided into following sections: + + - initialization + - compilation + - jar + - execution + - debugging + - javadoc + - test compilation + - test execution + - test debugging + - applet + - cleanup + + --> +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="SleuthkitCaseUco-impl"> + <fail message="Please build using Ant 1.8.0 or higher."> + <condition> + <not> + <antversion atleast="1.8.0"/> + </not> + </condition> + </fail> + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> + <!-- + ====================== + INITIALIZATION SECTION + ====================== + --> + <target name="-pre-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="-pre-init" name="-init-private"> + <property file="nbproject/private/config.properties"/> + <property file="nbproject/private/configs/${config}.properties"/> + <property file="nbproject/private/private.properties"/> + </target> + <target depends="-pre-init,-init-private" name="-init-user"> + <property file="${user.properties.file}"/> + <!-- The two properties below are usually overridden --> + <!-- by the active platform. Just a fallback. --> + <property name="default.javac.source" value="1.6"/> + <property name="default.javac.target" value="1.6"/> + </target> + <target depends="-pre-init,-init-private,-init-user" name="-init-project"> + <property file="nbproject/configs/${config}.properties"/> + <property file="nbproject/project.properties"/> + </target> + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> + <property name="platform.java" value="${java.home}/bin/java"/> + <available file="${manifest.file}" property="manifest.available"/> + <condition property="splashscreen.available"> + <and> + <not> + <equals arg1="${application.splash}" arg2="" trim="true"/> + </not> + <available file="${application.splash}"/> + </and> + </condition> + <condition property="main.class.available"> + <and> + <isset property="main.class"/> + <not> + <equals arg1="${main.class}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition property="profile.available"> + <and> + <isset property="javac.profile"/> + <length length="0" string="${javac.profile}" when="greater"/> + <matches pattern="((1\.[89])|9)(\..*)?" string="${javac.source}"/> + </and> + </condition> + <condition property="do.archive"> + <or> + <not> + <istrue value="${jar.archive.disabled}"/> + </not> + <istrue value="${not.archive.disabled}"/> + </or> + </condition> + <condition property="do.mkdist"> + <and> + <isset property="do.archive"/> + <isset property="libs.CopyLibs.classpath"/> + <not> + <istrue value="${mkdist.disabled}"/> + </not> + </and> + </condition> + <condition property="do.archive+manifest.available"> + <and> + <isset property="manifest.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+main.class.available"> + <and> + <isset property="main.class.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+splashscreen.available"> + <and> + <isset property="splashscreen.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+profile.available"> + <and> + <isset property="profile.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="have.tests"> + <or> + <available file="${test.src.dir}"/> + </or> + </condition> + <condition property="have.sources"> + <or> + <available file="${src.dir}"/> + </or> + </condition> + <condition property="netbeans.home+have.tests"> + <and> + <isset property="netbeans.home"/> + <isset property="have.tests"/> + </and> + </condition> + <condition property="no.javadoc.preview"> + <and> + <isset property="javadoc.preview"/> + <isfalse value="${javadoc.preview}"/> + </and> + </condition> + <property name="run.jvmargs" value=""/> + <property name="run.jvmargs.ide" value=""/> + <property name="javac.compilerargs" value=""/> + <property name="work.dir" value="${basedir}"/> + <condition property="no.deps"> + <and> + <istrue value="${no.dependencies}"/> + </and> + </condition> + <property name="javac.debug" value="true"/> + <property name="javadoc.preview" value="true"/> + <property name="application.args" value=""/> + <property name="source.encoding" value="${file.encoding}"/> + <property name="runtime.encoding" value="${source.encoding}"/> + <property name="manifest.encoding" value="${source.encoding}"/> + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> + <and> + <isset property="javadoc.encoding"/> + <not> + <equals arg1="${javadoc.encoding}" arg2=""/> + </not> + </and> + </condition> + <property name="javadoc.encoding.used" value="${source.encoding}"/> + <property name="includes" value="**"/> + <property name="excludes" value=""/> + <property name="do.depend" value="false"/> + <condition property="do.depend.true"> + <istrue value="${do.depend}"/> + </condition> + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> + <and> + <isset property="endorsed.classpath"/> + <not> + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> + <isset property="profile.available"/> + </condition> + <condition else="false" property="jdkBug6558476"> + <and> + <matches pattern="1\.[56]" string="${java.specification.version}"/> + <not> + <os family="unix"/> + </not> + </and> + </condition> + <condition else="false" property="javac.fork"> + <or> + <istrue value="${jdkBug6558476}"/> + <istrue value="${javac.external.vm}"/> + </or> + </condition> + <property name="jar.index" value="false"/> + <property name="jar.index.metainf" value="${jar.index}"/> + <property name="copylibs.rebase" value="true"/> + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> + <condition property="junit.available"> + <or> + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> + </or> + </condition> + <condition property="testng.available"> + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> + </condition> + <condition property="junit+testng.available"> + <and> + <istrue value="${junit.available}"/> + <istrue value="${testng.available}"/> + </and> + </condition> + <condition else="testng" property="testng.mode" value="mixed"> + <istrue value="${junit+testng.available}"/> + </condition> + <condition else="" property="testng.debug.mode" value="-mixed"> + <istrue value="${junit+testng.available}"/> + </condition> + <property name="java.failonerror" value="true"/> + </target> + <target name="-post-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> + <fail unless="src.dir">Must set src.dir</fail> + <fail unless="test.src.dir">Must set test.src.dir</fail> + <fail unless="build.dir">Must set build.dir</fail> + <fail unless="dist.dir">Must set dist.dir</fail> + <fail unless="build.classes.dir">Must set build.classes.dir</fail> + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> + <fail unless="dist.jar">Must set dist.jar</fail> + </target> + <target name="-init-macrodef-property"> + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${@{value}}"/> + </sequential> + </macrodef> + </target> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="${javac.debug}" name="debug"/> + <attribute default="${empty.dir}" name="sourcepath"/> + <attribute default="${empty.dir}" name="gensrcdir"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.dir}/empty" name="empty.dir"/> + <mkdir dir="${empty.dir}"/> + <mkdir dir="@{apgeneratedsrcdir}"/> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <src> + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </src> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> + <compilerarg line="${javac.compilerargs}"/> + <compilerarg value="-processorpath"/> + <compilerarg path="@{processorpath}:${empty.dir}"/> + <compilerarg line="${ap.processors.internal}"/> + <compilerarg line="${annotation.processing.processor.options}"/> + <compilerarg value="-s"/> + <compilerarg path="@{apgeneratedsrcdir}"/> + <compilerarg line="${ap.proc.none.internal}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="${javac.debug}" name="debug"/> + <attribute default="${empty.dir}" name="sourcepath"/> + <attribute default="${empty.dir}" name="gensrcdir"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.dir}/empty" name="empty.dir"/> + <mkdir dir="${empty.dir}"/> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <src> + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </src> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> + <compilerarg line="${javac.compilerargs}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <sequential> + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> + <classpath> + <path path="@{classpath}"/> + </classpath> + </depend> + </sequential> + </macrodef> + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${build.classes.dir}" name="destdir"/> + <sequential> + <fail unless="javac.includes">Must set javac.includes</fail> + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> + <path> + <filelist dir="@{destdir}" files="${javac.includes}"/> + </path> + <globmapper from="*.java" to="*.class"/> + </pathconvert> + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> + <delete> + <files includesfile="${javac.includesfile.binary}"/> + </delete> + <delete> + <fileset file="${javac.includesfile.binary}"/> + </delete> + </sequential> + </macrodef> + </target> + <target if="${junit.available}" name="-init-macrodef-junit-init"> + <condition else="false" property="nb.junit.batch" value="true"> + <and> + <istrue value="${junit.available}"/> + <not> + <isset property="test.method"/> + </not> + </and> + </condition> + <condition else="false" property="nb.junit.single" value="true"> + <and> + <istrue value="${junit.available}"/> + <isset property="test.method"/> + </and> + </condition> + </target> + <target name="-init-test-properties"> + <property name="test.binaryincludes" value="<nothing>"/> + <property name="test.binarytestincludes" value=""/> + <property name="test.binaryexcludes" value=""/> + </target> + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <batchtest todir="${build.test.results.dir}"> + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> + <filename name="@{testincludes}"/> + </fileset> + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> + <filename name="${test.binarytestincludes}"/> + </fileset> + </batchtest> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> + <target if="${testng.available}" name="-init-macrodef-testng"> + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> + <isset property="test.method"/> + </condition> + <union id="test.set"> + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> + <filename name="@{testincludes}"/> + </fileset> + </union> + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="SleuthkitCaseUco" testname="TestNG tests" workingDir="${work.dir}"> + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> + <propertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </propertyset> + <customize/> + </testng> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-test-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <echo>No tests executed.</echo> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:testng> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <sequential> + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + </customize> + </j2seproject3:test-impl> + </sequential> + </macrodef> + </target> + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <batchtest todir="${build.test.results.dir}"> + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> + <filename name="@{testincludes}"/> + </fileset> + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> + <filename name="${test.binarytestincludes}"/> + </fileset> + </batchtest> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:junit-debug> + </sequential> + </macrodef> + </target> + <target if="${testng.available}" name="-init-macrodef-testng-debug"> + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <element name="customize2" optional="true"/> + <sequential> + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> + <isset property="test.method"/> + </condition> + <condition else="-suitename SleuthkitCaseUco -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> + <matches pattern=".*\.xml" string="@{testClass}"/> + </condition> + <delete dir="${build.test.results.dir}" quiet="true"/> + <mkdir dir="${build.test.results.dir}"/> + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> + <customize> + <customize2/> + <jvmarg value="-ea"/> + <arg line="${testng.debug.mode}"/> + <arg line="-d ${build.test.results.dir}"/> + <arg line="-listener org.testng.reporters.VerboseReporter"/> + <arg line="${testng.cmd.args}"/> + </customize> + </j2seproject3:debug> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <element implicit="true" name="customize2" optional="true"/> + <sequential> + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> + <customize2/> + </j2seproject3:testng-debug> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <sequential> + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + </customize> + </j2seproject3:test-debug-impl> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <sequential> + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> + <customize2> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + </customize2> + </j2seproject3:testng-debug-impl> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> + <!-- + pre NB7.2 profiling section; consider it deprecated + --> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> + <macrodef name="resolve"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${env.@{value}}"/> + </sequential> + </macrodef> + <macrodef name="profile"> + <attribute default="${main.class}" name="classname"/> + <element name="customize" optional="true"/> + <sequential> + <property environment="env"/> + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> + <java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg value="${profiler.info.jvmargs.agent}"/> + <jvmarg line="${profiler.info.jvmargs}"/> + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> + <arg line="${application.args}"/> + <classpath> + <path path="${run.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper from="run-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> + </target> + <!-- + end of pre NB7.2 profiling section + --> + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute default="${main.class}" name="name"/> + <attribute default="${debug.classpath}" name="classpath"/> + <attribute default="" name="stopclassname"/> + <sequential> + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> + <classpath> + <path path="@{classpath}"/> + </classpath> + </nbjpdastart> + </sequential> + </macrodef> + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute default="${build.classes.dir}" name="dir"/> + <sequential> + <nbjpdareload> + <fileset dir="@{dir}" includes="${fix.classes}"> + <include name="${fix.includes}*.class"/> + </fileset> + </nbjpdareload> + </sequential> + </macrodef> + </target> + <target name="-init-debug-args"> + <property name="version-output" value="java version "${ant.java.version}"/> + <condition property="have-jdk-older-than-1.4"> + <or> + <contains string="${version-output}" substring="java version "1.0"/> + <contains string="${version-output}" substring="java version "1.1"/> + <contains string="${version-output}" substring="java version "1.2"/> + <contains string="${version-output}" substring="java version "1.3"/> + </or> + </condition> + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> + <istrue value="${have-jdk-older-than-1.4}"/> + </condition> + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> + <os family="windows"/> + </condition> + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> + <isset property="debug.transport"/> + </condition> + </target> + <target depends="-init-debug-args" name="-init-macrodef-debug"> + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="classname"/> + <attribute default="${debug.classpath}" name="classpath"/> + <element name="customize" optional="true"/> + <sequential> + <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + <classpath> + <path path="@{classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper from="run-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-java"> + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute default="${main.class}" name="classname"/> + <attribute default="${run.classpath}" name="classpath"/> + <attribute default="jvm" name="jvm"/> + <element name="customize" optional="true"/> + <sequential> + <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + <classpath> + <path path="@{classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper from="run-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-copylibs"> + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${manifest.file}" name="manifest"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <pathconvert property="run.classpath.without.build.classes.dir"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to=""/> + </pathconvert> + <pathconvert pathsep=" " property="jar.classpath"> + <path path="${run.classpath.without.build.classes.dir}"/> + <chainedmapper> + <flattenmapper/> + <filtermapper> + <replacestring from=" " to="%20"/> + </filtermapper> + <globmapper from="*" to="lib/*"/> + </chainedmapper> + </pathconvert> + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" manifestencoding="UTF-8" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> + <manifest> + <attribute name="Class-Path" value="${jar.classpath}"/> + <customize/> + </manifest> + </copylibs> + </sequential> + </macrodef> + </target> + <target name="-init-presetdef-jar"> + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifestencoding="UTF-8"> + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> + </jar> + </presetdef> + </target> + <target name="-init-ap-cmdline-properties"> + <property name="annotation.processing.enabled" value="true"/> + <property name="annotation.processing.processors.list" value=""/> + <property name="annotation.processing.processor.options" value=""/> + <property name="annotation.processing.run.all.processors" value="true"/> + <property name="javac.processorpath" value="${javac.classpath}"/> + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> + <condition property="ap.supported.internal" value="true"> + <not> + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> + </not> + </condition> + </target> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> + <isfalse value="${annotation.processing.run.all.processors}"/> + </condition> + <condition else="" property="ap.proc.none.internal" value="-proc:none"> + <isfalse value="${annotation.processing.enabled}"/> + </condition> + </target> + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> + <property name="ap.cmd.line.internal" value=""/> + </target> + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> + <!-- + =================== + COMPILATION SECTION + =================== + --> + <target name="-deps-jar-init" unless="built-jar.properties"> + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> + <delete file="${built-jar.properties}" quiet="true"/> + </target> + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> + <echo level="warn" message="Cycle detected: SleuthkitCaseUco was already built"/> + </target> + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> + <mkdir dir="${build.dir}"/> + <touch file="${built-jar.properties}" verbose="false"/> + <property file="${built-jar.properties}" prefix="already.built.jar."/> + <antcall target="-warn-already-built-jar"/> + <propertyfile file="${built-jar.properties}"> + <entry key="${basedir}" value=""/> + </propertyfile> + </target> + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> + <target depends="init" name="-check-automatic-build"> + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> + </target> + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> + <antcall target="clean"/> + </target> + <target depends="init,deps-jar" name="-pre-pre-compile"> + <mkdir dir="${build.classes.dir}"/> + </target> + <target name="-pre-compile"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="do.depend.true" name="-compile-depend"> + <pathconvert property="build.generated.subdirs"> + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </pathconvert> + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> + </target> + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> + <copy todir="${build.classes.dir}"> + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + </copy> + </target> + <target if="has.persistence.xml" name="-copy-persistence-xml"> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy todir="${build.classes.dir}/META-INF"> + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/> + </copy> + </target> + <target name="-post-compile"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> + <target name="-pre-compile-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> + <j2seproject3:force-recompile/> + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> + </target> + <target name="-post-compile-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> + <!-- + ==================== + JAR BUILDING SECTION + ==================== + --> + <target depends="init" name="-pre-pre-jar"> + <dirname file="${dist.jar}" property="dist.jar.dir"/> + <mkdir dir="${dist.jar.dir}"/> + </target> + <target name="-pre-jar"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> + <touch file="${tmp.manifest.file}" verbose="false"/> + </target> + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> + <copy encoding="${manifest.encoding}" file="${manifest.file}" outputencoding="UTF-8" tofile="${tmp.manifest.file}"/> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update"> + <attribute name="Main-Class" value="${main.class}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update"> + <attribute name="Profile" value="${javac.profile}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> + <basename file="${application.splash}" property="splashscreen.basename"/> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> + <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update"> + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> + </manifest> + </target> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> + <echo level="info">To run this application from the command line without Ant, try:</echo> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <echo level="info">java -jar "${dist.jar.resolved}"</echo> + </target> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <j2seproject1:jar manifest="${tmp.manifest.file}"/> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> + <isset property="main.class.available"/> + </condition> + <condition else="debug" property="jar.usage.level" value="info"> + <isset property="main.class.available"/> + </condition> + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> + </target> + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> + <delete> + <fileset file="${tmp.manifest.file}"/> + </delete> + </target> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> + <target name="-post-jar"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> + <!-- + ================= + EXECUTION SECTION + ================= + --> + <target depends="init,compile" description="Run a main class." name="run"> + <j2seproject1:java> + <customize> + <arg line="${application.args}"/> + </customize> + </j2seproject1:java> + </target> + <target name="-do-not-recompile"> + <property name="javac.includes.binary" value=""/> + </target> + <target depends="init,compile-single" name="run-single"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <j2seproject1:java classname="${run.class}"/> + </target> + <target depends="init,compile-test-single" name="run-test-with-main"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> + </target> + <!-- + ================= + DEBUGGING SECTION + ================= + --> + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> + <j2seproject1:nbjpdastart name="${debug.class}"/> + </target> + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> + </target> + <target depends="init,compile" name="-debug-start-debuggee"> + <j2seproject3:debug> + <customize> + <arg line="${application.args}"/> + </customize> + </j2seproject3:debug> + </target> + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> + </target> + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> + <j2seproject3:debug classname="${debug.class}"/> + </target> + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> + </target> + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> + <target depends="init" name="-pre-debug-fix"> + <fail unless="fix.includes">Must set fix.includes</fail> + <property name="javac.includes" value="${fix.includes}.java"/> + </target> + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> + <j2seproject1:nbjpdareload/> + </target> + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> + <!-- + ================= + PROFILING SECTION + ================= + --> + <!-- + pre NB7.2 profiler integration + --> + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile/> + </target> + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile classname="${profile.class}"/> + </target> + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </profile> + </target> + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> + <nbprofiledirect> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + </nbprofiledirect> + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> + <jvmarg value="${profiler.info.jvmargs.agent}"/> + <jvmarg line="${profiler.info.jvmargs}"/> + <test name="${profile.class}"/> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + </junit> + </target> + <!-- + end of pre NB72 profiling section + --> + <target if="netbeans.home" name="-profile-check"> + <condition property="profiler.configured"> + <or> + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> + </or> + </condition> + </target> + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> + <startprofiler/> + <antcall target="run"/> + </target> + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <startprofiler/> + <antcall target="run-single"/> + </target> + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> + <startprofiler/> + <antcall target="test-single"/> + </target> + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <startprofiler/> + <antcall target="run-test-with-main"/> + </target> + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <startprofiler/> + <antcall target="run-applet"/> + </target> + <!-- + =============== + JAVADOC SECTION + =============== + --> + <target depends="init" if="have.sources" name="-javadoc-build"> + <mkdir dir="${dist.javadoc.dir}"/> + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> + <and> + <isset property="endorsed.classpath.cmd.line.arg"/> + <not> + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> + </not> + </and> + </condition> + <condition else="" property="bug5101868workaround" value="*.java"> + <matches pattern="1\.[56](\..*)?" string="${java.version}"/> + </condition> + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> + <classpath> + <path path="${javac.classpath}"/> + </classpath> + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> + <filename name="**/*.java"/> + </fileset> + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> + <include name="**/*.java"/> + <exclude name="*.java"/> + </fileset> + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> + </javadoc> + <copy todir="${dist.javadoc.dir}"> + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> + <filename name="**/doc-files/**"/> + </fileset> + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> + <include name="**/doc-files/**"/> + </fileset> + </copy> + </target> + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> + <nbbrowse file="${dist.javadoc.dir}/index.html"/> + </target> + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> + <!-- + ========================= + TEST COMPILATION SECTION + ========================= + --> + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> + <mkdir dir="${build.test.classes.dir}"/> + </target> + <target name="-pre-compile-test"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target if="do.depend.true" name="-compile-test-depend"> + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> + </target> + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> + <copy todir="${build.test.classes.dir}"> + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + </copy> + </target> + <target name="-post-compile-test"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> + <target name="-pre-compile-test-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> + <copy todir="${build.test.classes.dir}"> + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + </copy> + </target> + <target name="-post-compile-test-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> + <!-- + ======================= + TEST EXECUTION SECTION + ======================= + --> + <target depends="init" if="have.tests" name="-pre-test-run"> + <mkdir dir="${build.test.results.dir}"/> + </target> + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/> + </target> + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init" if="have.tests" name="test-report"/> + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> + <target depends="init" if="have.tests" name="-pre-test-run-single"> + <mkdir dir="${build.test.results.dir}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> + <!-- + ======================= + TEST DEBUGGING SECTION + ======================= + --> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> + </target> + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> + </target> + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> + </target> + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> + <!-- + ========================= + APPLET EXECUTION SECTION + ========================= + --> + <target depends="init,compile-single" name="run-applet"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <j2seproject1:java classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </j2seproject1:java> + </target> + <!-- + ========================= + APPLET DEBUGGING SECTION + ========================= + --> + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <j2seproject3:debug classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </j2seproject3:debug> + </target> + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> + <!-- + =============== + CLEANUP SECTION + =============== + --> + <target name="-deps-clean-init" unless="built-clean.properties"> + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> + <delete file="${built-clean.properties}" quiet="true"/> + </target> + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> + <echo level="warn" message="Cycle detected: SleuthkitCaseUco was already built"/> + </target> + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> + <mkdir dir="${build.dir}"/> + <touch file="${built-clean.properties}" verbose="false"/> + <property file="${built-clean.properties}" prefix="already.built.clean."/> + <antcall target="-warn-already-built-clean"/> + <propertyfile file="${built-clean.properties}"> + <entry key="${basedir}" value=""/> + </propertyfile> + </target> + <target depends="init" name="-do-clean"> + <delete dir="${build.dir}"/> + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> + </target> + <target name="-post-clean"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> + <target name="-check-call-dep"> + <property file="${call.built.properties}" prefix="already.built."/> + <condition property="should.call.dep"> + <and> + <not> + <isset property="already.built.${call.subproject}"/> + </not> + <available file="${call.script}"/> + </and> + </condition> + </target> + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> + <propertyset> + <propertyref prefix="transfer."/> + <mapper from="transfer.*" to="*" type="glob"/> + </propertyset> + </ant> + </target> +</project> diff --git a/case-uco/java/nbproject/genfiles.properties b/case-uco/java/nbproject/genfiles.properties new file mode 100755 index 0000000000000000000000000000000000000000..433ff194cd8fa2999b3ac084e0f673b0ff907744 --- /dev/null +++ b/case-uco/java/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=66643c72 +build.xml.script.CRC32=613795df +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=66643c72 +nbproject/build-impl.xml.script.CRC32=2a59e454 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/case-uco/java/nbproject/project.properties b/case-uco/java/nbproject/project.properties new file mode 100755 index 0000000000000000000000000000000000000000..67264595338ebf0b3207ea5793314de0feebd417 --- /dev/null +++ b/case-uco/java/nbproject/project.properties @@ -0,0 +1,100 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=SleuthkitCaseUco +application.vendor= +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/sleuthkit-caseuco-${VERSION}.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.gson-2.8.5.jar=lib/gson-2.8.5.jar +file.reference.sleuthkit-4.9.0.jar=lib/sleuthkit-4.9.0.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath=\ + ${file.reference.gson-2.8.5.jar}:\ + ${file.reference.sleuthkit-4.9.0.jar} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +main.class= +# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. +manifest.custom.application.library.allowable.codebase= +# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. +manifest.custom.caller.allowable.codebase= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/case-uco/java/nbproject/project.xml b/case-uco/java/nbproject/project.xml new file mode 100755 index 0000000000000000000000000000000000000000..702c42847b2321cb51704d44c74ccf5d712192bf --- /dev/null +++ b/case-uco/java/nbproject/project.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.java.j2seproject</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> + <name>SleuthkitCaseUco</name> + <source-roots> + <root id="src.dir"/> + </source-roots> + <test-roots> + <root id="test.src.dir"/> + </test-roots> + </data> + </configuration> +</project> diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Account.java b/case-uco/java/src/org/sleuthkit/caseuco/Account.java new file mode 100755 index 0000000000000000000000000000000000000000..974ba5d2ae3ead1123e5f80bc02953d746fe0d14 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Account.java @@ -0,0 +1,51 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Account observable described in the UCO + * ontology. + */ +class Account extends Facet { + + private String accountType; + + private String accountIdentifier; + + private String owner; + + Account() { + super(Account.class.getSimpleName()); + } + + Account setAccountType(String accountType) { + this.accountType = accountType; + return this; + } + + Account setAccountIdentifier(String accountIdentifier) { + this.accountIdentifier = accountIdentifier; + return this; + } + + Account setOwner(Identity owner) { + this.owner = owner.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/AccountAuthentication.java b/case-uco/java/src/org/sleuthkit/caseuco/AccountAuthentication.java new file mode 100755 index 0000000000000000000000000000000000000000..fd140ccae9d613a103d260093cc9c93edf708d4a --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/AccountAuthentication.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the AccountAuthentication observable described + * in the UCO ontology. + */ +class AccountAuthentication extends Facet { + + private String password; + + AccountAuthentication() { + super(AccountAuthentication.class.getSimpleName()); + } + + AccountAuthentication setPassword(String password) { + this.password = password; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Action.java b/case-uco/java/src/org/sleuthkit/caseuco/Action.java new file mode 100755 index 0000000000000000000000000000000000000000..17ae1382fa43ab1fd4040b4911c3183d3e9a7025 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Action.java @@ -0,0 +1,43 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the core Action object described in the UCO + * ontology. + */ +class Action extends UcoObject { + + private String startTime; + + Action(String id) { + super(id, Action.class.getSimpleName()); + } + + Action setStartTime(Long startTime) { + if (startTime != null) { + this.startTime = Instant.ofEpochSecond(startTime).atOffset(ZoneOffset.UTC).toString(); + } + + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ActionArgument.java b/case-uco/java/src/org/sleuthkit/caseuco/ActionArgument.java new file mode 100755 index 0000000000000000000000000000000000000000..6778375646387597870c91c43ff242cd4ef0646c --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/ActionArgument.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the ActionArgument observable described in the + * UCO ontology. + */ +class ActionArgument extends Facet { + + private String argumentName; + + ActionArgument() { + super(ActionArgument.class.getSimpleName()); + } + + ActionArgument setArgumentName(String argumentName) { + this.argumentName = argumentName; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Annotation.java b/case-uco/java/src/org/sleuthkit/caseuco/Annotation.java new file mode 100755 index 0000000000000000000000000000000000000000..4d4ade8da662a133f273acce25ab99a6b0749ba2 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Annotation.java @@ -0,0 +1,49 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class definition mirrors the core Annotation object described in the UCO + * ontology. + */ +class Annotation extends UcoObject { + + private final List<String> tag; + + private final List<String> object; + + Annotation(String uuid) { + super(uuid, "Annotation"); + tag = new ArrayList<>(); + object = new ArrayList<>(); + } + + Annotation addTag(String tag) { + this.tag.add(tag); + return this; + } + + Annotation addObject(String object) { + this.object.add(object); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Application.java b/case-uco/java/src/org/sleuthkit/caseuco/Application.java new file mode 100755 index 0000000000000000000000000000000000000000..1443ff9e09d0dd635a649fb6d305d54b6c70332d --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Application.java @@ -0,0 +1,58 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Application observable described in the UCO + * ontology. + */ +class Application extends Facet { + + private String applicationIdentifier; + + private String operatingSystem; + + private Integer numberOfLaunches; + + private String version; + + Application() { + super(Application.class.getSimpleName()); + } + + Application setApplicationIdentifier(String applicationIdentifier) { + this.applicationIdentifier = applicationIdentifier; + return this; + } + + Application setOperatingSystem(CyberItem operatingSystem) { + this.operatingSystem = operatingSystem.getId(); + return this; + } + + Application setNumberOfLaunches(Integer numberOfLaunches) { + this.numberOfLaunches = numberOfLaunches; + return this; + } + + Application setVersion(String version) { + this.version = version; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ApplicationAccount.java b/case-uco/java/src/org/sleuthkit/caseuco/ApplicationAccount.java new file mode 100755 index 0000000000000000000000000000000000000000..1d63641b4c3ecc82be0bb30973d5dc8f938a11e1 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/ApplicationAccount.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the ApplicationAccount observable described in + * the UCO ontology. + */ +class ApplicationAccount extends Facet { + + private String application; + + ApplicationAccount() { + super(ApplicationAccount.class.getSimpleName()); + } + + ApplicationAccount setApplication(CyberItem application) { + this.application = application.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Assertion.java b/case-uco/java/src/org/sleuthkit/caseuco/Assertion.java new file mode 100755 index 0000000000000000000000000000000000000000..d214f76c8eb9954e90aee5950b6ed26a4138a313 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Assertion.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the core Assertion object described in the UCO + * ontology. + */ +class Assertion extends UcoObject { + + private String statement; + + Assertion(String uuid) { + super(uuid, "Assertion"); + } + + Assertion setStatement(String statement) { + this.statement = statement; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Attachment.java b/case-uco/java/src/org/sleuthkit/caseuco/Attachment.java new file mode 100755 index 0000000000000000000000000000000000000000..e6edd3c6d849686aecbd8520216e12f59cb9e253 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Attachment.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Attachment observable described in the UCO + * ontology. + */ +class Attachment extends Facet { + + private String url; + + Attachment() { + super(Attachment.class.getSimpleName()); + } + + Attachment setUrl(String url) { + this.url = url; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankAssertionNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankAssertionNode.java new file mode 100755 index 0000000000000000000000000000000000000000..949277816ade57596eb2538bf797ee081a22753a --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankAssertionNode.java @@ -0,0 +1,32 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of an assertion. + */ +class BlankAssertionNode extends Assertion { + + BlankAssertionNode() { + super("_:" + UUID.randomUUID().toString()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankIdentityNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankIdentityNode.java new file mode 100755 index 0000000000000000000000000000000000000000..4780f9324de9297fb6358000a7d8379eb1547f03 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankIdentityNode.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of an identity. + */ +class BlankIdentityNode extends Identity { + + BlankIdentityNode() { + super("_:" + UUID.randomUUID().toString()); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankLocationNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankLocationNode.java new file mode 100755 index 0000000000000000000000000000000000000000..3b882c105a7e1d711f18675cefc61a1d031e5f41 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankLocationNode.java @@ -0,0 +1,32 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of a location object. + */ +class BlankLocationNode extends Location { + + BlankLocationNode() { + super("_:" + UUID.randomUUID().toString()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankOrganizationNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankOrganizationNode.java new file mode 100755 index 0000000000000000000000000000000000000000..29ddac6b4b05b71d18246ad82f995c24e2600951 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankOrganizationNode.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of an organization. + */ +class BlankOrganizationNode extends Organization { + + BlankOrganizationNode() { + super("_:" + UUID.randomUUID().toString()); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankPersonNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankPersonNode.java new file mode 100755 index 0000000000000000000000000000000000000000..4afc9dbb4ef0bd3ded6bb65c9a72117b902e9667 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankPersonNode.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of a person. + */ +class BlankPersonNode extends Person { + + BlankPersonNode() { + super("_:" + UUID.randomUUID().toString()); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankRelationshipNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankRelationshipNode.java new file mode 100755 index 0000000000000000000000000000000000000000..12ffe8725e19fc47ab28b8ad687346944824b69b --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankRelationshipNode.java @@ -0,0 +1,32 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of a relationship. + */ +class BlankRelationshipNode extends Relationship { + + BlankRelationshipNode() { + super("_:" + UUID.randomUUID().toString()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BlankTraceNode.java b/case-uco/java/src/org/sleuthkit/caseuco/BlankTraceNode.java new file mode 100755 index 0000000000000000000000000000000000000000..22e5e4606d2f6ab811159c3da0bb1847af137ecd --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BlankTraceNode.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.UUID; + +/** + * Represents a blank node version of a Trace. + */ +class BlankTraceNode extends Trace { + + BlankTraceNode() { + super("_:" + UUID.randomUUID().toString()); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BrowserBookmark.java b/case-uco/java/src/org/sleuthkit/caseuco/BrowserBookmark.java new file mode 100755 index 0000000000000000000000000000000000000000..89c61afaa62c1930ce4e3c1f198c74a82ee36028 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BrowserBookmark.java @@ -0,0 +1,46 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the BrowserBookmark observable described in the + * UCO ontology. + */ +class BrowserBookmark extends Facet { + + private String urlTargeted; + + private String createdTime; + + private String application; + + BrowserBookmark() { + super(BrowserBookmark.class.getSimpleName()); + } + + BrowserBookmark setUrlTargeted(String urlTargeted) { + this.urlTargeted = urlTargeted; + return this; + } + + BrowserBookmark setApplication(CyberItem application) { + this.application = application.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/BrowserCookie.java b/case-uco/java/src/org/sleuthkit/caseuco/BrowserCookie.java new file mode 100755 index 0000000000000000000000000000000000000000..6fe32dc384de446506bac94f59d26e9e099b3fb8 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/BrowserCookie.java @@ -0,0 +1,79 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the BrowserCookie observable described in the + * UCO ontology. + */ +class BrowserCookie extends Facet { + + private String cookieName; + + private String accessedTime; + + private String expirationTime; + + private String cookieDomain; + + private String application; + + private String cookiePath; + + BrowserCookie() { + super(BrowserCookie.class.getSimpleName()); + } + + BrowserCookie setCookieName(String cookieName) { + this.cookieName = cookieName; + return this; + } + + BrowserCookie setAccessedTime(Long accessedTime) { + if (accessedTime != null) { + this.accessedTime = Instant.ofEpochSecond(accessedTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + BrowserCookie setExpirationTime(Long expirationTime) { + if (expirationTime != null) { + this.expirationTime = Instant.ofEpochSecond(expirationTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + BrowserCookie setCookieDomain(CyberItem cookieDomain) { + this.cookieDomain = cookieDomain.getId(); + return this; + } + + BrowserCookie setApplication(CyberItem application) { + this.application = application.getId(); + return this; + } + + BrowserCookie setCookiePath(String cookiePath) { + this.cookiePath = cookiePath; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/CalendarEntry.java b/case-uco/java/src/org/sleuthkit/caseuco/CalendarEntry.java new file mode 100755 index 0000000000000000000000000000000000000000..62561dfd6ec98b990cb17281c0a9d0b8a7c93041 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/CalendarEntry.java @@ -0,0 +1,65 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the CalendarEntry observable described in the + * UCO ontology. + */ +class CalendarEntry extends Facet { + + private String eventType; + + private String startTime; + + private String endTime; + + private String location; + + CalendarEntry() { + super(CalendarEntry.class.getSimpleName()); + } + + CalendarEntry setEventType(String eventType) { + this.eventType = eventType; + return this; + } + + CalendarEntry setLocation(Location location) { + this.location = location.getId(); + return this; + } + + CalendarEntry setEndTime(Long endTime) { + if (endTime != null) { + this.endTime = Instant.ofEpochSecond(endTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + CalendarEntry setStartTime(Long startTime) { + if (startTime != null) { + this.startTime = Instant.ofEpochSecond(startTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java new file mode 100755 index 0000000000000000000000000000000000000000..5c72521d231dbb1fdd9998d7a2be405f0ff36fa8 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java @@ -0,0 +1,1338 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EXTRACTED_TEXT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_ACCOUNT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_INFO; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_SERVICE_ACCOUNT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_CALENDAR_ENTRY; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DATA_SOURCE_USAGE; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_INFO; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_OBJECT_DETECTED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_REMOTE_DRIVE; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_SIM_ATTACHED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_SPEED_DIAL_ENTRY; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_CLIPBOARD_CONTENT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACK; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_TL_EVENT; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_USER_CONTENT_SUSPECTED; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS; +import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT; + +import org.sleuthkit.datamodel.ContentTag; +import org.sleuthkit.datamodel.DataSource; +import org.sleuthkit.datamodel.FileSystem; +import org.sleuthkit.datamodel.Image; +import org.sleuthkit.datamodel.Pool; +import org.sleuthkit.datamodel.Volume; +import org.sleuthkit.datamodel.VolumeSystem; +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TimelineEventType; +import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.blackboardutils.attributes.BlackboardJsonAttrUtil; +import org.sleuthkit.datamodel.blackboardutils.attributes.GeoTrackPoints; +import org.sleuthkit.datamodel.blackboardutils.attributes.MessageAttachments; + +import org.sleuthkit.datamodel.SleuthkitCase; + +/** + * Exports Sleuthkit DataModel objects to CASE. UcoObject is the base class for + * all CASE constructs. The export objects are configured to be serialized with + * Gson. + */ +public class CaseUcoExporter { + + private final CaseUcoUUIDService uuidService; + + /** + * Creates a default CaseUcoExporter. + * + * @param sleuthkitCase The sleuthkit case instance containing the data to + * be exported. + */ + public CaseUcoExporter(SleuthkitCase sleuthkitCase) { + this.uuidService = new CaseUcoUUIDServiceImpl(sleuthkitCase); + } + + /** + * Overrides the default UUID implementation, which is used to generate the + * unique @id properties in the CASE output. Some use cases may require a + * different value for @id, such as a web service (where this value + * should contain a URL). + * + * @param uuidService A custom UUID implementation, which will be used to + * generate @id values in all export methods. + */ + public CaseUcoExporter(CaseUcoUUIDService uuidService) { + this.uuidService = uuidService; + } + + /** + * Exports an AbstractFile instance to CASE. + * + * @param file AbstractFile instance to export + * @return Equivalent CASE construction + * + * @throws TskCoreException + */ + public UcoObject exportAbstractFile(AbstractFile file) throws TskCoreException { + Trace export = new Trace(this.uuidService.createUUID(file)) + .addBundle(new ContentData() + .setMimeType(file.getMIMEType()) + .setSizeInBytes(file.getSize()) + .setMd5Hash(file.getMd5Hash())); + + File fileExport = new File() + .setAccessedTime(file.getAtime()) + .setExtension(file.getNameExtension()) + .setFileName(file.getName()) + .setFilePath(file.getUniquePath()) + .setIsDirectory(file.isDir()) + .setSizeInBytes(file.getSize()); + fileExport.setModifiedTime(file.getMtime()); + fileExport.setCreatedTime(file.getCrtime()); + + export.addBundle(fileExport); + + return export; + } + + /** + * Exports a ContentTag instance to CASE. + * + * @param contentTag ContentTag instance to export + * @return Equivalent CASE construction + */ + public UcoObject exportContentTag(ContentTag contentTag) { + Annotation annotation = new Annotation(this.uuidService.createUUID(contentTag)) + .addObject(this.uuidService.createUUID(contentTag.getContent())); + annotation.setDescription(contentTag.getComment()); + annotation.addTag(contentTag.getName().getDisplayName()); + + return annotation; + } + + /** + * Exports a DataSource instance to CASE. + * + * @param dataSource DataSource instance to export + * @return Equivalent CASE construction + */ + public UcoObject exportDataSource(DataSource dataSource) { + Trace export = new Trace(this.uuidService.createUUID(dataSource)) + .addBundle(new File() + .setFilePath(getDataSourcePath(dataSource))) + .addBundle(new ContentData() + .setSizeInBytes(dataSource.getSize())); + + return export; + } + + String getDataSourcePath(DataSource dataSource) { + String dataSourcePath = ""; + if (dataSource instanceof Image) { + String[] paths = ((Image) dataSource).getPaths(); + if (paths.length > 0) { + dataSourcePath = paths[0]; + } + } else { + dataSourcePath = dataSource.getName(); + } + dataSourcePath = dataSourcePath.replaceAll("\\\\", "/"); + return dataSourcePath; + } + + /** + * Exports a FileSystem instance to CASE. + * + * @param fileSystem FileSystem instance to export + * @return Equivalent CASE construction + */ + public UcoObject exportFileSystem(FileSystem fileSystem) { + Trace export = new Trace(this.uuidService.createUUID(fileSystem)) + .addBundle(new org.sleuthkit.caseuco.FileSystem() + .setFileSystemType(fileSystem.getFsType()) + .setCluserSize(fileSystem.getBlock_size())); + + return export; + } + + /** + * Exports a Pool instance to CASE. + * + * @param pool Pool instance to export + * @return Equivalent CASE construction + */ + public UcoObject exportPool(Pool pool) { + Trace export = new Trace(this.uuidService.createUUID(pool)) + .addBundle(new ContentData() + .setSizeInBytes(pool.getSize())); + + return export; + } + + /** + * Exports a Volume instance to CASE. + * + * @param volume Volume instance to export + * @return Equivalent CASE construction + */ + public UcoObject exportVolume(Volume volume) { + Trace export = new Trace(this.uuidService.createUUID(volume)); + org.sleuthkit.caseuco.Volume volumeFacet = new org.sleuthkit.caseuco.Volume(); + if (volume.getLength() > 0) { + volumeFacet.setSectorSize(volume.getSize() / volume.getLength()); + } + export.addBundle(volumeFacet) + .addBundle(new ContentData() + .setSizeInBytes(volume.getSize())); + + return export; + + } + + /** + * Exports a VolumeSystem instance to CASE. + * + * @param volumeSystem VolumeSystem instance to export + * @return Equivalent CASE construction + */ + public UcoObject exportVolumeSystem(VolumeSystem volumeSystem) { + Trace export = new Trace(this.uuidService.createUUID(volumeSystem)) + .addBundle(new ContentData() + .setSizeInBytes(volumeSystem.getSize())); + + return export; + } + + /** + * Exports a BlackboardArtifact instance to CASE. + * + * @param artifact BlackboardArtifact instance to export + * @return Equivalent CASE construction(s) + * @throws org.sleuthkit.datamodel.TskCoreException + * @throws org.sleuthkit.caseuco.ContentNotExportableException if the + * content could not be exported, even in part, to CASE. + * @throws + * org.sleuthkit.datamodel.blackboardutils.attributes.BlackboardJsonAttrUtil.InvalidJsonException + */ + public List<UcoObject> exportBlackboardArtifact(BlackboardArtifact artifact) throws TskCoreException, + ContentNotExportableException, BlackboardJsonAttrUtil.InvalidJsonException { + List<UcoObject> output = new ArrayList<>(); + + String uuid = this.uuidService.createUUID(artifact); + int artifactTypeId = artifact.getArtifactTypeID(); + + if (TSK_GEN_INFO.getTypeID() == artifactTypeId) { + assembleGenInfo(uuid, artifact, output); + } else if (TSK_WEB_BOOKMARK.getTypeID() == artifactTypeId) { + assembleWebBookmark(uuid, artifact, output); + } else if (TSK_WEB_COOKIE.getTypeID() == artifactTypeId) { + assembleWebCookie(uuid, artifact, output); + } else if (TSK_WEB_HISTORY.getTypeID() == artifactTypeId) { + assembleWebHistory(uuid, artifact, output); + } else if (TSK_WEB_DOWNLOAD.getTypeID() == artifactTypeId) { + assembleWebDownload(uuid, artifact, output); + } else if (TSK_RECENT_OBJECT.getTypeID() == artifactTypeId) { + assembleRecentObject(uuid, artifact, output); + } else if (TSK_INSTALLED_PROG.getTypeID() == artifactTypeId) { + assembleInstalledProg(uuid, artifact, output); + } else if (TSK_HASHSET_HIT.getTypeID() == artifactTypeId) { + assembleHashsetHit(uuid, artifact, output); + } else if (TSK_DEVICE_ATTACHED.getTypeID() == artifactTypeId) { + assembleDeviceAttached(uuid, artifact, output); + } else if (TSK_INTERESTING_FILE_HIT.getTypeID() == artifactTypeId) { + assembleInterestingFileHit(uuid, artifact, output); + } else if (TSK_EMAIL_MSG.getTypeID() == artifactTypeId) { + assembleEmailMessage(uuid, artifact, output); + } else if (TSK_EXTRACTED_TEXT.getTypeID() == artifactTypeId) { + assembleExtractedText(uuid, artifact, output); + } else if (TSK_WEB_SEARCH_QUERY.getTypeID() == artifactTypeId) { + assembleWebSearchQuery(uuid, artifact, output); + } else if (TSK_METADATA_EXIF.getTypeID() == artifactTypeId) { + assembleMetadataExif(uuid, artifact, output); + } else if (TSK_OS_INFO.getTypeID() == artifactTypeId) { + assembleOsInfo(uuid, artifact, output); + } else if (TSK_OS_ACCOUNT.getTypeID() == artifactTypeId) { + assembleOsAccount(uuid, artifact, output); + } else if (TSK_SERVICE_ACCOUNT.getTypeID() == artifactTypeId) { + assembleServiceAccount(uuid, artifact, output); + } else if (TSK_CONTACT.getTypeID() == artifactTypeId) { + assembleContact(uuid, artifact, output); + } else if (TSK_MESSAGE.getTypeID() == artifactTypeId) { + assembleMessage(uuid, artifact, output); + } else if (TSK_CALLLOG.getTypeID() == artifactTypeId) { + assembleCallog(uuid, artifact, output); + } else if (TSK_CALENDAR_ENTRY.getTypeID() == artifactTypeId) { + assembleCalendarEntry(uuid, artifact, output); + } else if (TSK_SPEED_DIAL_ENTRY.getTypeID() == artifactTypeId) { + assembleSpeedDialEntry(uuid, artifact, output); + } else if (TSK_BLUETOOTH_PAIRING.getTypeID() == artifactTypeId) { + assembleBluetoothPairing(uuid, artifact, output); + } else if (TSK_GPS_BOOKMARK.getTypeID() == artifactTypeId) { + assembleGpsBookmark(uuid, artifact, output); + } else if (TSK_GPS_LAST_KNOWN_LOCATION.getTypeID() == artifactTypeId) { + assembleGpsLastKnownLocation(uuid, artifact, output); + } else if (TSK_GPS_SEARCH.getTypeID() == artifactTypeId) { + assembleGpsSearch(uuid, artifact, output); + } else if (TSK_PROG_RUN.getTypeID() == artifactTypeId) { + assembleProgRun(uuid, artifact, output); + } else if (TSK_ENCRYPTION_DETECTED.getTypeID() == artifactTypeId) { + assembleEncryptionDetected(uuid, artifact, output); + } else if (TSK_INTERESTING_ARTIFACT_HIT.getTypeID() == artifactTypeId) { + assembleInterestingArtifact(uuid, artifact, output); + } else if (TSK_GPS_ROUTE.getTypeID() == artifactTypeId) { + assembleGPSRoute(uuid, artifact, output); + } else if (TSK_REMOTE_DRIVE.getTypeID() == artifactTypeId) { + assembleRemoteDrive(uuid, artifact, output); + } else if (TSK_ACCOUNT.getTypeID() == artifactTypeId) { + assembleAccount(uuid, artifact, output); + } else if (TSK_ENCRYPTION_SUSPECTED.getTypeID() == artifactTypeId) { + assembleEncryptionSuspected(uuid, artifact, output); + } else if (TSK_OBJECT_DETECTED.getTypeID() == artifactTypeId) { + assembleObjectDetected(uuid, artifact, output); + } else if (TSK_WIFI_NETWORK.getTypeID() == artifactTypeId) { + assembleWifiNetwork(uuid, artifact, output); + } else if (TSK_DEVICE_INFO.getTypeID() == artifactTypeId) { + assembleDeviceInfo(uuid, artifact, output); + } else if (TSK_SIM_ATTACHED.getTypeID() == artifactTypeId) { + assembleSimAttached(uuid, artifact, output); + } else if (TSK_BLUETOOTH_ADAPTER.getTypeID() == artifactTypeId) { + assembleBluetoothAdapter(uuid, artifact, output); + } else if (TSK_WIFI_NETWORK_ADAPTER.getTypeID() == artifactTypeId) { + assembleWifiNetworkAdapter(uuid, artifact, output); + } else if (TSK_VERIFICATION_FAILED.getTypeID() == artifactTypeId) { + assembleVerificationFailed(uuid, artifact, output); + } else if (TSK_DATA_SOURCE_USAGE.getTypeID() == artifactTypeId) { + assembleDataSourceUsage(uuid, artifact, output); + } else if (TSK_WEB_FORM_ADDRESS.getTypeID() == artifactTypeId) { + assembleWebFormAddress(uuid, artifact, output); + } else if (TSK_WEB_CACHE.getTypeID() == artifactTypeId) { + assembleWebCache(uuid, artifact, output); + } else if (TSK_TL_EVENT.getTypeID() == artifactTypeId) { + assembleTimelineEvent(uuid, artifact, output); + } else if (TSK_CLIPBOARD_CONTENT.getTypeID() == artifactTypeId) { + assembleClipboardContent(uuid, artifact, output); + } else if (TSK_ASSOCIATED_OBJECT.getTypeID() == artifactTypeId) { + assembleAssociatedObject(uuid, artifact, output); + } else if (TSK_USER_CONTENT_SUSPECTED.getTypeID() == artifactTypeId) { + assembleUserContentSuspected(uuid, artifact, output); + } else if (TSK_METADATA.getTypeID() == artifactTypeId) { + assembleMetadata(uuid, artifact, output); + } else if (TSK_GPS_TRACK.getTypeID() == artifactTypeId) { + assembleGpsTrack(uuid, artifact, output); + } + + if (!output.isEmpty()) { + return output; + } + + throw new ContentNotExportableException(); + } + + private void assembleWebCookie(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new URL() + .setFullValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL))) + .addBundle(new ContentData() + .setDataPayload(getValueIfPresent(artifact, StandardAttributeTypes.TSK_VALUE))); + + Trace cookieDomainNode = new BlankTraceNode() + .addBundle(new DomainName() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))); + + Trace applicationNode = new BlankTraceNode() + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + BrowserCookie cookie = new BrowserCookie() + .setCookieName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)) + .setCookieDomain(cookieDomainNode) + .setApplication(applicationNode) + .setAccessedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_START)) + .setExpirationTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_END)); + cookie.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + + export.addBundle(cookie); + + output.add(export); + output.add(cookieDomainNode); + output.add(applicationNode); + } + + private void assembleWebBookmark(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace applicationNode = new BlankTraceNode() + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + BrowserBookmark bookmark = new BrowserBookmark() + .setUrlTargeted(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL)) + .setApplication(applicationNode); + bookmark.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + bookmark.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + + Trace export = new Trace(uuid) + .addBundle(bookmark) + .addBundle(new DomainName() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))); + + output.add(export); + output.add(applicationNode); + } + + private void assembleGenInfo(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Hash hash = new Hash(uuid, getValueIfPresent(artifact, StandardAttributeTypes.TSK_HASH_PHOTODNA)); + output.add(hash); + } + + private void assembleWebHistory(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace userNameNode = new BlankTraceNode(); + + IdentityFacet identityFacet = new IdentityFacet(); + identityFacet.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_USER_NAME)); + userNameNode.addBundle(identityFacet); + + Trace export = new Trace(uuid) + .addBundle(new URL() + .setUserName(userNameNode) + .setFullValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL))) + .addBundle(new DomainName() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + output.add(export); + output.add(userNameNode); + } + + private void assembleWebDownload(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new URL() + .setFullValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL))) + .addBundle(new DomainName() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))) + .addBundle(new File() + .setFilePath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH))) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + output.add(export); + } + + private void assembleDeviceAttached(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Device() + .setManufacturer(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_MAKE)) + .setModel(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_MODEL)) + .setId(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_ID))) + .addBundle(new MACAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_MAC_ADDRESS))); + + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + output.add(export); + } + + private void assembleHashsetHit(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid); + export.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_SET_NAME)); + export.setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + + output.add(export); + } + + private void assembleInstalledProg(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new File() + .setFilePath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH_SOURCE))); + Software software = new Software(); + software.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME)); + export.addBundle(software); + + File file = new File() + .setFilePath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH)); + file.setModifiedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + file.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + export.addBundle(file); + + output.add(export); + } + + private void assembleRecentObject(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + WindowsRegistryValue registryValue = new WindowsRegistryValue() + .setData(getValueIfPresent(artifact, StandardAttributeTypes.TSK_VALUE)); + registryValue.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + + export.addBundle(registryValue); + + File file = new File() + .setAccessedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_ACCESSED)); + file.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + export.addBundle(file); + + output.add(export); + + Assertion assertion = new BlankAssertionNode() + .setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + output.add(assertion); + + output.add(new BlankRelationshipNode() + .setSource(assertion.getId()) + .setTarget(uuid)); + } + + private void assembleInterestingFileHit(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid); + export.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_SET_NAME)); + export.setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + output.add(export); + } + + private void assembleExtractedText(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new ExtractedString() + .setStringValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_TEXT))); + output.add(export); + } + + private void assembleEmailMessage(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace bccNode = new BlankTraceNode() + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_BCC))); + + Trace ccNode = new BlankTraceNode() + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_CC))); + + Trace fromNode = new BlankTraceNode() + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_FROM))); + + Trace headerRawNode = new BlankTraceNode() + .addBundle(new ExtractedString() + .setStringValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_HEADERS))); + + EmailMessage emailMessage = new EmailMessage(); + String html = getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_CONTENT_HTML); + String plain = getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_CONTENT_PLAIN); + String rtf = getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_CONTENT_RTF); + + if (html != null) { + emailMessage.setBody(html); + emailMessage.setContentType("text/html"); + } else if (rtf != null) { + emailMessage.setBody(rtf); + emailMessage.setContentType("text/rtf"); + } else if (plain != null) { + emailMessage.setBody(plain); + emailMessage.setContentType("text/plain"); + } + + Trace export = new Trace(uuid) + .addBundle(emailMessage + .setReceivedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_RCVD)) + .setSentTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_SENT)) + .setBcc(bccNode) + .setCc(ccNode) + .setFrom(fromNode) + .setHeaderRaw(headerRawNode) + .setMessageID(getValueIfPresent(artifact, StandardAttributeTypes.TSK_MSG_ID)) + .setSubject(getValueIfPresent(artifact, StandardAttributeTypes.TSK_SUBJECT))) + .addBundle(new File() + .setFilePath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH))); + + output.add(export); + output.add(bccNode); + output.add(ccNode); + output.add(fromNode); + output.add(headerRawNode); + } + + private void assembleWebSearchQuery(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace applicationNode = new BlankTraceNode() + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + Trace export = new Trace(uuid) + .addBundle(new Note() + .setText(getValueIfPresent(artifact, StandardAttributeTypes.TSK_TEXT))) + .addBundle(new Domain() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))) + .addBundle(new ApplicationAccount() + .setApplication(applicationNode)); + output.add(export); + output.add(applicationNode); + } + + private void assembleOsInfo(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Identity registeredOwnerNode = new BlankIdentityNode(); + registeredOwnerNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_OWNER)); + Identity registeredOrganizationNode = new BlankIdentityNode(); + registeredOrganizationNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ORGANIZATION)); + + OperatingSystem operatingSystem = new OperatingSystem() + .setInstallDate(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)) + .setVersion(getValueIfPresent(artifact, StandardAttributeTypes.TSK_VERSION)); + operatingSystem.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME)); + + EnvironmentVariable envVar = new EnvironmentVariable() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_TEMP_DIR)); + envVar.setName("TEMP"); + Trace tempDirectoryNode = new BlankTraceNode() + .addBundle(envVar); + + Trace export = new Trace(uuid) + .addBundle(operatingSystem) + .addBundle(new DomainName() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))) + .addBundle(new Device() + .setSerialNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PRODUCT_ID))) + .addBundle(new ComputerSpecification() + .setHostName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)) + .setProcessorArchitecture(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROCESSOR_ARCHITECTURE))) + .addBundle(new WindowsComputerSpecification() + .setRegisteredOrganization(registeredOrganizationNode) + .setRegisteredOwner(registeredOwnerNode) + .setWindowsTempDirectory(tempDirectoryNode)); + output.add(export); + output.add(registeredOwnerNode); + output.add(registeredOrganizationNode); + output.add(tempDirectoryNode); + } + + private void assembleOsAccount(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL))) + .addBundle(new PathRelation() + .setPath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH))) + .addBundle(new WindowsAccount() + .setGroups(getValueIfPresent(artifact, StandardAttributeTypes.TSK_GROUPS))); + + export.setTag(getValueIfPresent(artifact, StandardAttributeTypes.TSK_FLAG)); + + DigitalAccount digitalAccount = new DigitalAccount() + .setDisplayName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DISPLAY_NAME)) + .setLastLoginTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_ACCESSED)); + digitalAccount.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + export.addBundle(digitalAccount); + + Identity ownerNode = new BlankIdentityNode(); + ownerNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + + Account account = new Account() + .setAccountType(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ACCOUNT_TYPE)) + .setOwner(ownerNode) + .setAccountIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_USER_ID)); + account.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + + export.addBundle(account); + + output.add(export); + output.add(ownerNode); + } + + private void assembleServiceAccount(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace inReplyToNode = new BlankTraceNode() + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_REPLYTO))); + + Trace export = new Trace(uuid) + .addBundle(new Account() + .setAccountType(getValueIfPresent(artifact, StandardAttributeTypes.TSK_CATEGORY))) + .addBundle(new DomainName() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DOMAIN))) + .addBundle(new EmailMessage() + .setInReplyTo(inReplyToNode)) + .addBundle(new DigitalAccount() + .setDisplayName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME))) + .addBundle(new AccountAuthentication() + .setPassword(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PASSWORD))) + .addBundle(new PathRelation() + .setPath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH))) + .addBundle(new URL() + .setFullValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL))) + .addBundle(new DigitalAccount() + .setDisplayName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_USER_NAME))); + + export.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + Trace applicationNode = new BlankTraceNode() + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + ApplicationAccount account = new ApplicationAccount() + .setApplication(applicationNode); + account.setId(getValueIfPresent(artifact, StandardAttributeTypes.TSK_USER_ID)); + account.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + export.addBundle(account); + + output.add(export); + output.add(applicationNode); + output.add(inReplyToNode); + } + + private void assembleContact(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + EmailAddress homeAddress = new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_HOME)); + homeAddress.setTag("Home"); + + EmailAddress workAddress = new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_OFFICE)); + workAddress.setTag("Work"); + + PhoneAccount homePhone = new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_HOME)); + homePhone.setTag("Home"); + + PhoneAccount workPhone = new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_OFFICE)); + workPhone.setTag("Work"); + + PhoneAccount mobilePhone = new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_MOBILE)); + mobilePhone.setTag("Mobile"); + + Trace export = new Trace(uuid) + .addBundle(new URL() + .setFullValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL))) + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL))) + .addBundle(homeAddress) + .addBundle(workAddress) + .addBundle(new Contact() + .setContactName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME))) + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER))) + .addBundle(homePhone) + .addBundle(workPhone) + .addBundle(mobilePhone); + output.add(export); + } + + private void assembleMessage(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException, BlackboardJsonAttrUtil.InvalidJsonException { + Trace applicationNode = new BlankTraceNode() + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_MESSAGE_TYPE))); + + Trace senderNode = new BlankTraceNode() + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL_FROM))); + + Trace fromNode = new BlankTraceNode() + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_FROM))); + + Trace toNode = new BlankTraceNode() + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_TO))); + + Trace export = new Trace(uuid) + .addBundle(new Message() + .setMessageText(getValueIfPresent(artifact, StandardAttributeTypes.TSK_TEXT)) + .setApplication(applicationNode) + .setSentTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)) + .setMessageType(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DIRECTION)) + .setId(getValueIfPresent(artifact, StandardAttributeTypes.TSK_THREAD_ID))) + .addBundle(new EmailMessage() + .setSender(senderNode)) + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER))) + .addBundle(new PhoneCall() + .setFrom(fromNode) + .setTo(toNode)) + .addBundle(new SMSMessage() + .setIsRead(getIntegerIfPresent(artifact, StandardAttributeTypes.TSK_READ_STATUS))); + + BlackboardAttribute attachments = artifact.getAttribute(StandardAttributeTypes.TSK_ATTACHMENTS); + if (attachments != null) { + MessageAttachments attachmentsContainer = BlackboardJsonAttrUtil.fromAttribute(attachments, MessageAttachments.class); + List<MessageAttachments.Attachment> tskAttachments = new ArrayList<>(); + tskAttachments.addAll(attachmentsContainer.getUrlAttachments()); + tskAttachments.addAll(attachmentsContainer.getFileAttachments()); + + tskAttachments.forEach((tskAttachment) -> { + export.addBundle(new Attachment() + .setUrl(tskAttachment.getLocation()) + ); + }); + } + + output.add(export); + output.add(applicationNode); + output.add(senderNode); + output.add(fromNode); + output.add(toNode); + } + + private void assembleMetadataExif(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Device() + .setManufacturer(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_MAKE)) + .setModel(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_MODEL))) + .addBundle(new LatLongCoordinates() + .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) + .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) + .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))); + + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + output.add(export); + } + + private void assembleCallog(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace fromNode = new BlankTraceNode() + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_FROM))); + + Trace toNode = new BlankTraceNode() + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER_TO))); + + Trace export = new Trace(uuid) + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER))) + .addBundle(new PhoneCall() + .setFrom(fromNode) + .setTo(toNode) + .setEndTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_END)) + .setStartTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_START)) + .setCallType(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DIRECTION))) + .addBundle(new Contact() + .setContactName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME))); + + output.add(export); + output.add(toNode); + output.add(fromNode); + } + + private void assembleCalendarEntry(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid); + + CalendarEntry calendarEntry = new CalendarEntry() + .setStartTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_START)) + .setEndTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_END)) + .setEventType(getValueIfPresent(artifact, StandardAttributeTypes.TSK_CALENDAR_ENTRY_TYPE)); + + calendarEntry.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + BlankLocationNode locationNode = new BlankLocationNode(); + locationNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + + calendarEntry.setLocation(locationNode); + export.addBundle(calendarEntry); + + output.add(export); + output.add(locationNode); + } + + private void assembleSpeedDialEntry(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Contact() + .setContactName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME_PERSON))) + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER))); + + output.add(export); + } + + private void assembleBluetoothPairing(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new MobileDevice() + .setBluetoothDeviceName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_NAME))) + .addBundle(new MACAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_MAC_ADDRESS))); + + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + output.add(export); + } + + private void assembleGpsBookmark(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new LatLongCoordinates() + .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) + .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) + .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + + SimpleAddress simpleAddress = new SimpleAddress(); + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addBundle(simpleAddress); + + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + export.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + output.add(export); + } + + private void assembleGpsLastKnownLocation(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new LatLongCoordinates() + .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) + .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) + .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))); + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + BlankLocationNode locationNode = new BlankLocationNode(); + locationNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + + SimpleAddress simpleAddress = new SimpleAddress(); + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addBundle(simpleAddress); + + output.add(export); + output.add(locationNode); + output.add(new BlankRelationshipNode() + .setSource(locationNode.getId()) + .setTarget(export.getId())); + } + + private void assembleGpsSearch(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new LatLongCoordinates() + .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) + .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) + .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))); + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + BlankLocationNode locationNode = new BlankLocationNode(); + locationNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + + SimpleAddress simpleAddress = new SimpleAddress(); + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addBundle(simpleAddress); + + output.add(export); + output.add(locationNode); + output.add(new BlankRelationshipNode() + .setSource(locationNode.getId()) + .setTarget(export.getId())); + } + + private void assembleProgRun(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME)) + .setNumberOfLaunches(getIntegerIfPresent(artifact, StandardAttributeTypes.TSK_COUNT))); + + output.add(export); + } + + private void assembleEncryptionDetected(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid) + .setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + + output.add(export); + } + + private void assembleInterestingArtifact(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid); + export.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_SET_NAME)); + export.setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + + Long associatedArtifactId = getLongIfPresent(artifact, StandardAttributeTypes.TSK_ASSOCIATED_ARTIFACT); + if (associatedArtifactId != null) { + BlackboardArtifact associatedArtifact = artifact.getSleuthkitCase().getBlackboardArtifact(associatedArtifactId); + + output.add(new BlankRelationshipNode() + .setSource(export.getId()) + .setTarget(this.uuidService.createUUID(associatedArtifact))); + } + + output.add(export); + } + + private void assembleGPSRoute(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + SimpleAddress simpleAddress = new SimpleAddress(); + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addBundle(simpleAddress); + + Location location = new BlankLocationNode(); + location.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + + output.add(export); + output.add(location); + output.add(new BlankRelationshipNode() + .setSource(location.getId()) + .setTarget(export.getId())); + } + + private void assembleRemoteDrive(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new PathRelation() + .setPath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_REMOTE_PATH))) + .addBundle(new PathRelation() + .setPath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCAL_PATH))); + + output.add(export); + } + + private void assembleAccount(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Account account = new Account() + .setAccountType(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ACCOUNT_TYPE)) + .setAccountIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ID)); + + Account creditCardAccount = new Account() + .setAccountIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_CARD_NUMBER)); + + creditCardAccount.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_SET_NAME)); + Trace export = new Trace(uuid) + .addBundle(account) + .addBundle(creditCardAccount); + + output.add(export); + } + + private void assembleEncryptionSuspected(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid) + .setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + + output.add(export); + } + + private void assembleObjectDetected(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid) + .setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + export.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + output.add(export); + } + + private void assembleWifiNetwork(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + WirelessNetworkConnection wirelessNetwork = new WirelessNetworkConnection() + .setSSID(getValueIfPresent(artifact, StandardAttributeTypes.TSK_SSID)); + + wirelessNetwork.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + String networkId = getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_ID); + if (networkId != null) { + wirelessNetwork.setId("_:" + networkId); + } + + Trace export = new Trace(uuid) + .addBundle(wirelessNetwork); + + output.add(export); + } + + private void assembleDeviceInfo(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new MobileDevice() + .setIMEI(getValueIfPresent(artifact, StandardAttributeTypes.TSK_IMEI))) + .addBundle(new SIMCard() + .setICCID(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ICCID)) + .setIMSI(getValueIfPresent(artifact, StandardAttributeTypes.TSK_IMSI))); + + output.add(export); + } + + private void assembleSimAttached(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new SIMCard() + .setICCID(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ICCID)) + .setIMSI(getValueIfPresent(artifact, StandardAttributeTypes.TSK_IMSI))); + + output.add(export); + } + + private void assembleBluetoothAdapter(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new MACAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_MAC_ADDRESS))); + + output.add(export); + } + + private void assembleWifiNetworkAdapter(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new MACAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_MAC_ADDRESS))); + + output.add(export); + } + + private void assembleVerificationFailed(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid); + export.setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + + output.add(export); + } + + private void assembleDataSourceUsage(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid); + export.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + output.add(export); + } + + private void assembleWebFormAddress(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + SimpleAddress simpleAddress = new SimpleAddress(); + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + + Trace export = new Trace(uuid) + .addBundle(simpleAddress) + .addBundle(new EmailAddress() + .setValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_EMAIL))) + .addBundle(new PhoneAccount() + .setPhoneNumber(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PHONE_NUMBER))); + + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_ACCESSED)); + export.setModifiedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_MODIFIED)); + + Person person = new BlankPersonNode(); + person.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME_PERSON)); + + output.add(export); + output.add(person); + output.add(new BlankRelationshipNode() + .setSource(person.getId()) + .setTarget(export.getId())); + + } + + private void assembleWebCache(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new PathRelation() + .setPath(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PATH))) + .addBundle(new URL() + .setFullValue(getValueIfPresent(artifact, StandardAttributeTypes.TSK_URL))) + .addBundle(new HTTPConnection() + .setHttpRequestHeader(getValueIfPresent(artifact, StandardAttributeTypes.TSK_HEADERS))); + + export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + + output.add(export); + } + + private void assembleTimelineEvent(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Action export = new Action(uuid) + .setStartTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); + + export.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + Long eventType = getLongIfPresent(artifact, StandardAttributeTypes.TSK_TL_EVENT_TYPE); + if (eventType != null) { + Optional<TimelineEventType> timelineEventType = artifact.getSleuthkitCase() + .getTimelineManager() + .getEventType(eventType); + if (timelineEventType.isPresent()) { + Trace actionArg = new BlankTraceNode() + .addBundle(new ActionArgument() + .setArgumentName(timelineEventType.get().getDisplayName())); + + output.add(actionArg); + output.add(new BlankRelationshipNode() + .setSource(actionArg.getId()) + .setTarget(export.getId())); + } + } + + output.add(export); + } + + private void assembleClipboardContent(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Note() + .setText(getValueIfPresent(artifact, StandardAttributeTypes.TSK_TEXT))); + + output.add(export); + } + + private void assembleAssociatedObject(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid); + output.add(export); + + BlackboardAttribute associatedArtifactID = artifact.getAttribute(StandardAttributeTypes.TSK_ASSOCIATED_ARTIFACT); + if (associatedArtifactID != null) { + long artifactID = associatedArtifactID.getValueLong(); + BlackboardArtifact associatedArtifact = artifact.getSleuthkitCase().getArtifactByArtifactId(artifactID); + if (associatedArtifact != null) { + output.add(new BlankRelationshipNode() + .setSource(uuid) + .setTarget(this.uuidService.createUUID(associatedArtifact))); + } + } + } + + private void assembleUserContentSuspected(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Assertion export = new Assertion(uuid); + export.setStatement(getValueIfPresent(artifact, StandardAttributeTypes.TSK_COMMENT)); + + output.add(export); + } + + private void assembleMetadata(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException { + Trace export = new Trace(uuid) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME)) + .setVersion(getValueIfPresent(artifact, StandardAttributeTypes.TSK_VERSION))); + + ContentData contentData = new ContentData(); + contentData.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_CREATED)); + contentData.setModifiedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME_MODIFIED)); + contentData.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DESCRIPTION)); + + Identity owner = new BlankIdentityNode(); + owner.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_OWNER)); + contentData.setOwner(owner); + export.addBundle(contentData); + + ContentData contentDataTwo = new ContentData(); + contentDataTwo.setTag("Last Printed"); + contentDataTwo.setModifiedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_LAST_PRINTED_DATETIME)); + export.addBundle(contentDataTwo); + + Organization organization = new BlankOrganizationNode(); + organization.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_ORGANIZATION)); + + Identity lastAuthor = new BlankIdentityNode(); + lastAuthor.setTag("Last Author"); + lastAuthor.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_USER_ID)); + + output.add(export); + output.add(owner); + output.add(organization); + output.add(new BlankRelationshipNode() + .setSource(organization.getId()) + .setTarget(export.getId())); + output.add(lastAuthor); + output.add(new BlankRelationshipNode() + .setSource(lastAuthor.getId()) + .setTarget(export.getId())); + } + + private void assembleGpsTrack(String uuid, BlackboardArtifact artifact, List<UcoObject> output) throws TskCoreException, BlackboardJsonAttrUtil.InvalidJsonException { + Trace export = new Trace(uuid) + .addBundle(new Application() + .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); + export.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); + + BlackboardAttribute trackpoints = artifact.getAttribute(StandardAttributeTypes.TSK_GEO_TRACKPOINTS); + if (trackpoints != null) { + GeoTrackPoints points = BlackboardJsonAttrUtil.fromAttribute(trackpoints, GeoTrackPoints.class); + for (GeoTrackPoints.TrackPoint point : points) { + export.addBundle(new LatLongCoordinates() + .setAltitude(point.getAltitude()) + .setLatitude(point.getLatitude()) + .setLongitude(point.getLongitude())); + } + } + + output.add(export); + } + + /** + * Pulls the attribute type from the artifact and returns its value if + * present. Should only be called on BlackboardAttribute types that hold + * integer values. + */ + private Integer getIntegerIfPresent(BlackboardArtifact artifact, BlackboardAttribute.Type type) throws TskCoreException { + if (artifact.getAttribute(type) != null) { + return artifact.getAttribute(type).getValueInt(); + } else { + return null; + } + } + + /** + * Pulls the attribute type from the artifact and returns its value if + * present. Should only be called on BlackboardAttribute types that hold + * double values. + */ + private Double getDoubleIfPresent(BlackboardArtifact artifact, BlackboardAttribute.Type type) throws TskCoreException { + if (artifact.getAttribute(type) != null) { + return artifact.getAttribute(type).getValueDouble(); + } else { + return null; + } + } + + /** + * Pulls the attribute type from the artifact and returns its value if + * present. Should only be called on BlackboardAttribute types that hold + * long values. + */ + private Long getLongIfPresent(BlackboardArtifact artifact, BlackboardAttribute.Type type) throws TskCoreException { + if (artifact.getAttribute(type) != null) { + return artifact.getAttribute(type).getValueLong(); + } else { + return null; + } + } + + /** + * Pulls the attribute type from the artifact and returns its value as a + * string if present. This operation is valid for all attribute types. + */ + private String getValueIfPresent(BlackboardArtifact artifact, BlackboardAttribute.Type type) throws TskCoreException { + if (artifact.getAttribute(type) != null) { + return artifact.getAttribute(type).getDisplayString(); + } else { + return null; + } + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoUUIDService.java b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoUUIDService.java new file mode 100755 index 0000000000000000000000000000000000000000..23d8265149ab7f8680bb5b7b647509a1f9814664 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoUUIDService.java @@ -0,0 +1,41 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.ContentTag; + +/** + * Providing a way to customize UUIDs is a necessary feature to promote the + * reuse of the CaseUcoExporter class. IDs in a REST API use case would prefer + * links to the relevant endpoints and IDs in a standalone TSK application may + * prefer a combination of object id, case id, and time stamp. A runtime object + * that provides this service is a good way to address content objects that + * reference other content objects. For example, when the CaesUcoExporter is + * asked to export a TSK_ASSOCIATED_ARTIFACT_HIT or a ContentTag, it'll also + * need to export the reference to the underlying content as well. It wouldn't + * be very user friendly if we asked for these IDs up front, so instead it's + * quite handy to have some service that can be set once and forgotten about + * during execution. + */ +public interface CaseUcoUUIDService { + + public String createUUID(Content content); + public String createUUID(ContentTag contentTag); +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoUUIDServiceImpl.java b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoUUIDServiceImpl.java new file mode 100755 index 0000000000000000000000000000000000000000..7b1fcd424588838eb7351e5c168e1df89cfe28a8 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoUUIDServiceImpl.java @@ -0,0 +1,47 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.ContentTag; +import org.sleuthkit.datamodel.SleuthkitCase; + +/** + * Default implementation for generating unique @id properties in the CASE + * output. The default values consist of the CaseDB name and + * the content id. + */ +class CaseUcoUUIDServiceImpl implements CaseUcoUUIDService { + + private final String databaseName; + + CaseUcoUUIDServiceImpl(SleuthkitCase sleuthkitCase) { + this.databaseName = sleuthkitCase.getDatabaseName(); + } + + @Override + public String createUUID(Content content) { + return "content" + "-" + content.getId() + "_" + databaseName; + } + + @Override + public String createUUID(ContentTag contentTag) { + return "tag" + "-" + contentTag.getId() + "_" + databaseName; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ComputerSpecification.java b/case-uco/java/src/org/sleuthkit/caseuco/ComputerSpecification.java new file mode 100755 index 0000000000000000000000000000000000000000..06e257896ee4c4e916db7b78650025522b0c8aa6 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/ComputerSpecification.java @@ -0,0 +1,47 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import com.google.gson.annotations.SerializedName; + +/** + * This class definition mirrors the ComupterSpecification observable described + * in the UCO ontology. + */ +class ComputerSpecification extends Facet { + + @SerializedName("hostname") + private String hostName; + + private String processorArchitecture; + + ComputerSpecification() { + super(ComputerSpecification.class.getSimpleName()); + } + + ComputerSpecification setHostName(String hostName) { + this.hostName = hostName; + return this; + } + + ComputerSpecification setProcessorArchitecture(String processorArchitecture) { + this.processorArchitecture = processorArchitecture; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Contact.java b/case-uco/java/src/org/sleuthkit/caseuco/Contact.java new file mode 100755 index 0000000000000000000000000000000000000000..f1b180b8fb059283a85c8d920902ed594d0164ca --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Contact.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Contact observable described in the UCO + * ontology. + */ +class Contact extends Facet { + + private String contactName; + + Contact() { + super(Contact.class.getSimpleName()); + } + + Contact setContactName(String contactName) { + this.contactName = contactName; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ContentData.java b/case-uco/java/src/org/sleuthkit/caseuco/ContentData.java new file mode 100755 index 0000000000000000000000000000000000000000..9d6e85485a64fb7d6c1de85f0fd7500bc5ab5b73 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/ContentData.java @@ -0,0 +1,75 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; + +import org.sleuthkit.caseuco.Hash.HashMethod; + +/** + * This class definition mirrors the ContentData observable described in the UCO + * ontology. + */ +class ContentData extends Facet { + + private Long sizeInBytes; + + private String mimeType; + + @SerializedName("hash") + private final List<Hash> hashes; + + private String dataPayload; + + private String owner; + + ContentData() { + super(ContentData.class.getSimpleName()); + this.hashes = new ArrayList<>(); + } + + ContentData setSizeInBytes(long bytes) { + this.sizeInBytes = bytes; + return this; + } + + ContentData setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + ContentData setMd5Hash(String md5Hash) { + Hash md5HashType = new Hash(md5Hash) + .setHashMethod(HashMethod.MD5); + hashes.add(md5HashType); + return this; + } + + ContentData setDataPayload(String dataPayload) { + this.dataPayload = dataPayload; + return this; + } + + ContentData setOwner(Identity owner) { + this.owner = owner.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ContentNotExportableException.java b/case-uco/java/src/org/sleuthkit/caseuco/ContentNotExportableException.java new file mode 100755 index 0000000000000000000000000000000000000000..abb248ce9650f1dac409be952c53154c1b5f8892 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/ContentNotExportableException.java @@ -0,0 +1,26 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * Indicates that the content could not be exported, even in part, to CASE. + */ +public class ContentNotExportableException extends Exception { + private static final long serialVersionUID = 1L; +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/CyberItem.java b/case-uco/java/src/org/sleuthkit/caseuco/CyberItem.java new file mode 100755 index 0000000000000000000000000000000000000000..d6ac1ba550b871263ef4e83248d08d74870ef07f --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/CyberItem.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the core CyberItem object described in the UCO + * ontology. + */ +class CyberItem extends UcoObject { + + CyberItem(String id, String type) { + super(id, type); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Device.java b/case-uco/java/src/org/sleuthkit/caseuco/Device.java new file mode 100755 index 0000000000000000000000000000000000000000..74c0ff84de07fa9f51d30ceb17660d2e0441aafb --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Device.java @@ -0,0 +1,57 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Device observable described in the UCO + * ontology. + */ +class Device extends Facet { + + private String manufacturer; + + private String model; + + private String serialNumber; + + Device() { + super(Device.class.getSimpleName()); + } + + Device setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + return this; + } + + Device setModel(String model) { + this.model = model; + return this; + } + + @Override + Device setId(String id) { + super.setId("_:" + id); + return this; + } + + Device setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/DigitalAccount.java b/case-uco/java/src/org/sleuthkit/caseuco/DigitalAccount.java new file mode 100755 index 0000000000000000000000000000000000000000..b277b7b7c2aa7e8f861712b61e27dd9c3ce30d78 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/DigitalAccount.java @@ -0,0 +1,49 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the DigitalAccount observable described in the + * UCO ontology. + */ +class DigitalAccount extends Facet { + + private String displayName; + + private String lastLoginTime; + + DigitalAccount() { + super(DigitalAccount.class.getSimpleName()); + } + + DigitalAccount setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + DigitalAccount setLastLoginTime(Long time) { + if (time != null) { + this.lastLoginTime = Instant.ofEpochSecond(time).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Domain.java b/case-uco/java/src/org/sleuthkit/caseuco/Domain.java new file mode 100755 index 0000000000000000000000000000000000000000..bae38071a89b0d9c75f72b978a75912a2d4a6cd8 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Domain.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Domain observable described in the UCO + * ontology. + */ +class Domain extends Facet { + + private String value; + + Domain() { + super(Domain.class.getSimpleName()); + } + + Domain setValue(String value) { + this.value = value; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/DomainName.java b/case-uco/java/src/org/sleuthkit/caseuco/DomainName.java new file mode 100755 index 0000000000000000000000000000000000000000..938a07913a399a1f8479474a12ad57c201ed2c6a --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/DomainName.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the DomainName observable described in the UCO + * ontology. + */ +class DomainName extends Facet { + + private String value; + + DomainName() { + super(DomainName.class.getSimpleName()); + } + + DomainName setValue(String value) { + this.value = value; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/EmailAddress.java b/case-uco/java/src/org/sleuthkit/caseuco/EmailAddress.java new file mode 100755 index 0000000000000000000000000000000000000000..efaa4fa5f26b0d4540bfc66d5b5aa7f96910772a --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/EmailAddress.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the EmailAddress observable described in the + * UCO ontology. + */ +class EmailAddress extends Facet { + + private String value; + + EmailAddress() { + super(EmailAddress.class.getSimpleName()); + } + + EmailAddress setValue(String value) { + this.value = value; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/EmailMessage.java b/case-uco/java/src/org/sleuthkit/caseuco/EmailMessage.java new file mode 100755 index 0000000000000000000000000000000000000000..3f6e3ecabe4c7f433568507cd1a83461b1183e44 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/EmailMessage.java @@ -0,0 +1,121 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the EmailMessage observable described in the + * UCO ontology. + */ +class EmailMessage extends Facet { + + private String receivedTime; + + private String sentTime; + + private String bcc; + + private String cc; + + private String from; + + private String headerRaw; + + private String messageID; + + private String subject; + + private String sender; + + private String inReplyTo; + + private String body; + + private String contentType; + + EmailMessage() { + super(EmailMessage.class.getSimpleName()); + } + + EmailMessage setBody(String body) { + this.body = body; + return this; + } + + EmailMessage setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + EmailMessage setReceivedTime(Long receivedTime) { + if (receivedTime != null) { + this.receivedTime = Instant.ofEpochSecond(receivedTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + EmailMessage setSentTime(Long sentTime) { + if (sentTime != null) { + this.sentTime = Instant.ofEpochSecond(sentTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + EmailMessage setBcc(CyberItem bcc) { + this.bcc = bcc.getId(); + return this; + } + + EmailMessage setCc(CyberItem cc) { + this.cc = cc.getId(); + return this; + } + + EmailMessage setFrom(CyberItem from) { + this.from = from.getId(); + return this; + } + + EmailMessage setHeaderRaw(CyberItem headerRaw) { + this.headerRaw = headerRaw.getId(); + return this; + } + + EmailMessage setMessageID(String messageID) { + this.messageID = messageID; + return this; + } + + EmailMessage setSubject(String subject) { + this.subject = subject; + return this; + } + + EmailMessage setSender(CyberItem sender) { + this.sender = sender.getId(); + return this; + } + + EmailMessage setInReplyTo(CyberItem replyTo) { + this.inReplyTo = replyTo.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/EnvironmentVariable.java b/case-uco/java/src/org/sleuthkit/caseuco/EnvironmentVariable.java new file mode 100755 index 0000000000000000000000000000000000000000..833bdf731370ff4e0c90c057cf65c4f7bce815c8 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/EnvironmentVariable.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the EnvironmentVariable observable described in + * the UCO ontology. + */ +class EnvironmentVariable extends Facet { + + private String value; + + EnvironmentVariable() { + super(EnvironmentVariable.class.getSimpleName()); + } + + EnvironmentVariable setValue(String value) { + this.value = value; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ExtractedString.java b/case-uco/java/src/org/sleuthkit/caseuco/ExtractedString.java new file mode 100755 index 0000000000000000000000000000000000000000..1c099cfce1770e0056e3e666ed2a2da48a0ddfdc --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/ExtractedString.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the ExtractedString observable described in the + * UCO ontology. + */ +class ExtractedString extends Facet { + + private String stringValue; + + ExtractedString() { + super(ExtractedString.class.getSimpleName()); + } + + ExtractedString setStringValue(String stringValue) { + this.stringValue = stringValue; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Facet.java b/case-uco/java/src/org/sleuthkit/caseuco/Facet.java new file mode 100755 index 0000000000000000000000000000000000000000..ef2d918729aca894caf71921a761ac4b713b5847 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Facet.java @@ -0,0 +1,30 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the core Facet object described in the UCO + * ontology. + */ +abstract class Facet extends UcoObject { + + Facet(String type) { + super(null, type); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/File.java b/case-uco/java/src/org/sleuthkit/caseuco/File.java new file mode 100755 index 0000000000000000000000000000000000000000..e692fd8b7c4e4f32c6835224c51abe074d35205d --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/File.java @@ -0,0 +1,77 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the File observable described in the UCO + * ontology. + */ +class File extends Facet { + + private String accessedTime; + + private String extension; + + private String fileName; + + private String filePath; + + private Boolean isDirectory; + + private Long sizeInBytes; + + File() { + super(File.class.getSimpleName()); + } + + File setAccessedTime(Long accessedTime) { + if (accessedTime != null) { + this.accessedTime = Instant.ofEpochSecond(accessedTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + File setExtension(String extension) { + this.extension = extension; + return this; + } + + File setFileName(String fileName) { + this.fileName = fileName; + return this; + } + + File setFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + File setIsDirectory(boolean isDirectory) { + this.isDirectory = isDirectory; + return this; + } + + File setSizeInBytes(long sizeInBytes) { + this.sizeInBytes = sizeInBytes; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/FileSystem.java b/case-uco/java/src/org/sleuthkit/caseuco/FileSystem.java new file mode 100755 index 0000000000000000000000000000000000000000..72112fac7a721915527802d246f4a59bc55d3f44 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/FileSystem.java @@ -0,0 +1,82 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import org.sleuthkit.datamodel.TskData; +import org.sleuthkit.datamodel.TskData.TSK_FS_TYPE_ENUM; + +import static org.sleuthkit.datamodel.TskData.TSK_FS_TYPE_ENUM.TSK_FS_TYPE_EXT4; +import static org.sleuthkit.datamodel.TskData.TSK_FS_TYPE_ENUM.TSK_FS_TYPE_HFS; +import static org.sleuthkit.datamodel.TskData.TSK_FS_TYPE_ENUM.TSK_FS_TYPE_NTFS; + +/** + * This class definition mirrors the FileSystem observable described in the UCO + * ontology. + */ +class FileSystem extends Facet { + + private FileSystemType fileSystemType; + + private Long cluserSize; + + FileSystem() { + super(FileSystem.class.getSimpleName()); + } + + FileSystem setFileSystemType(TskData.TSK_FS_TYPE_ENUM fileSystemType) { + this.fileSystemType = FileSystemType.from(fileSystemType); + return this; + } + + FileSystem setCluserSize(long cluserSize) { + this.cluserSize = cluserSize; + return this; + } + + //Adapter for TSK_FS_TYPE enum + private enum FileSystemType { + BDE(null), + CPIO(null), + EXT4(TSK_FS_TYPE_EXT4), + F2FS(null), + HFS(TSK_FS_TYPE_HFS), + LVM(null), + NTFS(TSK_FS_TYPE_NTFS), + SevenZ(null), + TAR(null), + VSSVolume(null), + ZIP(null); + + private final TskData.TSK_FS_TYPE_ENUM tskType; + + private FileSystemType(TSK_FS_TYPE_ENUM tskType) { + this.tskType = tskType; + } + + private static FileSystemType from(TSK_FS_TYPE_ENUM typeToConvert) { + for (FileSystemType type : FileSystemType.values()) { + if (type.tskType == typeToConvert) { + return type; + } + } + + return null; + } + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/HTTPConnection.java b/case-uco/java/src/org/sleuthkit/caseuco/HTTPConnection.java new file mode 100755 index 0000000000000000000000000000000000000000..9a90aaa4a78f1e331d09bfefe29cb79ca06f02ff --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/HTTPConnection.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the HTTPConnection observable described in the + * UCO ontology. + */ +class HTTPConnection extends Facet { + + private String httpRequestHeader; + + HTTPConnection() { + super(HTTPConnection.class.getSimpleName()); + } + + HTTPConnection setHttpRequestHeader(String httpRequestHeader) { + this.httpRequestHeader = httpRequestHeader; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Hash.java b/case-uco/java/src/org/sleuthkit/caseuco/Hash.java new file mode 100755 index 0000000000000000000000000000000000000000..2aa257d15949b07a884f2d9545399e24c705e0c3 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Hash.java @@ -0,0 +1,51 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Hash type described in the UCO ontology. + */ +class Hash extends UcoObject { + + private HashMethod hashMethod; + + private final String hashValue; + + Hash(String hashValue) { + this(null, hashValue); + } + + Hash(String id, String hashValue) { + super(id, "Hash"); + this.hashValue = hashValue; + } + + Hash setHashMethod(HashMethod method) { + this.hashMethod = method; + return this; + } + + /** + * Describes the type of hash method that is represented by this Hash + * instance. + */ + enum HashMethod { + MD5; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Identity.java b/case-uco/java/src/org/sleuthkit/caseuco/Identity.java new file mode 100755 index 0000000000000000000000000000000000000000..a613e0e982335f9209f81ed697de30aa704d43a1 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Identity.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Core Identity object described in the UCO + * ontology. + */ +class Identity extends UcoObject { + + Identity(String id) { + super(id, Identity.class.getSimpleName()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/IdentityFacet.java b/case-uco/java/src/org/sleuthkit/caseuco/IdentityFacet.java new file mode 100755 index 0000000000000000000000000000000000000000..9eaed7603019455b8fda8d9ac658fcb5a754f9bb --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/IdentityFacet.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the IdentityFacet observable described in the + * UCO ontology. + */ +class IdentityFacet extends Facet { + + IdentityFacet() { + super(IdentityFacet.class.getSimpleName()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinates.java b/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinates.java new file mode 100755 index 0000000000000000000000000000000000000000..f040c34ff4f415ddec8b795f863966cfa93be28b --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinates.java @@ -0,0 +1,51 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the LatLongCoordinates observable described in + * the UCO ontology. + */ +class LatLongCoordinates extends Facet { + + private Double altitude; + + private Double latitude; + + private Double longitude; + + LatLongCoordinates() { + super(LatLongCoordinates.class.getSimpleName()); + } + + LatLongCoordinates setAltitude(Double altitude) { + this.altitude = altitude; + return this; + } + + LatLongCoordinates setLatitude(Double latitude) { + this.latitude = latitude; + return this; + } + + LatLongCoordinates setLongitude(Double longitude) { + this.longitude = longitude; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Location.java b/case-uco/java/src/org/sleuthkit/caseuco/Location.java new file mode 100755 index 0000000000000000000000000000000000000000..736dd4a99e8b2197f1c0265df5a5cceccb8fa84e --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Location.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the core Location object described in the UCO + * ontology. + */ +class Location extends UcoObject { + + Location(String id) { + super(id, Location.class.getSimpleName()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/MACAddress.java b/case-uco/java/src/org/sleuthkit/caseuco/MACAddress.java new file mode 100755 index 0000000000000000000000000000000000000000..c003d5a4b73b668b6afce4a5b4523553a004d31a --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/MACAddress.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the MACAddress observable described in the UCO + * ontology. + */ +class MACAddress extends Facet { + + private String value; + + MACAddress() { + super(MACAddress.class.getSimpleName()); + } + + MACAddress setValue(String value) { + this.value = value; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Message.java b/case-uco/java/src/org/sleuthkit/caseuco/Message.java new file mode 100755 index 0000000000000000000000000000000000000000..e87ad819ab0eb912ab1d37e600fdd2410765c15a --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Message.java @@ -0,0 +1,69 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the Message observable described in the UCO + * ontology. + */ +class Message extends Facet { + + private String messageText; + + private String application; + + String sentTime; + + private String messageType; + + Message() { + super(Message.class.getSimpleName()); + } + + Message setMessageText(String messageText) { + this.messageText = messageText; + return this; + } + + Message setApplication(CyberItem application) { + this.application = application.getId(); + return this; + } + + Message setSentTime(Long sentTime) { + if (sentTime != null) { + this.sentTime = Instant.ofEpochSecond(sentTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + Message setMessageType(String messageType) { + this.messageType = messageType; + return this; + } + + @Override + Message setId(String id) { + super.setId("_:" + id); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/MobileDevice.java b/case-uco/java/src/org/sleuthkit/caseuco/MobileDevice.java new file mode 100755 index 0000000000000000000000000000000000000000..c7126499c7e65483ead10fde68f026d741ed6069 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/MobileDevice.java @@ -0,0 +1,44 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the MobileDevice observable described in the + * UCO ontology. + */ +class MobileDevice extends Facet { + + private String bluetoothDeviceName; + + private String IMEI; + + MobileDevice() { + super(MobileDevice.class.getSimpleName()); + } + + MobileDevice setBluetoothDeviceName(String bluetoothDeviceName) { + this.bluetoothDeviceName = bluetoothDeviceName; + return this; + } + + MobileDevice setIMEI(String IMEI) { + this.IMEI = IMEI; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Note.java b/case-uco/java/src/org/sleuthkit/caseuco/Note.java new file mode 100755 index 0000000000000000000000000000000000000000..e71b73950312f07df5d59cef495320e80fdbe494 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Note.java @@ -0,0 +1,38 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Note observable described in the UCO + * ontology. + */ +class Note extends Facet { + + private String text; + + Note() { + super(Note.class.getSimpleName()); + } + + Note setText(String text) { + this.text = text; + return this; + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/OperatingSystem.java b/case-uco/java/src/org/sleuthkit/caseuco/OperatingSystem.java new file mode 100755 index 0000000000000000000000000000000000000000..1492938d880888a5f0e5b08e2d50730f2e186843 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/OperatingSystem.java @@ -0,0 +1,49 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the OperatingSystem observable described in the + * UCO ontology. + */ +class OperatingSystem extends Facet { + + private String installDate; + + private String version; + + OperatingSystem() { + super(OperatingSystem.class.getSimpleName()); + } + + OperatingSystem setInstallDate(Long installDate) { + if (installDate != null) { + this.installDate = Instant.ofEpochSecond(installDate).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + OperatingSystem setVersion(String version) { + this.version = version; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Organization.java b/case-uco/java/src/org/sleuthkit/caseuco/Organization.java new file mode 100755 index 0000000000000000000000000000000000000000..bf9d3319588a06ebb2ff42dd322579a20b62e8a4 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Organization.java @@ -0,0 +1,30 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Organization object described in the UCO + * ontology. + */ +class Organization extends UcoObject { + + Organization(String id) { + super(id, Organization.class.getSimpleName()); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/PathRelation.java b/case-uco/java/src/org/sleuthkit/caseuco/PathRelation.java new file mode 100755 index 0000000000000000000000000000000000000000..af9aeeba8c5851a5fba3d1a70831c62448b0ab25 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/PathRelation.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the PathRelation observable described in the + * UCO ontology. + */ +class PathRelation extends Facet { + + private String path; + + PathRelation() { + super(PathRelation.class.getSimpleName()); + } + + PathRelation setPath(String path) { + this.path = path; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Person.java b/case-uco/java/src/org/sleuthkit/caseuco/Person.java new file mode 100755 index 0000000000000000000000000000000000000000..ef63d6b9549d9f08178b7a4f4d111a3d9a7926da --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Person.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Person object described in the UCO + * ontology. + */ +class Person extends UcoObject { + + Person(String id) { + super(id, Person.class.getSimpleName()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/PhoneAccount.java b/case-uco/java/src/org/sleuthkit/caseuco/PhoneAccount.java new file mode 100755 index 0000000000000000000000000000000000000000..04b722b2421727b96beed607b72cc23f97540670 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/PhoneAccount.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the PhoneAccount observable described in the + * UCO ontology. + */ +class PhoneAccount extends Facet { + + private String phoneNumber; + + PhoneAccount() { + super(PhoneAccount.class.getSimpleName()); + } + + PhoneAccount setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/PhoneCall.java b/case-uco/java/src/org/sleuthkit/caseuco/PhoneCall.java new file mode 100755 index 0000000000000000000000000000000000000000..7eb6b9756c54e10c67ba5466a1a7329729c0402c --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/PhoneCall.java @@ -0,0 +1,72 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * This class definition mirrors the PhoneCall observable described in the UCO + * ontology. + */ +class PhoneCall extends Facet { + + private String to; + + private String from; + + private String startTime; + + private String endTime; + + private String callType; + + PhoneCall() { + super(PhoneCall.class.getSimpleName()); + } + + PhoneCall setTo(CyberItem to) { + this.to = to.getId(); + return this; + } + + PhoneCall setFrom(CyberItem from) { + this.from = from.getId(); + return this; + } + + PhoneCall setStartTime(Long startTime) { + if (startTime != null) { + this.startTime = Instant.ofEpochSecond(startTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + PhoneCall setEndTime(Long endTime) { + if (endTime != null) { + this.endTime = Instant.ofEpochSecond(endTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + PhoneCall setCallType(String callType) { + this.callType = callType; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Relationship.java b/case-uco/java/src/org/sleuthkit/caseuco/Relationship.java new file mode 100755 index 0000000000000000000000000000000000000000..f8a18995f382c7944efafb4c67ea856e80e7dd52 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Relationship.java @@ -0,0 +1,44 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the core Relationship object described in the + * UCO ontology. + */ +class Relationship extends UcoObject { + + private String source; + + private String target; + + Relationship(String id) { + super(id, "Relationship"); + } + + Relationship setSource(String source) { + this.source = source; + return this; + } + + Relationship setTarget(String target) { + this.target = target; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/SIMCard.java b/case-uco/java/src/org/sleuthkit/caseuco/SIMCard.java new file mode 100755 index 0000000000000000000000000000000000000000..e1dad6c46920cdf0ee6e0d33953e8bd125fae4c7 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/SIMCard.java @@ -0,0 +1,44 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the SIMCard observable described in the UCO + * ontology. + */ +class SIMCard extends Facet { + + private String IMSI; + + private String ICCID; + + SIMCard() { + super(SIMCard.class.getSimpleName()); + } + + SIMCard setIMSI(String IMSI) { + this.IMSI = IMSI; + return this; + } + + SIMCard setICCID(String ICCID) { + this.ICCID = ICCID; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/SMSMessage.java b/case-uco/java/src/org/sleuthkit/caseuco/SMSMessage.java new file mode 100755 index 0000000000000000000000000000000000000000..170ee6864867874155066e4f19db95d39fe5a1cc --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/SMSMessage.java @@ -0,0 +1,39 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the SMSMessage observable described in the UCO + * ontology. + */ +class SMSMessage extends Facet { + + Boolean isRead; + + SMSMessage() { + super(SMSMessage.class.getSimpleName()); + } + + SMSMessage setIsRead(Integer status) { + if (status != null) { + this.isRead = status == 1; + } + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/SimpleAddress.java b/case-uco/java/src/org/sleuthkit/caseuco/SimpleAddress.java new file mode 100755 index 0000000000000000000000000000000000000000..76738acf191ed3f61b18df491a267672d36b4a0d --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/SimpleAddress.java @@ -0,0 +1,31 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the SimpleAddress observable described in the + * UCO ontology. + */ +class SimpleAddress extends Facet { + + SimpleAddress() { + super(SimpleAddress.class.getSimpleName()); + } + +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Software.java b/case-uco/java/src/org/sleuthkit/caseuco/Software.java new file mode 100755 index 0000000000000000000000000000000000000000..ecb36ef01070a79dc0e7b60cf08179ed04c6cdda --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Software.java @@ -0,0 +1,30 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Software observable described in the UCO + * ontology. + */ +class Software extends Facet { + + Software() { + super(Software.class.getSimpleName()); + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/StandardAttributeTypes.java b/case-uco/java/src/org/sleuthkit/caseuco/StandardAttributeTypes.java new file mode 100755 index 0000000000000000000000000000000000000000..8831edbc9c8d4fe2c01621c5f4f2ed0897f76f7c --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/StandardAttributeTypes.java @@ -0,0 +1,114 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; + +/** + * Convenience class for accessing blackboard attributes using the naming scheme + * found in the ATTRIBUTE_TYPE enum. + */ +class StandardAttributeTypes { + + static final BlackboardAttribute.Type TSK_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_NAME); + static final BlackboardAttribute.Type TSK_DATETIME_CREATED = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); + static final BlackboardAttribute.Type TSK_PROG_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PROG_NAME); + static final BlackboardAttribute.Type TSK_DOMAIN = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DOMAIN); + static final BlackboardAttribute.Type TSK_URL = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_URL); + static final BlackboardAttribute.Type TSK_USER_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_NAME); + static final BlackboardAttribute.Type TSK_DATETIME_ACCESSED = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED); + static final BlackboardAttribute.Type TSK_DATETIME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME); + static final BlackboardAttribute.Type TSK_VALUE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_VALUE); + static final BlackboardAttribute.Type TSK_PATH = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH); + static final BlackboardAttribute.Type TSK_PATH_SOURCE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH_SOURCE); + static final BlackboardAttribute.Type TSK_COMMENT = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_COMMENT); + static final BlackboardAttribute.Type TSK_SET_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_SET_NAME); + static final BlackboardAttribute.Type TSK_DEVICE_MAKE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DEVICE_MAKE); + static final BlackboardAttribute.Type TSK_DEVICE_MODEL = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DEVICE_MODEL); + static final BlackboardAttribute.Type TSK_DEVICE_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DEVICE_ID); + static final BlackboardAttribute.Type TSK_MAC_ADDRESS = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_MAC_ADDRESS); + static final BlackboardAttribute.Type TSK_PATH_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH_ID); + static final BlackboardAttribute.Type TSK_DATETIME_START = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_START); + static final BlackboardAttribute.Type TSK_DATETIME_END = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_END); + static final BlackboardAttribute.Type TSK_HASH_PHOTODNA = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_HASH_PHOTODNA); + static final BlackboardAttribute.Type TSK_EMAIL_CONTENT_HTML = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML); + static final BlackboardAttribute.Type TSK_EMAIL_CONTENT_PLAIN = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN); + static final BlackboardAttribute.Type TSK_EMAIL_CONTENT_RTF = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF); + static final BlackboardAttribute.Type TSK_DATETIME_RCVD = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_RCVD); + static final BlackboardAttribute.Type TSK_DATETIME_SENT = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_SENT); + static final BlackboardAttribute.Type TSK_EMAIL_BCC = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_BCC); + static final BlackboardAttribute.Type TSK_EMAIL_CC = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_CC); + static final BlackboardAttribute.Type TSK_EMAIL_FROM = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_FROM); + static final BlackboardAttribute.Type TSK_EMAIL_TO = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_TO); + static final BlackboardAttribute.Type TSK_HEADERS = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_HEADERS); + static final BlackboardAttribute.Type TSK_MSG_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_MSG_ID); + static final BlackboardAttribute.Type TSK_SUBJECT = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_SUBJECT); + static final BlackboardAttribute.Type TSK_TEXT = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_TEXT); + static final BlackboardAttribute.Type TSK_VERSION = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_VERSION); + static final BlackboardAttribute.Type TSK_PRODUCT_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PRODUCT_ID); + static final BlackboardAttribute.Type TSK_PROCESSOR_ARCHITECTURE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PROCESSOR_ARCHITECTURE); + static final BlackboardAttribute.Type TSK_ORGANIZATION = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ORGANIZATION); + static final BlackboardAttribute.Type TSK_OWNER = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_OWNER); + static final BlackboardAttribute.Type TSK_TEMP_DIR = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_TEMP_DIR); + static final BlackboardAttribute.Type TSK_GEO_ALTITUDE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + static final BlackboardAttribute.Type TSK_GEO_LATITUDE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); + static final BlackboardAttribute.Type TSK_GEO_LONGITUDE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); + static final BlackboardAttribute.Type TSK_EMAIL = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL); + static final BlackboardAttribute.Type TSK_PHONE_NUMBER = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER); + static final BlackboardAttribute.Type TSK_PHONE_NUMBER_TO = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO); + static final BlackboardAttribute.Type TSK_PHONE_NUMBER_FROM = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM); + static final BlackboardAttribute.Type TSK_PHONE_NUMBER_HOME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_HOME); + static final BlackboardAttribute.Type TSK_PHONE_NUMBER_MOBILE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_MOBILE); + static final BlackboardAttribute.Type TSK_PHONE_NUMBER_OFFICE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_OFFICE); + static final BlackboardAttribute.Type TSK_EMAIL_HOME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_HOME); + static final BlackboardAttribute.Type TSK_EMAIL_OFFICE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_OFFICE); + static final BlackboardAttribute.Type TSK_MESSAGE_TYPE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE); + static final BlackboardAttribute.Type TSK_DIRECTION = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DIRECTION); + static final BlackboardAttribute.Type TSK_READ_STATUS = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_READ_STATUS); + static final BlackboardAttribute.Type TSK_THREAD_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_THREAD_ID); + static final BlackboardAttribute.Type TSK_CATEGORY = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_CATEGORY); + static final BlackboardAttribute.Type TSK_EMAIL_REPLYTO = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_EMAIL_REPLYTO); + static final BlackboardAttribute.Type TSK_PASSWORD = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PASSWORD); + static final BlackboardAttribute.Type TSK_USER_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_ID); + static final BlackboardAttribute.Type TSK_ACCOUNT_TYPE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE); + static final BlackboardAttribute.Type TSK_DISPLAY_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DISPLAY_NAME); + static final BlackboardAttribute.Type TSK_DESCRIPTION = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DESCRIPTION); + static final BlackboardAttribute.Type TSK_GROUPS = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_GROUPS); + static final BlackboardAttribute.Type TSK_ATTACHMENTS = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ATTACHMENTS); + static final BlackboardAttribute.Type TSK_FLAG = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_FLAG); + static final BlackboardAttribute.Type TSK_COUNT = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_COUNT); + static final BlackboardAttribute.Type TSK_LOCATION = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_LOCATION); + static final BlackboardAttribute.Type TSK_DEVICE_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DEVICE_NAME); + static final BlackboardAttribute.Type TSK_CALENDAR_ENTRY_TYPE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_CALENDAR_ENTRY_TYPE); + static final BlackboardAttribute.Type TSK_NAME_PERSON = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_NAME_PERSON); + static final BlackboardAttribute.Type TSK_REMOTE_PATH = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_REMOTE_PATH); + static final BlackboardAttribute.Type TSK_LOCAL_PATH = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_LOCAL_PATH); + static final BlackboardAttribute.Type TSK_SSID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_SSID); + static final BlackboardAttribute.Type TSK_IMEI = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_IMEI); + static final BlackboardAttribute.Type TSK_ICCID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ICCID); + static final BlackboardAttribute.Type TSK_IMSI = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_IMSI); + static final BlackboardAttribute.Type TSK_ID = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ID); + static final BlackboardAttribute.Type TSK_CARD_NUMBER = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_CARD_NUMBER); + static final BlackboardAttribute.Type TSK_ASSOCIATED_ARTIFACT = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT); + static final BlackboardAttribute.Type TSK_DATETIME_MODIFIED = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_DATETIME_MODIFIED); + static final BlackboardAttribute.Type TSK_GEO_TRACKPOINTS = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_GEO_TRACKPOINTS); + static final BlackboardAttribute.Type TSK_TL_EVENT_TYPE = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_TL_EVENT_TYPE); + static final BlackboardAttribute.Type TSK_LAST_PRINTED_DATETIME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_LAST_PRINTED_DATETIME); +} \ No newline at end of file diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Trace.java b/case-uco/java/src/org/sleuthkit/caseuco/Trace.java new file mode 100755 index 0000000000000000000000000000000000000000..5393ec3663ec30a0a5104e8126008771dc9f7519 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Trace.java @@ -0,0 +1,40 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import java.util.ArrayList; +import java.util.List; + +/** + * A Trace template from the CASE ontology. + */ +class Trace extends CyberItem { + + private final List<Facet> hasPropertyBundle; + + Trace(String uuid) { + super(uuid, Trace.class.getSimpleName()); + this.hasPropertyBundle = new ArrayList<>(); + } + + final Trace addBundle(Facet bundle) { + hasPropertyBundle.add(bundle); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/URL.java b/case-uco/java/src/org/sleuthkit/caseuco/URL.java new file mode 100755 index 0000000000000000000000000000000000000000..b0f6213e952549cc001f1367f5d1258a347f1678 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/URL.java @@ -0,0 +1,44 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the URL observable described in the UCO + * ontology. + */ +class URL extends Facet { + + private String fullValue; + + private String userName; + + URL() { + super(URL.class.getSimpleName()); + } + + URL setFullValue(String fullValue) { + this.fullValue = fullValue; + return this; + } + + URL setUserName(CyberItem userName) { + this.userName = userName.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java b/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java new file mode 100755 index 0000000000000000000000000000000000000000..a87917ea57383c33c4237b36ce7109e650e6ee07 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java @@ -0,0 +1,88 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +import com.google.gson.annotations.SerializedName; +import java.time.Instant; +import java.time.ZoneOffset; + +/** + * Base class for all CASE/UCO constructs. + */ +public abstract class UcoObject { + + @SerializedName("@id") + private String id; + + @SerializedName("@type") + private final String type; + + private String createdTime; + + private String modifiedTime; + + private String description; + + private String name; + + private String tag; + + UcoObject(String id, String type) { + this.id = id; + this.type = type; + } + + String getId() { + return this.id; + } + + UcoObject setCreatedTime(Long createdTime) { + if (createdTime != null) { + this.createdTime = Instant.ofEpochSecond(createdTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + UcoObject setModifiedTime(Long modifiedTime) { + if (modifiedTime != null) { + this.modifiedTime = Instant.ofEpochSecond(modifiedTime).atOffset(ZoneOffset.UTC).toString(); + } + return this; + } + + UcoObject setId(String id) { + this.id = id; + return this; + } + + UcoObject setDescription(String description) { + this.description = description; + return this; + } + + UcoObject setName(String name) { + this.name = name; + return this; + } + + UcoObject setTag(String tag) { + this.tag = tag; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/Volume.java b/case-uco/java/src/org/sleuthkit/caseuco/Volume.java new file mode 100755 index 0000000000000000000000000000000000000000..7f6bc4850f80de42653e629dac4faf8e50414f7f --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/Volume.java @@ -0,0 +1,39 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the Volume observable described in the UCO + * ontology. + */ +class Volume extends Facet { + + private String volumeType; + + private Long sectorSize; + + Volume() { + super(Volume.class.getSimpleName()); + } + + Volume setSectorSize(long sectorSize) { + this.sectorSize = sectorSize; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/WindowsAccount.java b/case-uco/java/src/org/sleuthkit/caseuco/WindowsAccount.java new file mode 100755 index 0000000000000000000000000000000000000000..f51d26a1d64323397f67e8e6013e52587884abae --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/WindowsAccount.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the WindowsAccount observable described in the UCO + * ontology. + */ +class WindowsAccount extends Facet { + + private String groups; + + WindowsAccount() { + super(WindowsAccount.class.getSimpleName()); + } + + WindowsAccount setGroups(String groups) { + this.groups = groups; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/WindowsComputerSpecification.java b/case-uco/java/src/org/sleuthkit/caseuco/WindowsComputerSpecification.java new file mode 100755 index 0000000000000000000000000000000000000000..db6365622745b89a86e7eab006e29e9e389ef644 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/WindowsComputerSpecification.java @@ -0,0 +1,51 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the WindowsComputerSpecification observable + * described in the UCO ontology. + */ +class WindowsComputerSpecification extends Facet { + + private String registeredOrganization; + + private String registeredOwner; + + private String windowsTempDirectory; + + WindowsComputerSpecification() { + super(WindowsComputerSpecification.class.getSimpleName()); + } + + WindowsComputerSpecification setRegisteredOrganization(Identity registeredOrganization) { + this.registeredOrganization = registeredOrganization.getId(); + return this; + } + + WindowsComputerSpecification setRegisteredOwner(Identity registeredOwner) { + this.registeredOwner = registeredOwner.getId(); + return this; + } + + WindowsComputerSpecification setWindowsTempDirectory(CyberItem windowsTempDirectory) { + this.windowsTempDirectory = windowsTempDirectory.getId(); + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/WindowsRegistryValue.java b/case-uco/java/src/org/sleuthkit/caseuco/WindowsRegistryValue.java new file mode 100755 index 0000000000000000000000000000000000000000..76b3c31f4b065fc2a6977f593c448f25caeb3cf9 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/WindowsRegistryValue.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the WindowsRegistryValue observable described + * in the UCO ontology. + */ +class WindowsRegistryValue extends Facet { + + private String data; + + WindowsRegistryValue() { + super(WindowsRegistryValue.class.getSimpleName()); + } + + WindowsRegistryValue setData(String data) { + this.data = data; + return this; + } +} diff --git a/case-uco/java/src/org/sleuthkit/caseuco/WirelessNetworkConnection.java b/case-uco/java/src/org/sleuthkit/caseuco/WirelessNetworkConnection.java new file mode 100755 index 0000000000000000000000000000000000000000..0d7f51867313f335bfede01d624fcb1d9f093303 --- /dev/null +++ b/case-uco/java/src/org/sleuthkit/caseuco/WirelessNetworkConnection.java @@ -0,0 +1,37 @@ +/* + * Sleuth Kit CASE JSON LD Support + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier <at> sleuthkit <dot> org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.caseuco; + +/** + * This class definition mirrors the WirelessNetworkConnection observable + * described in the UCO ontology. + */ +class WirelessNetworkConnection extends Facet { + + private String ssid; + + WirelessNetworkConnection() { + super(WirelessNetworkConnection.class.getSimpleName()); + } + + WirelessNetworkConnection setSSID(String ssid) { + this.ssid = ssid; + return this; + } +} diff --git a/configure.ac b/configure.ac index fe49bb03c6e783b05751b61c8a25828e6da046c1..17845711871eafde8ce7a41b9a0b8dca4c3152c8 100644 --- a/configure.ac +++ b/configure.ac @@ -429,6 +429,7 @@ AC_CONFIG_FILES([ man/Makefile bindings/java/Makefile bindings/java/jni/Makefile + case-uco/java/Makefile unit_tests/Makefile unit_tests/base/Makefile]) diff --git a/debian/sleuthkit-java.install b/debian/sleuthkit-java.install index ac1d072cac56c7c660e5be1cfe77d0d79963a707..9bf890260a185733786c51afbd4b3a0d7f08653d 100644 --- a/debian/sleuthkit-java.install +++ b/debian/sleuthkit-java.install @@ -1,3 +1,4 @@ bindings/java/lib/sqlite-jdbc-3.25.2.jar /usr/share/java bindings/java/dist/sleuthkit-4.9.0.jar /usr/share/java +case-uco/java/dist/sleuthkit-caseuco-4.9.0.jar /usr/share/java diff --git a/release/release-unix.pl b/release/release-unix.pl index 9ae293872b7e431bfc876e9b449792a88908ab4f..f6db0150ef24a8d8a2ed9aea0480d0133f89d367 100755 --- a/release/release-unix.pl +++ b/release/release-unix.pl @@ -542,6 +542,10 @@ sub update_debian_install { print CONF_OUT "bindings/java/dist/sleuthkit-${VER}.jar /usr/share/java\n"; $found++; } + elsif (/^case-uco\/java\/dist\/sleuthkit-caseuco\-\d+\.\d+\.\d+\.jar \/usr\/share\/java/) { + print CONF_OUT "case-uco/java/dist/sleuthkit-caseuco-${VER}.jar /usr/share/java\n"; + $found++; + } else { print CONF_OUT $_; } @@ -549,14 +553,49 @@ sub update_debian_install { close (CONF_IN); close (CONF_OUT); - if ($found != 1) { - die "Error: Found $found (instead of 1) occurrences of jar in debian/sleuthkit-java.install"; + if ($found != 2) { + die "Error: Found $found (instead of 2) occurrences of jar files in debian/sleuthkit-java.install"; } unlink ($IFILE) or die "Error deleting $IFILE"; rename ($OFILE, $IFILE) or die "Error renaming $OFILE"; } +sub update_caseuco_project() { + print "Updating the version in the Case UCO project file\n"; + + my $IFILE = "case-uco/java/nbproject/project.properties"; + my $OFILE = "case-uco/java/nbproject/project.properties2"; + + open (CONF_IN, "<${IFILE}") or + die "Cannot open $IFILE"; + open (CONF_OUT, ">${OFILE}") or + die "Cannot open $OFILE"; + + my $found = 0; + while (<CONF_IN>) { + if (/^file.reference.sleuthkit\-\d+\.\d+\.\d+\.jar=lib\/sleuthkit\-\d+\.\d+.\d+.jar/) { + print CONF_OUT "file.reference.sleuthkit-${VER}.jar=lib\/sleuthkit-${VER}.jar\n"; + $found++; + } + elsif (/\$\{file.reference.sleuthkit\-\d+.\d+.\d+.jar\}/) { + print CONF_OUT "\$\{file.reference.sleuthkit-${VER}.jar\}\n"; + $found++; + } + else { + print CONF_OUT $_; + } + } + close (CONF_IN); + close (CONF_OUT); + + if ($found != 2) { + die "Error: Found $found (instead of 2) occurrences of jar file in case-uco/java/nbproject/project.properties"; + } + + unlink ($IFILE) or die "Error deleting $IFILE"; + rename ($OFILE, $IFILE) or die "Error renaming $OFILE"; +} # Update the autotools / autobuild files in current source directory sub bootstrap() { @@ -662,6 +701,12 @@ sub verify_tar { die "Error making jar file (bindings/java/dist/sleuthkit-*.jar not found)" unless (glob("dist/sleuthkit-*.jar")); chdir "../.."; + print "Building Case UCO JAR\n"; + chdir "case-uco/java" or die "Error changing directories to case-uco java"; + system ("ant"); + die "Error making jar file (case-uco/java/dist/sleuthkit-caseuco-*.jar not found)" unless (glob("dist/sleuthkit-caseuco-*.jar")); + chdir "../.."; + # Compile the framework # compile_framework(); @@ -757,6 +802,7 @@ () update_debian_install(); update_doxygen_c(); update_doxygen_java(); +update_caseuco_project(); bootstrap(); checkin_vers();