Merge remote-tracking branch 'upstream/release-4.11.0' into develop

This commit is contained in:
Richard Cordovano 2019-04-11 18:29:31 -04:00
commit aaf5d4dc75
8 changed files with 87 additions and 43 deletions

View File

@ -43,6 +43,8 @@ import org.sleuthkit.autopsy.casemodule.multiusercasesbrowser.MultiUserCaseBrows
public final class MultiUserCasesBrowserPanel extends javax.swing.JPanel implements ExplorerManager.Provider { public final class MultiUserCasesBrowserPanel extends javax.swing.JPanel implements ExplorerManager.Provider {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int NAME_COLUMN_INDEX = 0;
private static final int NAME_COLUMN_WIDTH = 150;
private final ExplorerManager explorerManager; private final ExplorerManager explorerManager;
private final MultiUserCaseBrowserCustomizer customizer; private final MultiUserCaseBrowserCustomizer customizer;
private final OutlineView outlineView; private final OutlineView outlineView;
@ -103,6 +105,11 @@ public final class MultiUserCasesBrowserPanel extends javax.swing.JPanel impleme
} }
} }
/*
* Give the case name column a greater width.
*/
outline.getColumnModel().getColumn(NAME_COLUMN_INDEX).setPreferredWidth(NAME_COLUMN_WIDTH);
/* /*
* Hide the root node and configure the node selection mode. * Hide the root node and configure the node selection mode.
*/ */

View File

@ -53,6 +53,8 @@ final class AutoIngestDashboard extends JPanel implements Observer {
private final static String ADMIN_ACCESS_FILE_NAME = "admin"; // NON-NLS private final static String ADMIN_ACCESS_FILE_NAME = "admin"; // NON-NLS
private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString(); private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString();
private final static String ADMIN_EXT_ACCESS_FILE_NAME = "adminext"; // NON-NLS
private final static String ADMIN_EXT_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_EXT_ACCESS_FILE_NAME).toString();
private final static String AID_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d"; private final static String AID_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d";
private final static int AID_REFRESH_INTERVAL_SECS = 30; private final static int AID_REFRESH_INTERVAL_SECS = 30;
private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 0; private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 0;
@ -277,8 +279,8 @@ final class AutoIngestDashboard extends JPanel implements Observer {
} }
/** /**
* Reloads the table models using a RefreshChildrenEvent and refreshes the JTables * Reloads the table models using a RefreshChildrenEvent and refreshes the
* that use the models. * JTables that use the models.
* *
*/ */
void refreshTables() { void refreshTables() {
@ -318,9 +320,24 @@ final class AutoIngestDashboard extends JPanel implements Observer {
} }
/**
* Determines whether or not system adminstrator features of the dashboard
* are enabled.
*
* @return True or false.
*/
static boolean isAdminAutoIngestDashboard() { static boolean isAdminAutoIngestDashboard() {
File f = new File(ADMIN_ACCESS_FILE_PATH); return new File(ADMIN_ACCESS_FILE_PATH).exists() || new File(ADMIN_EXT_ACCESS_FILE_PATH).exists();
return f.exists(); }
/**
* Determines whether the extended system administrator features of the
* cases dashboard are enabled.
*
* @return True or false.
*/
static boolean extendedFeaturesAreEnabled() {
return new File(ADMIN_EXT_ACCESS_FILE_PATH).exists();
} }
/** /**

View File

@ -1271,12 +1271,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* @param nodeData The data stored in the manifest file coordination * @param nodeData The data stored in the manifest file coordination
* service node for the job. * service node for the job.
* *
* @throws AutoIngestJobException If there was an error working * @throws AutoIngestJobException If there was an error working with the
* with the node data. * node data.
* @throws InterruptedException If the thread running the input * @throws InterruptedException If the thread running the input
* directory scan task is * directory scan task is interrupted
* interrupted while blocked, i.e., * while blocked, i.e., if auto ingest is
* if auto ingest is shutting down. * shutting down.
*/ */
private void addPendingJob(Manifest manifest, AutoIngestJobNodeData nodeData) throws AutoIngestJobException, InterruptedException { private void addPendingJob(Manifest manifest, AutoIngestJobNodeData nodeData) throws AutoIngestJobException, InterruptedException {
AutoIngestJob job; AutoIngestJob job;
@ -1415,6 +1415,8 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
sysLogger.log(Level.SEVERE, String.format("Error writing case auto ingest log entry for crashed job for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error writing case auto ingest log entry for crashed job for %s", manifestPath), ex);
} }
} }
updateAutoIngestJobData(job);
newPendingJobsList.add(job);
} else { } else {
job.setProcessingStatus(AutoIngestJob.ProcessingStatus.COMPLETED); job.setProcessingStatus(AutoIngestJob.ProcessingStatus.COMPLETED);
job.setCompletedDate(Date.from(Instant.now())); job.setCompletedDate(Date.from(Instant.now()));
@ -1425,9 +1427,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
sysLogger.log(Level.SEVERE, String.format("Error writing case auto ingest log entry for crashed job for %s", manifestPath), ex); sysLogger.log(Level.SEVERE, String.format("Error writing case auto ingest log entry for crashed job for %s", manifestPath), ex);
} }
} }
updateAutoIngestJobData(job);
newCompletedJobsList.add(job);
} }
updateAutoIngestJobData(job);
newPendingJobsList.add(job);
} }
} }
} }
@ -1440,12 +1442,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* @param nodeData The data stored in the manifest file lock * @param nodeData The data stored in the manifest file lock
* coordination service node for the job. * coordination service node for the job.
* *
* @throws AutoIngestJobException If there was an error working * @throws AutoIngestJobException If there was an error working with the
* with the node data. * node data.
* @throws InterruptedException If the thread running the input * @throws InterruptedException If the thread running the input
* directory scan task is * directory scan task is interrupted
* interrupted while blocked, i.e., * while blocked, i.e., if auto ingest is
* if auto ingest is shutting down. * shutting down.
*/ */
private void addCompletedJob(Manifest manifest, AutoIngestJobNodeData nodeData) throws AutoIngestJobException, InterruptedException { private void addCompletedJob(Manifest manifest, AutoIngestJobNodeData nodeData) throws AutoIngestJobException, InterruptedException {
Path caseDirectoryPath = nodeData.getCaseDirectoryPath(); Path caseDirectoryPath = nodeData.getCaseDirectoryPath();
@ -1995,15 +1997,26 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
AutoIngestJobNodeData nodeData = new AutoIngestJobNodeData(coordinationService.getNodeData(CoordinationService.CategoryNode.MANIFESTS, manifestPath.toString())); AutoIngestJobNodeData nodeData = new AutoIngestJobNodeData(coordinationService.getNodeData(CoordinationService.CategoryNode.MANIFESTS, manifestPath.toString()));
if (!nodeData.getProcessingStatus().equals(PENDING)) { if (!nodeData.getProcessingStatus().equals(PENDING)) {
iterator.remove(); iterator.remove();
manifestLock.release();
manifestLock = null;
continue; continue;
} }
/*
* Ditto for the presence of the manifest file.
*/
File manifestFile = nodeData.getManifestFilePath().toFile(); File manifestFile = nodeData.getManifestFilePath().toFile();
if (!manifestFile.exists()) { if (!manifestFile.exists()) {
iterator.remove(); iterator.remove();
manifestLock.release();
manifestLock = null;
continue; continue;
} }
/*
* Finally, check for devoting too many resources to a
* single case, if the check is enabled.
*/
if (enforceMaxJobsPerCase) { if (enforceMaxJobsPerCase) {
int currentJobsForCase = 0; int currentJobsForCase = 0;
for (AutoIngestJob runningJob : hostNamesToRunningJobs.values()) { for (AutoIngestJob runningJob : hostNamesToRunningJobs.values()) {

View File

@ -18,14 +18,11 @@
*/ */
package org.sleuthkit.autopsy.experimental.autoingest; package org.sleuthkit.autopsy.experimental.autoingest;
import java.io.File;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.Action; import javax.swing.Action;
import org.sleuthkit.autopsy.casemodule.multiusercases.CaseNodeData; import org.sleuthkit.autopsy.casemodule.multiusercases.CaseNodeData;
import org.sleuthkit.autopsy.casemodule.multiusercasesbrowser.MultiUserCaseBrowserCustomizer; import org.sleuthkit.autopsy.casemodule.multiusercasesbrowser.MultiUserCaseBrowserCustomizer;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
* A customizer for the multi-user case browser panel used in the administrative * A customizer for the multi-user case browser panel used in the administrative
@ -34,8 +31,6 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
*/ */
final class CasesDashboardCustomizer implements MultiUserCaseBrowserCustomizer { final class CasesDashboardCustomizer implements MultiUserCaseBrowserCustomizer {
private final static String ADMIN_EXT_ACCESS_FILE_NAME = "adminext"; // NON-NLS
private final static String ADMIN_EXT_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_EXT_ACCESS_FILE_NAME).toString();
private final DeleteCaseAction deleteCaseAction; private final DeleteCaseAction deleteCaseAction;
private final DeleteCaseInputAction deleteCaseInputAction; private final DeleteCaseInputAction deleteCaseInputAction;
private final DeleteCaseOutputAction deleteCaseOutputAction; private final DeleteCaseOutputAction deleteCaseOutputAction;
@ -67,7 +62,7 @@ final class CasesDashboardCustomizer implements MultiUserCaseBrowserCustomizer {
properties.add(Column.LAST_ACCESS_DATE); properties.add(Column.LAST_ACCESS_DATE);
properties.add(Column.DIRECTORY); properties.add(Column.DIRECTORY);
properties.add(Column.MANIFEST_FILE_ZNODES_DELETE_STATUS); properties.add(Column.MANIFEST_FILE_ZNODES_DELETE_STATUS);
if (CasesDashboardCustomizer.extendedFeaturesAreEnabled()) { if (AutoIngestDashboard.extendedFeaturesAreEnabled()) {
properties.add(Column.DATA_SOURCES_DELETE_STATUS); properties.add(Column.DATA_SOURCES_DELETE_STATUS);
} }
properties.add(Column.TEXT_INDEX_DELETE_STATUS); properties.add(Column.TEXT_INDEX_DELETE_STATUS);
@ -93,7 +88,7 @@ final class CasesDashboardCustomizer implements MultiUserCaseBrowserCustomizer {
List<Action> actions = new ArrayList<>(); List<Action> actions = new ArrayList<>();
actions.add(new OpenCaseAction(nodeData)); actions.add(new OpenCaseAction(nodeData));
actions.add(new OpenAutoIngestLogAction(nodeData)); actions.add(new OpenAutoIngestLogAction(nodeData));
if (CasesDashboardCustomizer.extendedFeaturesAreEnabled()) { if (AutoIngestDashboard.extendedFeaturesAreEnabled()) {
actions.add(deleteCaseInputAction); actions.add(deleteCaseInputAction);
actions.add(deleteCaseOutputAction); actions.add(deleteCaseOutputAction);
actions.add(deleteCaseInputAndOutputAction); actions.add(deleteCaseInputAndOutputAction);
@ -108,15 +103,4 @@ final class CasesDashboardCustomizer implements MultiUserCaseBrowserCustomizer {
return new OpenCaseAction(nodeData); return new OpenCaseAction(nodeData);
} }
/**
* Determines whether the extended system administrator features of the
* cases dashboard are enabled.
*
* @return True or false.
*/
static boolean extendedFeaturesAreEnabled() {
File f = new File(ADMIN_EXT_ACCESS_FILE_PATH);
return f.exists();
}
} }

View File

@ -646,13 +646,22 @@ public class GroupManager {
// reset the hash cache // reset the hash cache
controller.getHashSetManager().invalidateHashSetsCacheForFile(fileId); controller.getHashSetManager().invalidateHashSetsCacheForFile(fileId);
// first of all, update the current path group, regardless of what grouping is in view
try {
DrawableFile file = getDrawableDB().getFileFromID(fileId);
String pathVal = file.getDrawablePath();
GroupKey<?> pathGroupKey = new GroupKey<>(DrawableAttribute.PATH,pathVal, file.getDataSource());
updateCurrentPathGroup(pathGroupKey);
} catch (TskCoreException | TskDataException ex) {
Exceptions.printStackTrace(ex);
}
// Update the current groups (if it is visible) // Update the current groups (if it is visible)
Set<GroupKey<?>> groupsForFile = getGroupKeysForCurrentGroupBy(fileId); Set<GroupKey<?>> groupsForFile = getGroupKeysForCurrentGroupBy(fileId);
for (GroupKey<?> gk : groupsForFile) { for (GroupKey<?> gk : groupsForFile) {
// see if a group has been created yet for the key // see if a group has been created yet for the key
DrawableGroup g = getGroupForKey(gk); DrawableGroup g = getGroupForKey(gk);
updateCurrentPathGroup(gk);
addFileToGroup(g, gk, fileId); addFileToGroup(g, gk, fileId);
} }
} }
@ -756,8 +765,10 @@ public class GroupManager {
controller.getCategoryManager().registerListener(group); controller.getCategoryManager().registerListener(group);
groupMap.put(groupKey, group); groupMap.put(groupKey, group);
} }
if (analyzedGroups.contains(group) == false) { // Add to analyzedGroups only if it's the same group type as the one in view
if ((analyzedGroups.contains(group) == false) &&
(getGroupBy() == group.getGroupKey().getAttribute())) {
analyzedGroups.add(group); analyzedGroups.add(group);
sortAnalyzedGroups(); sortAnalyzedGroups();
} }

View File

@ -170,16 +170,21 @@ abstract class Extract {
ResultSet temprs; ResultSet temprs;
List<HashMap<String, Object>> list; List<HashMap<String, Object>> list;
String connectionString = "jdbc:sqlite:" + path; //NON-NLS String connectionString = "jdbc:sqlite:" + path; //NON-NLS
SQLiteDBConnect tempdbconnect = null;
try { try {
SQLiteDBConnect tempdbconnect = new SQLiteDBConnect("org.sqlite.JDBC", connectionString); //NON-NLS tempdbconnect = new SQLiteDBConnect("org.sqlite.JDBC", connectionString); //NON-NLS
temprs = tempdbconnect.executeQry(query); temprs = tempdbconnect.executeQry(query);
list = this.resultSetToArrayList(temprs); list = this.resultSetToArrayList(temprs);
tempdbconnect.closeConnection();
} catch (SQLException ex) { } catch (SQLException ex) {
logger.log(Level.SEVERE, "Error while trying to read into a sqlite db." + connectionString, ex); //NON-NLS logger.log(Level.SEVERE, "Error while trying to read into a sqlite db." + connectionString, ex); //NON-NLS
errorMessages.add(NbBundle.getMessage(this.getClass(), "Extract.dbConn.errMsg.failedToQueryDb", getName())); errorMessages.add(NbBundle.getMessage(this.getClass(), "Extract.dbConn.errMsg.failedToQueryDb", getName()));
return Collections.<HashMap<String, Object>>emptyList(); return Collections.<HashMap<String, Object>>emptyList();
} }
finally {
if (tempdbconnect != null) {
tempdbconnect.closeConnection();
}
}
return list; return list;
} }

View File

@ -253,6 +253,7 @@ class ExtractRegistry extends Extract {
logger.log(Level.WARNING, "Keyword search service not found. Report will not be indexed"); logger.log(Level.WARNING, "Keyword search service not found. Report will not be indexed");
} else { } else {
searchService.index(report); searchService.index(report);
report.close();
} }
} catch (TskCoreException e) { } catch (TskCoreException e) {
this.addErrorMessage("Error adding regripper output as Autopsy report: " + e.getLocalizedMessage()); //NON-NLS this.addErrorMessage("Error adding regripper output as Autopsy report: " + e.getLocalizedMessage()); //NON-NLS

View File

@ -148,8 +148,9 @@ class Util {
String query = "PRAGMA table_info(" + tablename + ")"; //NON-NLS String query = "PRAGMA table_info(" + tablename + ")"; //NON-NLS
boolean found = false; boolean found = false;
ResultSet temprs; ResultSet temprs;
SQLiteDBConnect tempdbconnect = null;
try { try {
SQLiteDBConnect tempdbconnect = new SQLiteDBConnect("org.sqlite.JDBC", "jdbc:sqlite:" + connection); //NON-NLS tempdbconnect = new SQLiteDBConnect("org.sqlite.JDBC", "jdbc:sqlite:" + connection); //NON-NLS
temprs = tempdbconnect.executeQry(query); temprs = tempdbconnect.executeQry(query);
while (temprs.next()) { while (temprs.next()) {
if (temprs.getString("name") == null ? column == null : temprs.getString("name").equals(column)) { //NON-NLS if (temprs.getString("name") == null ? column == null : temprs.getString("name").equals(column)) { //NON-NLS
@ -159,6 +160,11 @@ class Util {
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.WARNING, "Error while trying to get columns from sqlite db." + connection, ex); //NON-NLS logger.log(Level.WARNING, "Error while trying to get columns from sqlite db." + connection, ex); //NON-NLS
} }
finally{
if (tempdbconnect != null) {
tempdbconnect.closeConnection();
}
}
return found; return found;
} }