From 85d0ba52d3552b453d5996a2303bc49557cf6ffb Mon Sep 17 00:00:00 2001 From: Richard Cordovano <rcordovano@basistech.com> Date: Fri, 22 Oct 2021 14:27:21 -0400 Subject: [PATCH] 7673 Allow helpers to call correct Blackboard.postArtifacts() API --- .../org/sleuthkit/datamodel/Blackboard.java | 48 +++---- .../datamodel/CommunicationsManager.java | 129 +++++++++--------- .../blackboardutils/ArtifactHelperBase.java | 14 +- .../blackboardutils/ArtifactsHelper.java | 11 +- .../blackboardutils/GeoArtifactsHelper.java | 8 +- .../WebBrowserArtifactsHelper.java | 50 +++---- 6 files changed, 130 insertions(+), 130 deletions(-) diff --git a/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java b/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java index 8c2b57170..85101138c 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java +++ b/bindings/java/src/org/sleuthkit/datamodel/Blackboard.java @@ -62,8 +62,8 @@ public final class Blackboard { private final Map<String, BlackboardArtifact.Type> typeNameToArtifactTypeMap = new ConcurrentHashMap<>(); private final Map<String, BlackboardAttribute.Type> typeNameToAttributeTypeMap = new ConcurrentHashMap<>(); - static final int MIN_USER_DEFINED_TYPE_ID = 10000; - + static final int MIN_USER_DEFINED_TYPE_ID = 10000; + private final SleuthkitCase caseDb; /** @@ -161,7 +161,7 @@ public BlackboardArtifact.Type getOrAddArtifactType(String typeName, String disp if (typeNameToArtifactTypeMap.containsKey(typeName)) { return typeNameToArtifactTypeMap.get(typeName); } - + Statement s = null; ResultSet rs = null; CaseDbTransaction trans = null; @@ -221,7 +221,7 @@ public BlackboardArtifact.Type getOrAddArtifactType(String typeName, String disp } } } - + /** * Get the attribute type associated with an attribute type name. * @@ -260,8 +260,8 @@ public BlackboardAttribute.Type getAttributeType(String attrTypeName) throws Tsk closeConnection(connection); caseDb.releaseSingleUserCaseReadLock(); } - } - + } + /** * Get the attribute type associated with an attribute type ID. * @@ -300,8 +300,8 @@ BlackboardAttribute.Type getAttributeType(int typeID) throws TskCoreException { closeConnection(connection); caseDb.releaseSingleUserCaseReadLock(); } - } - + } + /** * Get the artifact type associated with an artifact type name. * @@ -341,8 +341,8 @@ public BlackboardArtifact.Type getArtifactType(String artTypeName) throws TskCor closeConnection(connection); caseDb.releaseSingleUserCaseReadLock(); } - } - + } + /** * Get the artifact type associated with an artifact type id. * @@ -385,16 +385,16 @@ public BlackboardArtifact.Type getArtifactType(int artTypeId) throws TskCoreExce closeConnection(connection); caseDb.releaseSingleUserCaseReadLock(); } - } - + } + /** * Get the list of attributes for the given artifact. - * + * * @param artifact The artifact to load attributes for. - * + * * @return The list of attributes. - * - * @throws TskCoreException + * + * @throws TskCoreException */ public ArrayList<BlackboardAttribute> getBlackboardAttributes(final BlackboardArtifact artifact) throws TskCoreException { CaseDbConnection connection = null; @@ -450,7 +450,7 @@ public ArrayList<BlackboardAttribute> getBlackboardAttributes(final BlackboardAr closeConnection(connection); caseDb.releaseSingleUserCaseReadLock(); } - } + } /** * Get the attributes associated with the given file. @@ -517,7 +517,7 @@ ArrayList<Attribute> getFileAttributes(final AbstractFile file) throws TskCoreEx caseDb.releaseSingleUserCaseReadLock(); } } - + /** * Adds the standard artifact types to the blackboard_artifact_types table * and the artifact type caches. @@ -575,8 +575,8 @@ void initBlackboardArtifactTypes(CaseDbConnection connection) throws SQLExceptio } finally { caseDb.releaseSingleUserCaseWriteLock(); } - } - + } + /** * Adds the standard attribute types to the blackboard_attribute_types table * and the attribute type caches. @@ -634,8 +634,8 @@ void initBlackboardAttributeTypes(CaseDbConnection connection) throws SQLExcepti } finally { caseDb.releaseSingleUserCaseWriteLock(); } - } - + } + /** * Adds new analysis result artifact. * @@ -1328,7 +1328,7 @@ public BlackboardAttribute.Type getOrAddAttributeType(String typeName, Blackboar if (typeNameToAttributeTypeMap.containsKey(typeName)) { return typeNameToAttributeTypeMap.get(typeName); } - + CaseDbTransaction trans = null; Statement s = null; ResultSet rs = null; @@ -1386,7 +1386,7 @@ public BlackboardAttribute.Type getOrAddAttributeType(String typeName, Blackboar throw new BlackboardException("Error rolling back transaction", ex); } } - } + } } /** diff --git a/bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java b/bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java index 79686226d..ee7b5e55e 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java +++ b/bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java @@ -86,7 +86,7 @@ public final class CommunicationsManager { private void initAccountTypes() throws TskCoreException { db.acquireSingleUserCaseWriteLock(); try (CaseDbConnection connection = db.getConnection(); - Statement statement = connection.createStatement();) { + Statement statement = connection.createStatement();) { // Read the table int count = readAccountTypes(); if (0 == count) { @@ -133,7 +133,7 @@ private int readAccountTypes() throws TskCoreException { Statement statement = null; ResultSet resultSet = null; int count = 0; - + db.acquireSingleUserCaseReadLock(); try { connection = db.getConnection(); @@ -296,9 +296,9 @@ public Account getAccount(org.sleuthkit.datamodel.Account.Type accountType, Stri Account account = null; db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); - Statement s = connection.createStatement(); - ResultSet rs = connection.executeQuery(s, "SELECT * FROM accounts WHERE account_type_id = " + getAccountTypeId(accountType) - + " AND account_unique_identifier = '" + normalizeAccountID(accountType, accountUniqueID) + "'");) { //NON-NLS + Statement s = connection.createStatement(); + ResultSet rs = connection.executeQuery(s, "SELECT * FROM accounts WHERE account_type_id = " + getAccountTypeId(accountType) + + " AND account_unique_identifier = '" + normalizeAccountID(accountType, accountUniqueID) + "'");) { //NON-NLS if (rs.next()) { account = new Account(rs.getInt("account_id"), accountType, @@ -501,7 +501,7 @@ private BlackboardArtifact getOrCreateAccountFileInstanceArtifact(Account.Type a ); accountArtifact = sourceFile.newDataArtifact(ACCOUNT_TYPE, attributes); - + try { db.getBlackboard().postArtifact(accountArtifact, moduleName); } catch (BlackboardException ex) { @@ -526,31 +526,31 @@ private BlackboardArtifact getOrCreateAccountFileInstanceArtifact(Account.Type a */ private BlackboardArtifact getAccountFileInstanceArtifact(Account.Type accountType, String accountUniqueID, Content sourceFile) throws TskCoreException { BlackboardArtifact accountArtifact = null; - + String queryStr = "SELECT artifacts.artifact_id AS artifact_id," - + " artifacts.obj_id AS obj_id," - + " artifacts.artifact_obj_id AS artifact_obj_id," - + " artifacts.data_source_obj_id AS data_source_obj_id," - + " artifacts.artifact_type_id AS artifact_type_id," - + " artifacts.review_status_id AS review_status_id," - + " tsk_data_artifacts.os_account_obj_id AS os_account_obj_id" - + " FROM blackboard_artifacts AS artifacts" - + " JOIN blackboard_attributes AS attr_account_type" - + " ON artifacts.artifact_id = attr_account_type.artifact_id" - + " JOIN blackboard_attributes AS attr_account_id" - + " ON artifacts.artifact_id = attr_account_id.artifact_id" - + " AND attr_account_id.attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ID.getTypeID() - + " AND attr_account_id.value_text = '" + accountUniqueID + "'" - + " LEFT JOIN tsk_data_artifacts ON tsk_data_artifacts.artifact_obj_id = artifacts.artifact_obj_id" - + " WHERE artifacts.artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID() - + " AND attr_account_type.attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID() - + " AND attr_account_type.value_text = '" + accountType.getTypeName() + "'" - + " AND artifacts.obj_id = " + sourceFile.getId(); //NON-NLS - + + " artifacts.obj_id AS obj_id," + + " artifacts.artifact_obj_id AS artifact_obj_id," + + " artifacts.data_source_obj_id AS data_source_obj_id," + + " artifacts.artifact_type_id AS artifact_type_id," + + " artifacts.review_status_id AS review_status_id," + + " tsk_data_artifacts.os_account_obj_id AS os_account_obj_id" + + " FROM blackboard_artifacts AS artifacts" + + " JOIN blackboard_attributes AS attr_account_type" + + " ON artifacts.artifact_id = attr_account_type.artifact_id" + + " JOIN blackboard_attributes AS attr_account_id" + + " ON artifacts.artifact_id = attr_account_id.artifact_id" + + " AND attr_account_id.attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ID.getTypeID() + + " AND attr_account_id.value_text = '" + accountUniqueID + "'" + + " LEFT JOIN tsk_data_artifacts ON tsk_data_artifacts.artifact_obj_id = artifacts.artifact_obj_id" + + " WHERE artifacts.artifact_type_id = " + BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID() + + " AND attr_account_type.attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE.getTypeID() + + " AND attr_account_type.value_text = '" + accountType.getTypeName() + "'" + + " AND artifacts.obj_id = " + sourceFile.getId(); //NON-NLS + db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); - Statement s = connection.createStatement(); - ResultSet rs = connection.executeQuery(s, queryStr);) { //NON-NLS + Statement s = connection.createStatement(); + ResultSet rs = connection.executeQuery(s, queryStr);) { //NON-NLS if (rs.next()) { BlackboardArtifact.Type bbartType = db.getBlackboard().getArtifactType(rs.getInt("artifact_type_id")); @@ -585,8 +585,8 @@ public org.sleuthkit.datamodel.Account.Type getAccountType(String accountTypeNam db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); - Statement s = connection.createStatement(); - ResultSet rs = connection.executeQuery(s, "SELECT account_type_id, type_name, display_name FROM account_types WHERE type_name = '" + accountTypeName + "'");) { //NON-NLS + Statement s = connection.createStatement(); + ResultSet rs = connection.executeQuery(s, "SELECT account_type_id, type_name, display_name FROM account_types WHERE type_name = '" + accountTypeName + "'");) { //NON-NLS Account.Type accountType = null; if (rs.next()) { accountType = new Account.Type(accountTypeName, rs.getString("display_name")); @@ -781,13 +781,13 @@ public Map<AccountPair, Long> getRelationshipCountsPairwise(Set<AccountDeviceIns + " accounts2.account_id, " + " account_types2.type_name, " + " account_types2.display_name"; - + Map<AccountPair, Long> results = new HashMap<AccountPair, Long>(); - + db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); - Statement s = connection.createStatement(); - ResultSet rs = connection.executeQuery(s, queryString);) { //NON-NLS + Statement s = connection.createStatement(); + ResultSet rs = connection.executeQuery(s, queryString);) { //NON-NLS while (rs.next()) { //make account 1 @@ -858,13 +858,13 @@ public long getRelationshipSourcesCount(AccountDeviceInstance accountDeviceInsta } String queryStr - = "SELECT count(DISTINCT relationships.relationship_source_obj_id) as count " - + " FROM" + innerQuery - + " WHERE relationships.data_source_obj_id IN ( " + datasourceObjIdsCSV + " )" - + " AND ( relationships.account1_id = " + account_id - + " OR relationships.account2_id = " + account_id + " )" - + (filterSQL.isEmpty() ? "" : " AND " + filterSQL); - + = "SELECT count(DISTINCT relationships.relationship_source_obj_id) as count " + + " FROM" + innerQuery + + " WHERE relationships.data_source_obj_id IN ( " + datasourceObjIdsCSV + " )" + + " AND ( relationships.account1_id = " + account_id + + " OR relationships.account2_id = " + account_id + " )" + + (filterSQL.isEmpty() ? "" : " AND " + filterSQL); + db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); Statement s = connection.createStatement(); @@ -940,24 +940,24 @@ public Set<Content> getRelationshipSources(Set<AccountDeviceInstance> accountDev if (!limitStr.isEmpty()) { limitQuery = "(SELECT * FROM account_relationships as relationships " + limitStr + ") as relationships"; } - + String queryStr - = "SELECT DISTINCT artifacts.artifact_id AS artifact_id," - + " artifacts.obj_id AS obj_id," - + " artifacts.artifact_obj_id AS artifact_obj_id," - + " artifacts.data_source_obj_id AS data_source_obj_id, " - + " artifacts.artifact_type_id AS artifact_type_id, " - + " artifacts.review_status_id AS review_status_id," - + " tsk_data_artifacts.os_account_obj_id as os_account_obj_id" - + " FROM blackboard_artifacts as artifacts" - + " JOIN " + limitQuery - + " ON artifacts.artifact_obj_id = relationships.relationship_source_obj_id" - + " LEFT JOIN tsk_data_artifacts ON artifacts.artifact_obj_id = tsk_data_artifacts.artifact_obj_id" - // append sql to restrict search to specified account device instances - + " WHERE (" + adiSQLClause + " )" - // plus other filters - + (filterSQL.isEmpty() ? "" : " AND (" + filterSQL + " )"); - + = "SELECT DISTINCT artifacts.artifact_id AS artifact_id," + + " artifacts.obj_id AS obj_id," + + " artifacts.artifact_obj_id AS artifact_obj_id," + + " artifacts.data_source_obj_id AS data_source_obj_id, " + + " artifacts.artifact_type_id AS artifact_type_id, " + + " artifacts.review_status_id AS review_status_id," + + " tsk_data_artifacts.os_account_obj_id as os_account_obj_id" + + " FROM blackboard_artifacts as artifacts" + + " JOIN " + limitQuery + + " ON artifacts.artifact_obj_id = relationships.relationship_source_obj_id" + + " LEFT JOIN tsk_data_artifacts ON artifacts.artifact_obj_id = tsk_data_artifacts.artifact_obj_id" + // append sql to restrict search to specified account device instances + + " WHERE (" + adiSQLClause + " )" + // plus other filters + + (filterSQL.isEmpty() ? "" : " AND (" + filterSQL + " )"); + db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); Statement s = connection.createStatement(); @@ -1131,7 +1131,7 @@ public List<Content> getRelationshipSources(AccountDeviceInstance account1, Acco ResultSet rs = connection.executeQuery(s, queryString);) { ArrayList<Content> artifacts = new ArrayList<>(); - artifacts.addAll(getDataArtifactsFromResult(rs)); + artifacts.addAll(getDataArtifactsFromResult(rs)); return artifacts; } catch (SQLException ex) { throw new TskCoreException("Error getting relationships between accounts. " + ex.getMessage(), ex); @@ -1150,12 +1150,11 @@ public List<Content> getRelationshipSources(AccountDeviceInstance account1, Acco * * @throws org.sleuthkit.datamodel.TskCoreException */ - public List<AccountFileInstance> getAccountFileInstances(Account account) throws TskCoreException { List<AccountFileInstance> accountFileInstanceList = new ArrayList<>(); @SuppressWarnings("deprecation") List<BlackboardArtifact> artifactList = getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ID, account.getTypeSpecificID()); - + if (artifactList != null && !artifactList.isEmpty()) { for (BlackboardArtifact artifact : artifactList) { accountFileInstanceList.add(new AccountFileInstance(artifact, account)); @@ -1178,10 +1177,10 @@ public List<AccountFileInstance> getAccountFileInstances(Account account) throws * @throws TskCoreException */ public List<Account.Type> getAccountTypesInUse() throws TskCoreException { - + String query = "SELECT DISTINCT accounts.account_type_id, type_name, display_name FROM accounts JOIN account_types ON accounts.account_type_id = account_types.account_type_id"; List<Account.Type> inUseAccounts = new ArrayList<>(); - + db.acquireSingleUserCaseReadLock(); try (CaseDbConnection connection = db.getConnection(); Statement s = connection.createStatement(); @@ -1375,12 +1374,12 @@ private String getMostRecentFilterLimitSQL(CommunicationsFilter filter) { return limitStr; } - + /** * A helper method that will return a set of BlackboardArtifact objects for * the given ResultSet. * - * @param resultSet The results of executing a query. + * @param resultSet The results of executing a query. * * @return A list of BlackboardArtifact objects. * diff --git a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java index 426061af6..cb022c3b7 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java +++ b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactHelperBase.java @@ -75,8 +75,8 @@ String getModuleName() { } /** - * Creates and adds a string attribute of specified type to the given list, if the - * attribute value is not empty or null. + * Creates and adds a string attribute of specified type to the given list, + * if the attribute value is not empty or null. * * @param attributeType Attribute type. * @param attrValue String attribute value. @@ -90,8 +90,8 @@ void addAttributeIfNotNull(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, Str } /** - * Creates and adds a long attribute of specified type to the given list, if the - * attribute value is not 0. + * Creates and adds a long attribute of specified type to the given list, if + * the attribute value is not 0. * * @param attributeType Attribute type. * @param attrValue Long attribute value. @@ -102,10 +102,10 @@ void addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE attributeType, lon attributes.add(new BlackboardAttribute(attributeType, getModuleName(), attrValue)); } } - + /** - * Creates and adds an integer attribute of specified type to the given list, if the - * attribute value is not 0. + * Creates and adds an integer attribute of specified type to the given + * list, if the attribute value is not 0. * * @param attributeType Attribute type. * @param attrValue Integer attribute value. diff --git a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactsHelper.java b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactsHelper.java index dbd5eee7f..284e8a2e4 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactsHelper.java +++ b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/ArtifactsHelper.java @@ -37,8 +37,9 @@ * */ public final class ArtifactsHelper extends ArtifactHelperBase { + private static final BlackboardArtifact.Type INSTALLED_PROG_TYPE = new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_INSTALLED_PROG); - + /** * Creates an artifact helper for modules to create artifacts. * @@ -59,7 +60,7 @@ public ArtifactsHelper(SleuthkitCase caseDb, String moduleName, Content srcConte * * @return Installed program artifact added. * - * @throws TskCoreException If there is an error creating the artifact. + * @throws TskCoreException If there is an error creating the artifact. * @throws BlackboardException If there is a problem posting the artifact. */ public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled) throws TskCoreException, BlackboardException { @@ -78,14 +79,14 @@ public BlackboardArtifact addInstalledProgram(String programName, long dateInsta * * @return Installed program artifact added. * - * @throws TskCoreException If there is an error creating the artifact. + * @throws TskCoreException If there is an error creating the artifact. * @throws BlackboardException If there is a problem posting the artifact. */ public BlackboardArtifact addInstalledProgram(String programName, long dateInstalled, Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException { Collection<BlackboardAttribute> attributes = new ArrayList<>(); - + // construct attributes attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName)); addAttributeIfNotZero(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, dateInstalled, attributes); @@ -96,7 +97,7 @@ public BlackboardArtifact addInstalledProgram(String programName, long dateInsta // create artifact Content content = getContent(); BlackboardArtifact installedProgramArtifact = content.newDataArtifact(INSTALLED_PROG_TYPE, attributes); - + // post artifact getSleuthkitCase().getBlackboard().postArtifact(installedProgramArtifact, getModuleName()); diff --git a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/GeoArtifactsHelper.java b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/GeoArtifactsHelper.java index 4e51e3681..321b18a34 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/GeoArtifactsHelper.java +++ b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/GeoArtifactsHelper.java @@ -41,11 +41,11 @@ public final class GeoArtifactsHelper extends ArtifactHelperBase { private static final BlackboardAttribute.Type WAYPOINTS_ATTR_TYPE = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_WAYPOINTS); private static final BlackboardAttribute.Type TRACKPOINTS_ATTR_TYPE = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_TRACKPOINTS); private static final BlackboardAttribute.Type AREAPOINTS_ATTR_TYPE = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_AREAPOINTS); - + private static final BlackboardArtifact.Type GPS_TRACK_TYPE = new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACK); private static final BlackboardArtifact.Type GPS_ROUTE_TYPE = new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); private static final BlackboardArtifact.Type GPS_AREA_TYPE = new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_AREA); - + private final String programName; /** @@ -171,7 +171,7 @@ public BlackboardArtifact addRoute(String routeName, Long creationTime, GeoWaypo Content content = getContent(); BlackboardArtifact artifact = content.newDataArtifact(GPS_ROUTE_TYPE, attributes); - + getSleuthkitCase().getBlackboard().postArtifact(artifact, getModuleName()); return artifact; @@ -219,7 +219,7 @@ public BlackboardArtifact addArea(String areaName, GeoAreaPoints areaPoints, Lis Content content = getContent(); BlackboardArtifact artifact = content.newDataArtifact(GPS_AREA_TYPE, attributes); - + getSleuthkitCase().getBlackboard().postArtifact(artifact, getModuleName()); return artifact; diff --git a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/WebBrowserArtifactsHelper.java b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/WebBrowserArtifactsHelper.java index 28f9b1b21..83b45f875 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/WebBrowserArtifactsHelper.java +++ b/bindings/java/src/org/sleuthkit/datamodel/blackboardutils/WebBrowserArtifactsHelper.java @@ -41,8 +41,8 @@ /** * Class to help ingest modules create Web Browser artifacts. * - * These include bookmarks, cookies, downloads, history, and web form - * autofill data. + * These include bookmarks, cookies, downloads, history, and web form autofill + * data. * */ public final class WebBrowserArtifactsHelper extends ArtifactHelperBase { @@ -54,7 +54,7 @@ public final class WebBrowserArtifactsHelper extends ArtifactHelperBase { private static final BlackboardArtifact.Type WEB_FORM_ADDRESS_TYPE = new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_ADDRESS); private static final BlackboardArtifact.Type WEB_FORM_AUTOFILL_TYPE = new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_FORM_AUTOFILL); private static final BlackboardArtifact.Type WEB_HISTORY_TYPE = new BlackboardArtifact.Type(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY); - + /** * Creates a WebBrowserArtifactsHelper. * @@ -116,7 +116,7 @@ public BlackboardArtifact addWebBookmark(String url, String title, long creation // add attributes to artifact attributes.addAll(otherAttributesList); - + Content content = getContent(); BlackboardArtifact bookMarkArtifact = content.newDataArtifact(WEB_BOOKMARK_TYPE, attributes); @@ -185,10 +185,10 @@ public BlackboardArtifact addWebCookie(String url, // add attributes to artifact attributes.addAll(otherAttributesList); - + Content content = getContent(); BlackboardArtifact cookieArtifact = content.newDataArtifact(WEB_COOKIE_TYPE, attributes); - + // post artifact getSleuthkitCase().getBlackboard().postArtifact(cookieArtifact, getModuleName()); @@ -244,10 +244,10 @@ public BlackboardArtifact addWebDownload(String url, long startTime, String path // add attributes to artifact attributes.addAll(otherAttributesList); - + Content content = getContent(); BlackboardArtifact webDownloadArtifact = content.newDataArtifact(WEB_DOWNLOAD_TYPE, attributes); - + // post artifact getSleuthkitCase().getBlackboard().postArtifact(webDownloadArtifact, getModuleName()); @@ -302,25 +302,25 @@ public BlackboardArtifact addWebFormAddress(String personName, String email, Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException { Collection<BlackboardAttribute> attributes = new ArrayList<>(); - + CommunicationsManager commManager = this.getSleuthkitCase().getCommunicationsManager(); - + if (StringUtils.isNotEmpty(email)) { try { - commManager.createAccountFileInstance(Account.Type.EMAIL, email, this.getModuleName(), this.getContent()); + commManager.createAccountFileInstance(Account.Type.EMAIL, email, this.getModuleName(), this.getContent()); } catch (InvalidAccountIDException ex) { LOGGER.log(Level.WARNING, String.format("Invalid account identifier %s", email), ex); } } - if(StringUtils.isNotEmpty(phoneNumber)) { + if (StringUtils.isNotEmpty(phoneNumber)) { try { - commManager.createAccountFileInstance(Account.Type.PHONE, phoneNumber, this.getModuleName(), this.getContent()); + commManager.createAccountFileInstance(Account.Type.PHONE, phoneNumber, this.getModuleName(), this.getContent()); } catch (InvalidAccountIDException ex) { LOGGER.log(Level.WARNING, String.format("Invalid account identifier %s", phoneNumber), ex); } } - + // construct attributes attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, getModuleName(), personName)); @@ -335,7 +335,7 @@ public BlackboardArtifact addWebFormAddress(String personName, String email, // add artifact Content content = getContent(); BlackboardArtifact webFormAddressArtifact = content.newDataArtifact(WEB_FORM_ADDRESS_TYPE, attributes); - + // post artifact getSleuthkitCase().getBlackboard().postArtifact(webFormAddressArtifact, getModuleName()); @@ -383,7 +383,7 @@ public BlackboardArtifact addWebFormAutofill(String name, String value, public BlackboardArtifact addWebFormAutofill(String name, String value, long creationTime, long accessTime, int count, Collection<BlackboardAttribute> otherAttributesList) throws TskCoreException, BlackboardException { - + Collection<BlackboardAttribute> attributes = new ArrayList<>(); // construct attributes @@ -399,7 +399,7 @@ public BlackboardArtifact addWebFormAutofill(String name, String value, Content content = getContent(); BlackboardArtifact webFormAutofillArtifact = content.newDataArtifact(WEB_FORM_AUTOFILL_TYPE, attributes); - + // post artifact getSleuthkitCase().getBlackboard().postArtifact(webFormAutofillArtifact, getModuleName()); @@ -410,12 +410,12 @@ public BlackboardArtifact addWebFormAutofill(String name, String value, /** * Adds a Web History artifact. * - * @param url Url visited, required. - * @param accessTime Last access time, may be 0 if not available. - * @param referrer Referrer, may be empty or null. - * @param title Website title, may be empty or null. - * @param programName Application/program recording the history, may be - * empty or null. + * @param url Url visited, required. + * @param accessTime Last access time, may be 0 if not available. + * @param referrer Referrer, may be empty or null. + * @param title Website title, may be empty or null. + * @param programName Application/program recording the history, may be + * empty or null. * * @return Web history artifact created. * @@ -462,10 +462,10 @@ public BlackboardArtifact addWebHistory(String url, long accessTime, // add attributes to artifact attributes.addAll(otherAttributesList); - + Content content = getContent(); BlackboardArtifact webHistoryArtifact = content.newDataArtifact(WEB_HISTORY_TYPE, attributes); - + // post artifact getSleuthkitCase().getBlackboard().postArtifact(webHistoryArtifact, getModuleName()); -- GitLab