mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
702c0f08de
@ -67,7 +67,7 @@ public class AddBlackboardArtifactTagAction extends AddTagAction {
|
||||
Case.getCurrentCase().getServices().getTagsManager().addBlackboardArtifactTag(artifact, tagName, comment);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex);
|
||||
Logger.getLogger(AddBlackboardArtifactTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddBlackboardArtifactTagAction.unableToTag.msg",
|
||||
|
@ -113,7 +113,7 @@ public class AddContentTagAction extends AddTagAction {
|
||||
Case.getCurrentCase().getServices().getTagsManager().addContentTag(file, tagName, comment);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex);
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error tagging result", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AddContentTagAction.unableToTag.msg2",
|
||||
|
@ -83,7 +83,7 @@ abstract class AddTagAction extends TagAction implements Presenter.Popup {
|
||||
tagNames = tagsManager.getAllTagNames();
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
|
||||
Logger.getLogger(TagsManager.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
||||
}
|
||||
|
||||
// Create a "Quick Tag" sub-menu.
|
||||
|
@ -61,7 +61,7 @@ public class DeleteBlackboardArtifactTagAction extends TagAction {
|
||||
Case.getCurrentCase().getServices().getTagsManager().deleteBlackboardArtifactTag(tag);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex);
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteBlackboardArtifactTagAction.unableToDelTag.msg",
|
||||
|
@ -61,7 +61,7 @@ public class DeleteContentTagAction extends TagAction {
|
||||
Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(tag);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex);
|
||||
Logger.getLogger(AddContentTagAction.class.getName()).log(Level.SEVERE, "Error deleting tag", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"DeleteContentTagAction.unableToDelTag.msg",
|
||||
|
@ -94,7 +94,7 @@ public class GetTagNameAndCommentDialog extends JDialog {
|
||||
currentTagNames = tagsManager.getAllTagNames();
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(GetTagNameAndCommentDialog.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
|
||||
Logger.getLogger(GetTagNameAndCommentDialog.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
||||
}
|
||||
if (null != currentTagNames && currentTagNames.isEmpty()) {
|
||||
tagCombo.addItem(NO_TAG_NAMES_MESSAGE);
|
||||
|
@ -43,7 +43,7 @@ import org.sleuthkit.datamodel.TagName;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
public class GetTagNameDialog extends JDialog {
|
||||
private static final String TAG_ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
|
||||
private static final String TAG_ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS
|
||||
private final HashMap<String, TagName> tagNames = new HashMap<>();
|
||||
private TagName tagName = null;
|
||||
|
||||
@ -79,7 +79,7 @@ public class GetTagNameDialog extends JDialog {
|
||||
currentTagNames = tagsManager.getAllTagNames();
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(GetTagNameDialog.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex);
|
||||
Logger.getLogger(GetTagNameDialog.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
||||
}
|
||||
if (null != currentTagNames) {
|
||||
for (TagName name : currentTagNames) {
|
||||
@ -299,7 +299,7 @@ public class GetTagNameDialog extends JDialog {
|
||||
dispose();
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex);
|
||||
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"GetTagNameDialog.unableToAddTagNameToCase.msg",
|
||||
@ -309,7 +309,7 @@ public class GetTagNameDialog extends JDialog {
|
||||
tagName = null;
|
||||
}
|
||||
catch (TagsManager.TagNameAlreadyExistsException ex) {
|
||||
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex);
|
||||
Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex); //NON-NLS
|
||||
JOptionPane.showMessageDialog(null,
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"GetTagNameDialog.tagNameAlreadyDef.msg",
|
||||
|
@ -71,7 +71,7 @@ class FileExtMismatchXML {
|
||||
* Singleton provides default configuration from user's directory; user CAN
|
||||
* modify this file.
|
||||
*/
|
||||
public static FileExtMismatchXML getDefault() {
|
||||
public static synchronized FileExtMismatchXML getDefault() {
|
||||
if (defaultInstance == null) {
|
||||
final String FILTER_CONFIG_FILE = PlatformUtil.getUserConfigDirectory() + File.separator + DEFAULT_CONFIG_FILE_NAME;
|
||||
defaultInstance = new FileExtMismatchXML(FILTER_CONFIG_FILE);
|
||||
|
@ -29,6 +29,9 @@ import org.sleuthkit.datamodel.AbstractFile;
|
||||
*/
|
||||
interface FileTypeDetectionInterface {
|
||||
|
||||
/**
|
||||
* Instances of this data structure are not shared between threads
|
||||
*/
|
||||
public class FileIdInfo {
|
||||
|
||||
public String type;
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.modules.filetypeid;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
@ -47,8 +47,8 @@ public class FileTypeIdIngestModule extends IngestModuleAdapter implements FileI
|
||||
private static final long MIN_FILE_SIZE = 512;
|
||||
private final FileTypeIdModuleSettings settings;
|
||||
private long jobId;
|
||||
private static AtomicLong matchTime = new AtomicLong(0);
|
||||
private static AtomicLong numFiles = new AtomicLong(0);
|
||||
|
||||
private static final HashMap<Long, IngestJobTotals> totalsForIngestJobs = new HashMap<>();
|
||||
private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter();
|
||||
|
||||
// The detector. Swap out with a different implementation of FileTypeDetectionInterface as needed.
|
||||
@ -56,6 +56,27 @@ public class FileTypeIdIngestModule extends IngestModuleAdapter implements FileI
|
||||
// actually have a list of detectors which are called in order until a match is found.
|
||||
private FileTypeDetectionInterface detector = new TikaFileTypeDetector();
|
||||
|
||||
private static class IngestJobTotals {
|
||||
long matchTime = 0;
|
||||
long numFiles = 0;
|
||||
}
|
||||
|
||||
private static synchronized void initTotals(long ingestJobId) {
|
||||
totalsForIngestJobs.put(ingestJobId, new IngestJobTotals());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the match time total and increment num of files for this job
|
||||
* @param ingestJobId
|
||||
* @param matchTimeInc amount of time to add
|
||||
*/
|
||||
private static synchronized void addToTotals(long ingestJobId, long matchTimeInc) {
|
||||
IngestJobTotals ingestJobTotals = totalsForIngestJobs.get(ingestJobId);
|
||||
ingestJobTotals.matchTime += matchTimeInc;
|
||||
ingestJobTotals.numFiles++;
|
||||
totalsForIngestJobs.put(ingestJobId, ingestJobTotals);
|
||||
}
|
||||
|
||||
FileTypeIdIngestModule(FileTypeIdModuleSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
@ -63,7 +84,9 @@ public class FileTypeIdIngestModule extends IngestModuleAdapter implements FileI
|
||||
@Override
|
||||
public void startUp(IngestJobContext context) throws IngestModuleException {
|
||||
jobId = context.getJobId();
|
||||
refCounter.incrementAndGet(jobId);
|
||||
if (refCounter.incrementAndGet(jobId) == 1) {
|
||||
initTotals(jobId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,8 +109,7 @@ public class FileTypeIdIngestModule extends IngestModuleAdapter implements FileI
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
FileTypeDetectionInterface.FileIdInfo fileId = detector.attemptMatch(abstractFile);
|
||||
matchTime.getAndAdd(System.currentTimeMillis() - startTime);
|
||||
numFiles.getAndIncrement();
|
||||
addToTotals(jobId, (System.currentTimeMillis() - startTime)); //add match time
|
||||
|
||||
if (!fileId.type.isEmpty()) {
|
||||
// add artifact
|
||||
@ -111,15 +133,17 @@ public class FileTypeIdIngestModule extends IngestModuleAdapter implements FileI
|
||||
public void shutDown(boolean ingestJobCancelled) {
|
||||
// We only need to post the summary msg from the last module per job
|
||||
if (refCounter.decrementAndGet(jobId) == 0) {
|
||||
IngestJobTotals jobTotals = totalsForIngestJobs.remove(jobId);
|
||||
|
||||
StringBuilder detailsSb = new StringBuilder();
|
||||
detailsSb.append("<table border='0' cellpadding='4' width='280'>");
|
||||
detailsSb.append("<tr><td>").append(FileTypeIdModuleFactory.getModuleName()).append("</td></tr>");
|
||||
detailsSb.append("<tr><td>")
|
||||
.append(NbBundle.getMessage(this.getClass(), "FileTypeIdIngestModule.complete.totalProcTime"))
|
||||
.append("</td><td>").append(matchTime.get()).append("</td></tr>\n");
|
||||
.append("</td><td>").append(jobTotals.matchTime).append("</td></tr>\n");
|
||||
detailsSb.append("<tr><td>")
|
||||
.append(NbBundle.getMessage(this.getClass(), "FileTypeIdIngestModule.complete.totalFiles"))
|
||||
.append("</td><td>").append(numFiles.get()).append("</td></tr>\n");
|
||||
.append("</td><td>").append(jobTotals.numFiles).append("</td></tr>\n");
|
||||
detailsSb.append("</table>");
|
||||
IngestServices.getInstance().postMessage(IngestMessage.createMessage(IngestMessage.MessageType.INFO, FileTypeIdModuleFactory.getModuleName(),
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
|
@ -25,7 +25,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
|
||||
*/
|
||||
public class FileTypeIdModuleSettings implements IngestModuleIngestJobSettings {
|
||||
|
||||
private boolean skipKnownFiles = true;
|
||||
private volatile boolean skipKnownFiles = true;
|
||||
|
||||
FileTypeIdModuleSettings() {
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.sleuthkit.datamodel.AbstractFile;
|
||||
|
||||
class TikaFileTypeDetector implements FileTypeDetectionInterface {
|
||||
|
||||
private static Tika tikaInst = new Tika();
|
||||
private static Tika tikaInst = new Tika(); //calling detect() with this should be thread-safe
|
||||
|
||||
@Override
|
||||
public FileTypeDetectionInterface.FileIdInfo attemptMatch(AbstractFile abstractFile) {
|
||||
|
@ -187,7 +187,7 @@ public final class SevenZipIngestModule extends IngestModuleAdapter implements F
|
||||
|
||||
@Override
|
||||
public void shutDown(boolean ingestJobCancelled) {
|
||||
// We don't need the value, but for cleanliness and consistency, -- it
|
||||
// We don't need the value, but for cleanliness and consistency
|
||||
refCounter.decrementAndGet(jobId);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
|
@ -45,7 +45,6 @@ import javax.swing.text.html.HTMLEditorKit.HTMLFactory;
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
import org.netbeans.api.progress.ProgressHandle;
|
||||
import org.netbeans.api.progress.ProgressHandleFactory;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.sleuthkit.autopsy.coreutils.EscapeUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.TextUtil;
|
||||
|
||||
|
@ -31,7 +31,6 @@ import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.client.solrj.SolrRequest.METHOD;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.sleuthkit.autopsy.coreutils.Version;
|
||||
import org.sleuthkit.autopsy.datamodel.HighlightLookup;
|
||||
|
@ -22,9 +22,7 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
import org.openide.util.Exceptions;
|
||||
@ -44,7 +42,7 @@ public class KeywordSearch {
|
||||
private static Server server;
|
||||
//we want a custom java.util.logging.Logger here for a reason
|
||||
//a separate logger from framework logs
|
||||
static final Logger TIKA_LOGGER = Logger.getLogger("Tika");
|
||||
private static final Logger TIKA_LOGGER = Logger.getLogger("Tika");
|
||||
private static final Logger logger = Logger.getLogger(Case.class.getName());
|
||||
public enum QueryType {
|
||||
LITERAL, REGEX
|
||||
@ -100,7 +98,7 @@ public class KeywordSearch {
|
||||
changeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
static void fireNumIndexedFilesChange(Integer oldNum, Integer newNum) {
|
||||
public static void fireNumIndexedFilesChange(Integer oldNum, Integer newNum) {
|
||||
|
||||
try {
|
||||
changeSupport.firePropertyChange(NUM_FILES_CHANGE_EVT, oldNum, newNum);
|
||||
|
@ -19,6 +19,8 @@
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
@ -37,6 +39,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSetttingsPanel;
|
||||
@ServiceProvider(service = IngestModuleFactory.class)
|
||||
public class KeywordSearchModuleFactory extends IngestModuleFactoryAdapter {
|
||||
|
||||
private static final HashSet<String> defaultDisabledKeywordListNames = new HashSet<>(Arrays.asList("Phone Numbers", "IP Addresses", "URLs"));
|
||||
private KeywordSearchJobSettingsPanel jobSettingsPanel = null;
|
||||
|
||||
@Override
|
||||
@ -64,9 +67,10 @@ public class KeywordSearchModuleFactory extends IngestModuleFactoryAdapter {
|
||||
List<String> enabledKeywordLists = new ArrayList<>();
|
||||
List<KeywordList> keywordLists = listManager.getListsL();
|
||||
for (KeywordList keywordList : keywordLists) {
|
||||
// All available keyword search lists are enabled by default.
|
||||
if (!defaultDisabledKeywordListNames.contains(keywordList.getName())) {
|
||||
enabledKeywordLists.add(keywordList.getName());
|
||||
}
|
||||
}
|
||||
return new KeywordSearchJobSettings(enabledKeywordLists);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ class ScalpelCarverIngestModule extends IngestModuleAdapter implements FileInges
|
||||
|
||||
@Override
|
||||
public ProcessResult process(AbstractFile abstractFile) {
|
||||
ScalpelCarver.init(); // RJCTODO: Is this ScalpelCarver class thread-safe?
|
||||
ScalpelCarver.init();
|
||||
|
||||
if (!initialized) {
|
||||
return ProcessResult.OK;
|
||||
|
@ -39,7 +39,7 @@ public class ScalpelCarver {
|
||||
|
||||
private static final String SCALPEL_JNI_LIB = "libscalpel_jni";
|
||||
private static final String SCALPEL_OUTPUT_FILE_NAME = "audit.txt";
|
||||
private static boolean initialized = false;
|
||||
private static volatile boolean initialized = false;
|
||||
private static final Logger logger = Logger.getLogger(ScalpelCarver.class.getName());
|
||||
|
||||
private static native void carveNat(String carverInputId, ReadContentInputStream input, String configFilePath, String outputFolderPath) throws ScalpelException;
|
||||
@ -48,7 +48,7 @@ public class ScalpelCarver {
|
||||
|
||||
}
|
||||
|
||||
public static boolean init() {
|
||||
public static synchronized boolean init() {
|
||||
if (initialized) {
|
||||
return true;
|
||||
}
|
||||
|
@ -252,11 +252,13 @@ public class RegressionTest extends TestCase {
|
||||
if (Boolean.parseBoolean(System.getProperty("ignore_unalloc"))) {
|
||||
jbco0.doClick();
|
||||
}
|
||||
new Timeout("pausing", 10000).sleep(); // let things catch up
|
||||
wo.btNext().clickMouse();
|
||||
}
|
||||
|
||||
public void testIngest() {
|
||||
logger.info("Ingest 3");
|
||||
new Timeout("pausing", 10000).sleep(); // wait for ingest to actually start
|
||||
long startIngest = System.currentTimeMillis();
|
||||
IngestManager man = IngestManager.getInstance();
|
||||
while (man.isIngestRunning()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user