Skip to content
Snippets Groups Projects
Unverified Commit 4518162e authored by Richard Cordovano's avatar Richard Cordovano Committed by GitHub
Browse files

Merge pull request #1761 from raman-bt/5912-content-as-artifact-source

5912: Modify the artifact creation helpers in blackboard utils to all…
parents 856641b9 e79bf655
No related branches found
No related tags found
No related merge requests found
......@@ -20,8 +20,8 @@
import java.util.Collection;
import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.SleuthkitCase;
/**
......@@ -31,29 +31,29 @@
class ArtifactHelperBase {
private final SleuthkitCase caseDb;
private final AbstractFile srcAbstractFile; // artifact source
private final String moduleName; // module creating the artifacts
private final Content srcContent; // artifact source
private final String moduleName; // module creating the artifacts
/**
* Creates an artifact helper.
*
* @param caseDb Sleuthkit case db
* @param moduleName name module using the helper
* @param srcFile source file
* @param srcContent source content
*/
ArtifactHelperBase(SleuthkitCase caseDb, String moduleName, AbstractFile srcFile) {
ArtifactHelperBase(SleuthkitCase caseDb, String moduleName, Content srcContent) {
this.moduleName = moduleName;
this.srcAbstractFile = srcFile;
this.srcContent = srcContent;
this.caseDb = caseDb;
}
/**
* Returns the source abstract file.
* Returns the source content.
*
* @return Source abstract file.
* @return Source content.
*/
AbstractFile getAbstractFile() {
return this.srcAbstractFile;
Content getContent() {
return this.srcContent;
}
/**
......
......@@ -21,10 +21,10 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Blackboard.BlackboardException;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
......@@ -39,11 +39,11 @@ public final class ArtifactsHelper extends ArtifactHelperBase {
*
* @param caseDb Sleuthkit case database.
* @param moduleName Name of module using the helper.
* @param srcFile Source file for the artifacts.
* @param srcContent Source content for the artifacts.
*
*/
public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, AbstractFile srcFile) {
super(caseDb, moduleName, srcFile);
public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent) {
super(caseDb, moduleName, srcContent);
}
/**
......@@ -95,7 +95,7 @@ public BlackboardArtifact addGPSLocation(double latitude, double longitude, long
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
gpsTrackpointArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT);
gpsTrackpointArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, getModuleName(), latitude));
......@@ -154,7 +154,7 @@ public BlackboardArtifact addInstalledProgram(String programName, long dateInsta
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
installedProgramArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG);
installedProgramArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName));
......
......@@ -33,6 +33,7 @@
import org.sleuthkit.datamodel.Blackboard.BlackboardException;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.Relationship;
import org.sleuthkit.datamodel.SleuthkitCase;
......@@ -138,7 +139,7 @@ public String getDisplayName() {
*
* @param caseDb Sleuthkit case db.
* @param moduleName Name of module using the helper.
* @param srcFile Source file being processed by the module.
* @param srcContent Source content being processed by the module.
* @param accountsType Account type {@link Account.Type} created by this
* module.
*
......@@ -146,13 +147,13 @@ public String getDisplayName() {
* account.
*/
public CommunicationArtifactsHelper(SleuthkitCase caseDb,
String moduleName, AbstractFile srcFile, Account.Type accountsType) throws TskCoreException {
String moduleName, Content srcContent, Account.Type accountsType) throws TskCoreException {
super(caseDb, moduleName, srcFile);
super(caseDb, moduleName, srcContent);
this.moduleAccountsType = accountsType;
this.selfAccountType = Account.Type.DEVICE;
this.selfAccountId = ((DataSource) getAbstractFile().getDataSource()).getDeviceId();
this.selfAccountId = ((DataSource) getContent().getDataSource()).getDeviceId();
}
/**
......@@ -166,7 +167,7 @@ public CommunicationArtifactsHelper(SleuthkitCase caseDb,
*
* @param caseDb Sleuthkit case db.
* @param moduleName Name of module using the helper.
* @param srcFile Source file being processed by the module.
* @param srcContent Source content being processed by the module.
* @param accountsType Account type {@link Account.Type} created by this
* module.
* @param selfAccountType Self account type to be created for this module.
......@@ -174,9 +175,9 @@ public CommunicationArtifactsHelper(SleuthkitCase caseDb,
*
* @throws TskCoreException If there is an error creating the self account
*/
public CommunicationArtifactsHelper(SleuthkitCase caseDb, String moduleName, AbstractFile srcFile, Account.Type accountsType, Account.Type selfAccountType, String selfAccountId) throws TskCoreException {
public CommunicationArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent, Account.Type accountsType, Account.Type selfAccountType, String selfAccountId) throws TskCoreException {
super(caseDb, moduleName, srcFile);
super(caseDb, moduleName, srcContent);
this.moduleAccountsType = accountsType;
this.selfAccountType = selfAccountType;
......@@ -272,7 +273,7 @@ public BlackboardArtifact addContact(String contactName,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create TSK_CONTACT artifact
contactArtifact = getAbstractFile().newArtifact(ARTIFACT_TYPE.TSK_CONTACT);
contactArtifact = getContent().newArtifact(ARTIFACT_TYPE.TSK_CONTACT);
// construct attributes
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME, getModuleName(), contactName));
......@@ -351,7 +352,7 @@ private void createContactMethodAccountAndRelationship(Account.Type accountType,
* instance.
*/
private AccountFileInstance createAccountInstance(Account.Type accountType, String accountUniqueID) throws TskCoreException {
return getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(accountType, accountUniqueID, getModuleName(), getAbstractFile());
return getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(accountType, accountUniqueID, getModuleName(), getContent());
}
/**
......@@ -497,7 +498,7 @@ public BlackboardArtifact addMessage(String messageType,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create TSK_MESSAGE artifact
msgArtifact = getAbstractFile().newArtifact(ARTIFACT_TYPE.TSK_MESSAGE);
msgArtifact = getContent().newArtifact(ARTIFACT_TYPE.TSK_MESSAGE);
// construct attributes
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, getModuleName(), messageType));
......@@ -694,7 +695,7 @@ public BlackboardArtifact addCalllog(CommunicationDirection direction,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// Create TSK_CALLLOG artifact
callLogArtifact = getAbstractFile().newArtifact(ARTIFACT_TYPE.TSK_CALLLOG);
callLogArtifact = getContent().newArtifact(ARTIFACT_TYPE.TSK_CALLLOG);
// Add basic attributes
addAttributeIfNotZero(ATTRIBUTE_TYPE.TSK_DATETIME_START, startDateTime, attributes);
......@@ -877,7 +878,7 @@ private void addMessageReadStatusIfKnown(MessageReadStatus readStatus, Collectio
*/
private synchronized AccountFileInstance getSelfAccountInstance() throws TskCoreException {
if (selfAccountInstance == null) {
selfAccountInstance = getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(selfAccountType, selfAccountId, this.getModuleName(), getAbstractFile());
selfAccountInstance = getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(selfAccountType, selfAccountId, this.getModuleName(), getContent());
}
return selfAccountInstance;
}
......
......@@ -29,6 +29,7 @@
import org.sleuthkit.datamodel.Blackboard.BlackboardException;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
......@@ -46,11 +47,11 @@ public final class WebBrowserArtifactsHelper extends ArtifactHelperBase {
*
* @param caseDb Sleuthkit case db.
* @param moduleName Name of module using the helper.
* @param srcFile Source file being processed by the module.
* @param srcContent Source content being processed by the module.
*
*/
public WebBrowserArtifactsHelper(SleuthkitCase caseDb, String moduleName, AbstractFile srcFile) {
super(caseDb, moduleName, srcFile);
public WebBrowserArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcContent) {
super(caseDb, moduleName, srcContent);
}
/**
......@@ -94,7 +95,7 @@ public BlackboardArtifact addWebBookmark(String url, String title, long creation
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
bookMarkArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK);
bookMarkArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, getModuleName(), url));
......@@ -164,7 +165,7 @@ public BlackboardArtifact addWebCookie(String url,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
cookieArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE);
cookieArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, getModuleName(), url));
......@@ -226,7 +227,7 @@ public BlackboardArtifact addWebDownload(String url, long startTime, String path
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// reate artifact
webDownloadArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD);
webDownloadArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH, getModuleName(), path));
......@@ -297,7 +298,7 @@ public BlackboardArtifact addWebFormAddress(String personName, String email,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
webFormAddressArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS);
webFormAddressArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, getModuleName(), personName));
......@@ -365,7 +366,7 @@ public BlackboardArtifact addWebFormAutofill(String name, String value,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
webFormAutofillArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_AUTOFILL);
webFormAutofillArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_AUTOFILL);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, getModuleName(), name));
......@@ -431,7 +432,7 @@ public BlackboardArtifact addWebHistory(String url, long accessTime,
Collection<BlackboardAttribute> attributes = new ArrayList<>();
// create artifact
webHistoryArtifact = getAbstractFile().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY);
webHistoryArtifact = getContent().newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY);
// construct attributes
attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, getModuleName(), url));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment