Skip to content
Snippets Groups Projects
Commit 1d40ecd9 authored by Sean-M's avatar Sean-M
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	bindings/java/nbproject/project.xml
parents 00b5dad6 b80ac2e7
Branches
Tags
No related merge requests found
<<<<<<< HEAD
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
......@@ -153,3 +154,160 @@
</preferences>
</configuration>
</project>
=======
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<name>DataModel</name>
</general-data>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>DataModel</name>
<properties/>
<folders>
<source-folder>
<label>DataModel</label>
<location>.</location>
<encoding>windows-1252</encoding>
</source-folder>
<source-folder>
<label>src</label>
<type>java</type>
<location>src</location>
<encoding>windows-1252</encoding>
</source-folder>
<source-folder>
<label>test</label>
<type>java</type>
<location>test</location>
<encoding>windows-1252</encoding>
</source-folder>
</folders>
<ide-actions>
<action name="build">
<target>dist</target>
</action>
<action name="clean">
<target>clean</target>
</action>
<action name="rebuild">
<target>clean</target>
<target>dist</target>
</action>
<action name="run.single">
<script>nbproject/ide-file-targets.xml</script>
<target>run-selected-file-in-test</target>
<context>
<property>run.class</property>
<folder>test</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="compile.single">
<script>nbproject/ide-file-targets.xml</script>
<target>compile-selected-files-in-test</target>
<context>
<property>files</property>
<folder>test</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="test">
<target>test</target>
</action>
<action name="javadoc">
<target>javadoc</target>
</action>
</ide-actions>
<export>
<type>folder</type>
<location>build</location>
<build-target>dist</build-target>
</export>
<export>
<type>folder</type>
<location>build</location>
<build-target>dist</build-target>
</export>
<export>
<type>folder</type>
<location>test</location>
<build-target>dist</build-target>
</export>
<view>
<items>
<source-folder style="packages">
<label>src</label>
<location>src</location>
</source-folder>
<source-folder style="packages">
<label>test</label>
<location>test</location>
</source-folder>
<source-file>
<location>build.xml</location>
</source-file>
</items>
<context-menu>
<ide-action name="build"/>
<ide-action name="rebuild"/>
<ide-action name="clean"/>
<ide-action name="javadoc"/>
<ide-action name="test"/>
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">lib;lib/diffutils-1.2.1.jar;lib/sqlite-jdbc-3.7.8-SNAPSHOT.jar;lib/junit-4.8.2.jar</classpath>
<built-to>build</built-to>
<source-level>1.7</source-level>
</compilation-unit>
<compilation-unit>
<package-root>test</package-root>
<unit-tests/>
<classpath mode="compile">build;lib/diffutils-1.2.1.jar;lib/diffutils-1.2.1-javadoc.jar;lib/diffutils-1.2.1-sources.jar;lib/junit-4.8.2.jar</classpath>
<built-to>build</built-to>
<built-to>test</built-to>
<source-level>1.7</source-level>
</compilation-unit>
</java-data>
<preferences xmlns="http://www.netbeans.org/ns/auxiliary-configuration-preferences/1">
<module name="org-netbeans-modules-html-editor-lib"/>
<module name="org-netbeans-modules-editor-indent">
<node name="CodeStyle">
<property name="usedProfile" value="project"/>
<node name="project">
<property name="spaces-per-tab" value="4"/>
<property name="tab-size" value="4"/>
<property name="indent-shift-width" value="4"/>
<property name="expand-tabs" value="false"/>
<property name="text-limit-width" value="80"/>
<property name="text-line-wrap" value="none"/>
</node>
</node>
<node name="text">
<node name="x-java">
<node name="CodeStyle">
<node name="project"/>
</node>
</node>
</node>
</module>
<module name="org-netbeans-modules-projectimport-eclipse-core"/>
</preferences>
</configuration>
</project>
>>>>>>> upstream/master
......@@ -18,12 +18,11 @@
*/
package org.sleuthkit.datamodel;
/**
* Represents an attribute as stored in the Blackboard. Attributes are a name value
* pair. The name represents the type of data being stored. Attributes are grouped
* together into an Artifact as represented by a BlackboardArtifact object.
* This class is used to create attribute on the blackboard and is used
* Represents an attribute as stored in the Blackboard. Attributes are a name
* value pair. The name represents the type of data being stored. Attributes are
* grouped together into an Artifact as represented by a BlackboardArtifact
* object. This class is used to create attribute on the blackboard and is used
* to represent attribute queried from the blackboard.
*/
public class BlackboardAttribute {
......@@ -74,6 +73,7 @@ public String getLabel() {
/**
* Get the enum type for the given type id
*
* @param type type id
* @return enum type
*/
......@@ -88,9 +88,10 @@ static public TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE fromType(long type) {
}
/**
* Standard attribute types. Refer to the C++ code for the full
* description of their intended use. See http://wiki.sleuthkit.org/index.php?title=Artifact_Examples
* for more information.
* Standard attribute types. Refer to the C++ code for the full description
* of their intended use. See
* http://wiki.sleuthkit.org/index.php?title=Artifact_Examples for more
* information.
*/
public enum ATTRIBUTE_TYPE {
/* It is very important that this list be kept up to
......@@ -136,15 +137,15 @@ public enum ATTRIBUTE_TYPE {
TSK_ENCRYPTION_DETECTED(38, "TSK_ENCRYPTION_DETECTED", "Encryption Detected"),
TSK_MALWARE_DETECTED(39, "TSK_MALWARE_DETECTED", "Malware Detected"),
TSK_STEG_DETECTED(40, "TSK_STEG_DETECTED", "Steganography Detected"),
TSK_EMAIL_TO(41,"TSK_EMAIL_TO","E-Mail To"),
TSK_EMAIL_CC(42,"TSK_EMAIL_CC","E-Mail CC"),
TSK_EMAIL_BCC(43,"TSK_EMAIL_BCC","E-Mail BCC"),
TSK_EMAIL_FROM(44,"TSK_EMAIL_FROM","E-Mail From"),
TSK_EMAIL_TO(41, "TSK_EMAIL_TO", "E-Mail To"),
TSK_EMAIL_CC(42, "TSK_EMAIL_CC", "E-Mail CC"),
TSK_EMAIL_BCC(43, "TSK_EMAIL_BCC", "E-Mail BCC"),
TSK_EMAIL_FROM(44, "TSK_EMAIL_FROM", "E-Mail From"),
TSK_EMAIL_CONTENT_PLAIN(45, "TSK_EMAIL_CONTENT_PLAIN", "Message (Plaintext)"),
TSK_EMAIL_CONTENT_HTML(46, "TSK_EMAIL_CONTENT_HTML", "Message (HTML)"),
TSK_EMAIL_CONTENT_RTF(47, "TSK_EMAIL_CONTENT_RTF", "Message (RTF)"),
TSK_MSG_ID(48,"TSK_MSG_ID","Message ID"),
TSK_MSG_REPLY_ID(49,"TSK_MSG_REPLY_ID","Message Reply ID"),
TSK_MSG_ID(48, "TSK_MSG_ID", "Message ID"),
TSK_MSG_REPLY_ID(49, "TSK_MSG_REPLY_ID", "Message Reply ID"),
TSK_DATETIME_RCVD(50, "TSK_DATETIME_RCVD", "Date Received"),
TSK_DATETIME_SENT(51, "TSK_DATETIME_SENT", "Date Sent"),
TSK_SUBJECT(52, "TSK_SUBJECT", "Subject"),
......@@ -168,10 +169,7 @@ public enum ATTRIBUTE_TYPE {
TSK_PROCESSOR_ARCHITECTURE(70, "TSK_PROCESSOR_ARCHITECTURE", "Processor Architecture"),
TSK_VERSION(71, "TSK_VERSION", "Version"),
;
/* SEE ABOVE -- ALSO ADD TO C++ CODE */
private String label;
private int typeID;
private String displayName;
......@@ -184,7 +182,7 @@ private ATTRIBUTE_TYPE(int typeID, String label, String displayName) {
/**
* Get label string of this attribute
*
*
* @return label string
*/
public String getLabel() {
......@@ -193,7 +191,7 @@ public String getLabel() {
/**
* Get type id of this attribute
*
*
* @return type id
*/
public int getTypeID() {
......@@ -202,7 +200,7 @@ public int getTypeID() {
/**
* Get the attribute enum for the given label
*
*
* @param label label string
* @return the enum value
*/
......@@ -214,15 +212,17 @@ static public ATTRIBUTE_TYPE fromLabel(String label) {
}
throw new IllegalArgumentException("No ATTRIBUTE_TYPE matching type: " + label);
}
public String getDisplayName() {
return this.displayName;
}
}
/**
* Constructor for a blackboard attribute. Should only be used by SleuthkitCase
* Constructor for a blackboard attribute.
*
* Should only be used by SleuthkitCase
*
* @param artifactID artifact id for this attribute
* @param attributeTypeID type id
* @param moduleName module that created this attribute
......@@ -233,7 +233,8 @@ public String getDisplayName() {
* @param valueDouble value if it is a double
* @param valueString value if it is a string
* @param valueBytes value if it is a byte array
* @param Case the case that can be used to make calls into the blackboard db
* @param Case the case that can be used to make calls into the blackboard
* db
*/
protected BlackboardAttribute(long artifactID, int attributeTypeID, String moduleName, String context,
TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType, int valueInt, long valueLong, double valueDouble,
......@@ -247,14 +248,23 @@ protected BlackboardAttribute(long artifactID, int attributeTypeID, String modul
this.valueInt = valueInt;
this.valueLong = valueLong;
this.valueDouble = valueDouble;
this.valueString = valueString;
this.valueBytes = valueBytes;
if (valueString == null) {
this.valueString = "";
} else {
this.valueString = valueString;
}
if (valueBytes == null) {
this.valueBytes = new byte[0];
} else {
this.valueBytes = valueBytes;
}
this.Case = Case;
}
/**
* Create a blackboard attribute that stores an int (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores an int (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param valueInt the value
......@@ -273,24 +283,27 @@ public BlackboardAttribute(int attributeTypeID, String moduleName, int valueInt)
}
/**
* Create a blackboard attribute that stores an int (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores an int (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueInt the value
* @Deprecated context parameter will be deprecated - in lieu of specific blackboard attributes
* use the alternative constructor without context
* @deprecated context parameter will be deprecated - in lieu of specific
* blackboard attributes use the alternative constructor without context
*/
@Deprecated
public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
int valueInt) {
this(attributeTypeID, moduleName, valueInt);
this.context = context;
}
/**
* Create a blackboard attribute that stores a long (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores a long (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param valueLong the value
......@@ -311,15 +324,17 @@ public BlackboardAttribute(int attributeTypeID, String moduleName,
}
/**
* Create a blackboard attribute that stores a long (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores a long (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueLong the value
* @Deprecated context parameter will be deprecated - in lieu of specific blackboard attributes
* use the alternative constructor without context
* @deprecated context parameter will be deprecated - in lieu of specific
* blackboard attributes use the alternative constructor without context
*/
@Deprecated
public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
long valueLong) {
this(attributeTypeID, moduleName, valueLong);
......@@ -327,14 +342,15 @@ public BlackboardAttribute(int attributeTypeID, String moduleName, String contex
}
/**
* Create a blackboard attribute that stores a double (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores a double (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueDouble the value
*/
public BlackboardAttribute(int attributeTypeID, String moduleName,
public BlackboardAttribute(int attributeTypeID, String moduleName,
double valueDouble) {
this.artifactID = 0;
this.attributeTypeID = attributeTypeID;
......@@ -347,17 +363,19 @@ public BlackboardAttribute(int attributeTypeID, String moduleName,
this.valueBytes = new byte[0];
this.context = "";
}
/**
* Create a blackboard attribute that stores a double (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores a double (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueDouble the value
* @Deprecated context parameter will be deprecated - in lieu of specific blackboard attributes
* use the alternative constructor without context
* @deprecated context parameter will be deprecated - in lieu of specific
* blackboard attributes use the alternative constructor without context
*/
@Deprecated
public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
double valueDouble) {
this(attributeTypeID, moduleName, valueDouble);
......@@ -365,8 +383,9 @@ public BlackboardAttribute(int attributeTypeID, String moduleName, String contex
}
/**
* Create a blackboard attribute that stores a string (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores a string (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param valueString the value
......@@ -379,27 +398,61 @@ public BlackboardAttribute(int attributeTypeID, String moduleName, String valueS
this.valueInt = 0;
this.valueLong = 0;
this.valueDouble = 0;
this.valueString = valueString;
if (valueString == null) {
this.valueString = "";
} else {
this.valueString = valueString;
}
this.valueBytes = new byte[0];
this.context = "";
}
/**
* Create a blackboard attribute that stores a string (creates an attribute that can be
* added to an artifact)
* Create a blackboard attribute that stores a string (creates an attribute
* that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueString the value
* @Deprecated context parameter will be deprecated - in lieu of specific blackboard attributes
* use the alternative constructor without context
* @deprecated context parameter will be deprecated - in lieu of specific
* blackboard attributes use the alternative constructor without context
*/
@Deprecated
public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
String valueString) {
this(attributeTypeID, moduleName, valueString);
this.context = context;
}
/**
* Create a blackboard attribute that stores a byte array (creates an
* attribute that can be added to an artifact)
*
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueBytes the value
*/
public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
byte[] valueBytes) {
this.artifactID = 0;
this.attributeTypeID = attributeTypeID;
this.moduleName = moduleName;
this.context = context;
this.valueType = TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.BYTE;
this.valueInt = 0;
this.valueLong = 0;
this.valueDouble = 0;
this.valueString = "";
if (valueBytes == null) {
this.valueBytes = new byte[0];
} else {
this.valueBytes = valueBytes;
}
}
@Override
public int hashCode() {
int hash = 5;
......@@ -426,34 +479,10 @@ public boolean equals(Object obj) {
public String toString() {
return "BlackboardAttribute{" + "artifactID=" + artifactID + ", attributeTypeID=" + attributeTypeID + ", moduleName=" + moduleName + ", context=" + context + ", valueType=" + valueType + ", valueInt=" + valueInt + ", valueLong=" + valueLong + ", valueDouble=" + valueDouble + ", valueString=" + valueString + ", valueBytes=" + valueBytes + ", Case=" + Case + '}';
}
/**
* Create a blackboard attribute that stores a byte array (creates an attribute that can be
* added to an artifact)
* @param attributeTypeID type of the attribute
* @param moduleName name of the module that is creating the attribute
* @param context extra information about the attribute
* @param valueBytes the value
*/
public BlackboardAttribute(int attributeTypeID, String moduleName, String context,
byte[] valueBytes) {
this.artifactID = 0;
this.attributeTypeID = attributeTypeID;
this.moduleName = moduleName;
this.context = context;
this.valueType = TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.BYTE;
this.valueInt = 0;
this.valueLong = 0;
this.valueDouble = 0;
this.valueString = "";
this.valueBytes = valueBytes;
}
/**
* Get the artifact id
* Get the artifact id
*
* @return artifact id
*/
public long getArtifactID() {
......@@ -462,6 +491,7 @@ public long getArtifactID() {
/**
* Get the attribute type id
*
* @return type id
*/
public int getAttributeTypeID() {
......@@ -470,6 +500,7 @@ public int getAttributeTypeID() {
/**
* Get the attribute type name string
*
* @return type name string
*/
public String getAttributeTypeName() throws TskCoreException {
......@@ -478,6 +509,7 @@ public String getAttributeTypeName() throws TskCoreException {
/**
* Get the attribute type display name
*
* @return type display name
*/
public String getAttributeTypeDisplayName() throws TskCoreException {
......@@ -485,10 +517,11 @@ public String getAttributeTypeDisplayName() throws TskCoreException {
}
/**
* Get the value type
* This should be used to identify the type of value and call
* the right value get method.
* Get the value type.
*
* This should be used to identify the type of value and
* call the right value get method.
*
* @return value type
*/
public TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE getValueType() {
......@@ -497,7 +530,7 @@ public TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE getValueType() {
/**
* Get the value if it is an int
*
*
* @return value
*/
public int getValueInt() {
......@@ -506,7 +539,7 @@ public int getValueInt() {
/**
* Get value if it is a long
*
*
* @return value
*/
public long getValueLong() {
......@@ -515,7 +548,7 @@ public long getValueLong() {
/**
* Get value if it is a double
*
*
* @return value
*/
public double getValueDouble() {
......@@ -524,7 +557,7 @@ public double getValueDouble() {
/**
* Get value if it is a string
*
*
* @return value
*/
public String getValueString() {
......@@ -533,7 +566,7 @@ public String getValueString() {
/**
* Get value if it is a byte array
*
*
* @return value
*/
public byte[] getValueBytes() {
......@@ -542,7 +575,7 @@ public byte[] getValueBytes() {
/**
* Get module name of the module that created the attribute
*
*
* @return name
*/
public String getModuleName() {
......@@ -551,7 +584,7 @@ public String getModuleName() {
/**
* Get context of the data stored in the attribute, if set
*
*
* @return context
*/
public String getContext() {
......@@ -559,12 +592,15 @@ public String getContext() {
}
/**
* Get the artifact that this attribute is associated with
* The artifact can be used to find the associated file and other attributes
* associated with this artifact.
* Get the artifact that this attribute is associated with.
*
* The artifact can
* be used to find the associated file and other attributes associated with
* this artifact.
*
* @return artifact
* @throws TskException exception thrown when critical error occurred within tsk core
* @throws TskException exception thrown when critical error occurred within
* tsk core
*/
public BlackboardArtifact getParentArtifact() throws TskCoreException {
return Case.getBlackboardArtifact(artifactID);
......@@ -572,7 +608,7 @@ public BlackboardArtifact getParentArtifact() throws TskCoreException {
/**
* Set the artifactID, this should only be used by sleuthkitCase
*
*
* @param artifactID artifactID to set on a newly created attribute
*/
protected void setArtifactID(long artifactID) {
......@@ -582,6 +618,7 @@ protected void setArtifactID(long artifactID) {
/**
* Set the SleuthkitCase handle, this should only be used by SleuthkitCase
* on a newly created attribute
*
* @param Case case handle to associated with this attribute
*/
protected void setCase(SleuthkitCase Case) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment