From 426fc0a881996174656022ea320c43836b38554c Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Wed, 17 Jan 2018 09:59:06 -0500 Subject: [PATCH 01/10] Updated error messages and surrounding logic for KWS. --- .../autopsy/keywordsearch/AccountsText.java | 18 ++-- .../autopsy/keywordsearch/Bundle.properties | 6 -- .../keywordsearch/Bundle_ja.properties | 4 +- .../keywordsearch/ExtractedContentPanel.java | 4 +- .../keywordsearch/ExtractedContentViewer.java | 6 ++ .../keywordsearch/HighlightedText.java | 15 ++-- .../autopsy/keywordsearch/RawText.java | 88 ++++++++----------- 7 files changed, 58 insertions(+), 83 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java index e5f17cef12..812a16bbbf 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrRequest.METHOD; import org.apache.solr.client.solrj.response.QueryResponse; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -52,7 +53,7 @@ import org.sleuthkit.datamodel.TskCoreException; */ class AccountsText implements IndexedText { - private static final Logger logger = Logger.getLogger(AccountsText.class.getName()); + private static final Logger LOGGER = Logger.getLogger(AccountsText.class.getName()); private static final boolean DEBUG = (Version.getBuildType() == Version.Type.DEVELOPMENT); private static final String CCN_REGEX = "(%?)(B?)([0-9][ \\-]*?){12,19}(\\^?)"; @@ -284,15 +285,6 @@ class AccountsText implements IndexedText { } @Override - @NbBundle.Messages({"AccountsText.getMarkup.noMatchMsg=" - + "
There were no keyword hits on this page. 
" - + "The keyword could have been in the file name." - + "
Advance to another page if present, or to view the original text, choose File Text" - + "
in the drop down menu to the right...
", - "AccountsText.getMarkup.queryFailedMsg=" - + "
Failed to retrieve keyword hit results."
-        + " 
Confirm that Autopsy can connect to the Solr server. " - + "
"}) public String getText() { try { loadPageInfo(); //inits once @@ -320,8 +312,8 @@ class AccountsText implements IndexedText { // extracted content (minus highlight tags) is HTML-escaped return "
" + highlightedText + "
"; //NON-NLS } catch (Exception ex) { - logger.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + this.solrObjectId + ", chunkID " + this.currentPage, ex); //NON-NLS - return Bundle.AccountsText_getMarkup_queryFailedMsg(); + LOGGER.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + this.solrObjectId + ", chunkID " + this.currentPage, ex); //NON-NLS + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getText.error.msg"); } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties index 8be786efda..2730c08b5c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties @@ -54,11 +54,6 @@ AbstractKeywordSearchPerformer.search.noFilesInIdxMsg=No files are in inde AbstractKeywordSearchPerformer.search.noFilesIdxdMsg=No files were indexed.
Re-ingest the image with the Keyword Search Module enabled. ExtractedContentViewer.toolTip=Displays extracted text from files and keyword-search results. Requires Keyword Search ingest to be run on a file to activate this viewer. ExtractedContentViewer.getTitle=Indexed Text -ExtractedContentViewer.getSolrContent.knownFileMsg=

{0} is a known file (based on MD5 hash) and does not have text in the index.

-ExtractedContentViewer.getSolrContent.noTxtYetMsg=

{0} does not have text in the index.
It may have no text, not been analyzed yet, or keyword search was not enabled during ingest.

-ExtractedContentViewer.getSolrContent.txtBodyItal={0} -HighlightedMatchesSource.getMarkup.noMatchMsg=Failed to retrieve indexed text for keyword hit. Advance to another page if present, or to view the original text, choose File Text in the drop down menu to the right. Alternatively, you may choose to extract file content and search for the hit using an external application (e.g. a text editor). -HighlightedMatchesSource.getMarkup.queryFailedMsg=
Failed to retrieve keyword hit results. 
Confirm that Autopsy can connect to the Solr server.
HighlightedMatchesSource.toString=Search Results Installer.reportPortError=Indexing server port {0} is not available. Check if your security software does not block {1} and consider changing {2} in {3} property file in the application user folder. Then try rebooting your system if another process was causing the conflict. Installer.reportStopPortError=Indexing server stop port {0} is not available. Consider changing {1} in {2} property file in the application user folder. @@ -272,7 +267,6 @@ KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.text=No periodic searche SolrConnectionCheck.HostnameOrPort=Invalid hostname and/or port number. SolrConnectionCheck.Hostname=Invalid hostname. SolrConnectionCheck.MissingHostname=Missing hostname. -RawText.getText.error.msg=Error getting text GlobalListsManagementPanel.newListButton.text=New List GlobalListsManagementPanel.importButton.text=Import List GlobalListsManagementPanel.keywordListsLabel.text=Keyword Lists: diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties index bdcc19f6f6..dbaae76b16 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties @@ -46,7 +46,6 @@ AbstractKeywordSearchPerformer.search.noFilesIdxdMsg=\u30a4\u30f3\u30c7\u3 ExtractedContentPanel.setMarkup.panelTxt=\u30c6\u30ad\u30b9\u30c8\u30ed\u30fc\u30c9\u4e2d...\u3057\u3070\u3089\u304f\u304a\u5f85\u3061\u304f\u3060\u3055\u3044\u3002 ExtractedContentViewer.toolTip=\u30d5\u30a1\u30a4\u30eb\u3084\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u7d50\u679c\u304b\u3089\u62bd\u51fa\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3002\u3053\u306e\u30d3\u30e5\u30fc\u30a2\u3092\u6709\u52b9\u5316\u3059\u308b\u306b\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u3057\u3066\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 ExtractedContentViewer.getTitle=\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u5316\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8 -ExtractedContentViewer.getSolrContent.knownFileMsg=

{0}\u306f\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3067\u3059\uff08MDS\u30cf\u30c3\u30b7\u30e5\u306b\u57fa\u3065\u304f\u3068\uff09\u3002\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u30c6\u30ad\u30b9\u30c8\u304c\u3042\u308a\u307e\u305b\u3093\u3002

ExtractedContentViewer.getSolrContent.noTxtYetMsg=

{0}\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u30c6\u30ad\u30b9\u30c8\u304c\u3042\u308a\u307e\u305b\u3093\u3002
\u30c6\u30ad\u30b9\u30c8\u304c\u7121\u3044\u304b\u3001\u307e\u3060\u89e3\u6790\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3001\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u304c\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u4e2d\u306b\u6709\u52b9\u5316\u3055\u308c\u3066\u3044\u306a\u304b\u3063\u305f\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002

HighlightedMatchesSource.toString=\u691c\u7d22\u7d50\u679c Installer.reportPortError=\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30b5\u30fc\u30d0\u30fc\u30dd\u30fc\u30c8 {0} \u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002\u4f7f\u7528\u3057\u3066\u3044\u308b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304c {1} \u3092\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30e6\u30fc\u30b6\u30fc\u30d5\u30a9\u30eb\u30c0\u30fc\u5185\u306e{3}\u30d7\u30ed\u30d1\u30c6\u30a3\u30d5\u30a1\u30a4\u30eb\u306e{2}\u3092\u5909\u66f4\u3059\u308b\u691c\u8a0e\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3082\u3057\u4ed6\u306e\u51e6\u7406\u304c\u554f\u984c\u306e\u539f\u56e0\u3067\u3042\u308c\u3070\u3001\u30b7\u30b9\u30c6\u30e0\u3092\u518d\u8d77\u52d5\u3057\u3066\u4e0b\u3055\u3044\u3002 @@ -261,7 +260,6 @@ KeywordSearchModuleFactory.getIngestJobSettingsPanel.exception.msg=\u8a2d\u5b9a\ SearchRunner.Searcher.done.err.msg=\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u3092\u5b9f\u884c\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.text=\u5b9a\u671f\u7684\u691c\u7d22\u7121\u3057 KeywordSearchGlobalSearchSettingsPanel.timeRadioButton5.toolTipText=\u5168\u4f53\u7684\u306b\u4e00\u756a\u901f\u3044\u3067\u3059\u304c\u3001\u51e6\u7406\u304c\u5b8c\u4e86\u3059\u308b\u307e\u3067\u7d50\u679c\u306f\u8868\u793a\u3055\u308c\u307e\u305b\u3093 -HighlightedMatchesSource.getMarkup.queryFailedMsg=
\u30ad\u30fc\u30ef\u30fc\u30c9\u306b\u30d2\u30c3\u30c8\u3057\u305f\u7d50\u679c\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
Autopsy\u304cSolr\u30b5\u30fc\u30d0\u30fc\u306b\u63a5\u7d9a\u3067\u304d\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002
\ KeywordSearch.openCore.notification.msg=\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u958b\u3051\u307e\u305b\u3093\u3067\u3057\u305f KeywordSearch.closeCore.notification.msg=\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u9589\u3058\u308b\u969b\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f KeywordSearchListsManagementPanel.fileExtensionFilterLb2=\u30ad\u30fc\u30ef\u30fc\u30c9\u30ea\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30a8\u30f3\u30b1\u30fc\u30b9\u3059\u308b(txt) @@ -272,7 +270,7 @@ SolrConnectionCheck.HostnameOrPort=hostname\u3084\u30dd\u30fc\u30c8\u756a\u53f7\ SolrConnectionCheck.Hostname=hostname\u304c\u7121\u52b9\u3067\u3059\u3002 SolrConnectionCheck.Port=\u30dd\u30fc\u30c8\u756a\u53f7\u304c\u7121\u52b9\u3067\u3059\u3002 SolrConnectionCheck.MissingHostname=hostname\u304c\u6b20\u3051\u3066\u307e\u3059\u3002 -RawText.getText.error.msg=\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f +ExtractedContentViewer.getText.error.msg=\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f GlobalListsManagementPanel.exportButton.text=\u30ea\u30b9\u30c8\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8 GlobalListsManagementPanel.deleteListButton.text=\u30ea\u30b9\u30c8\u3092\u524a\u9664 GlobalListsManagementPanel.copyListButton.text=\u30ea\u30b9\u30c8\u3092\u30b3\u30d4\u30fc diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java index 01647f2a46..fd8966e254 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java @@ -648,7 +648,7 @@ class ExtractedContentPanel extends javax.swing.JPanel { } @NbBundle.Messages({ - "ExtractedContentPanel.SetMarkup.error=There was an error getting the text for the selected source."}) + "ExtractedContentPanel.SetMarkup.error.msg=Error getting text."}) @Override protected void done() { super.done(); @@ -665,7 +665,7 @@ class ExtractedContentPanel extends javax.swing.JPanel { } catch (InterruptedException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); //NON-NLS - setPanelText(Bundle.ExtractedContentPanel_SetMarkup_error(), true); + setPanelText(NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentPanel.getText.error.msg"), true); } // catch and ignore if we were cancelled catch (java.util.concurrent.CancellationException ex) { } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java index dbed68e660..27c5ae6b72 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java @@ -29,6 +29,7 @@ import java.util.logging.Level; import org.openide.nodes.Node; import org.openide.util.Lookup; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; @@ -47,6 +48,11 @@ import org.sleuthkit.datamodel.TskCoreException; * A content viewer that displays the indexed text associated with a file or an * artifact, possibly marked up with HTML to highlight keyword hits. */ +@Messages({ + "ExtractedContentViewer.getText.error.msg=Error getting text.", + "ExtractedContentViewer.getSolrContent.noTxtYetMsg=

There is currently no text in the index for this {0}. It may have no text, it may not have been analyzed yet, there may have been an error extracting text, or keyword search was not enabled during ingest.

", + "ExtractedContentViewer.getSolrContent.txtBodyItal={0}" +}) @ServiceProvider(service = DataContentViewer.class, position = 4) public class ExtractedContentViewer implements DataContentViewer { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java index 70d2e69194..06f79de439 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.keywordsearch; import com.google.common.collect.Iterators; import com.google.common.collect.Range; -import com.google.common.collect.RangeSet; import com.google.common.collect.TreeRangeSet; import java.util.Arrays; import java.util.Collection; @@ -55,7 +54,7 @@ import org.sleuthkit.datamodel.TskCoreException; */ class HighlightedText implements IndexedText { - private static final Logger logger = Logger.getLogger(HighlightedText.class.getName()); + private static final Logger LOGGER = Logger.getLogger(HighlightedText.class.getName()); private static final boolean DEBUG = (Version.getBuildType() == Version.Type.DEVELOPMENT); @@ -140,7 +139,6 @@ class HighlightedText implements IndexedText { * This method figures out which pages / chunks have hits. Invoking it a * second time has no effect. */ - @Messages({"HighlightedText.query.exception.msg=Could not perform the query to get chunk info and get highlights:"}) synchronized private void loadPageInfo() throws TskCoreException, KeywordSearchModuleException, NoOpenCoreException { if (isPageInfoLoaded) { return; @@ -158,7 +156,6 @@ class HighlightedText implements IndexedText { this.numberPages = 1; this.currentPage = 1; numberOfHitsPerPage.put(1, 0); - pages.add(1); currentHitPerPage.put(1, 0); isPageInfoLoaded = true; } @@ -401,7 +398,7 @@ class HighlightedText implements IndexedText { // either be a single chunk containing hits or we narrow our // query down to the current page/chunk. if (response.getResults().size() > 1) { - logger.log(Level.WARNING, "Unexpected number of results for Solr highlighting query: {0}", q); //NON-NLS + LOGGER.log(Level.WARNING, "Unexpected number of results for Solr highlighting query: {0}", q); //NON-NLS } String highlightedContent; Map>> responseHighlight = response.getHighlighting(); @@ -427,8 +424,8 @@ class HighlightedText implements IndexedText { return "
" + highlightedContent + "
"; //NON-NLS } catch (TskCoreException | KeywordSearchModuleException | NoOpenCoreException ex) { - logger.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + objectId + ", chunkID " + chunkID + ", highlight query: " + highlightField, ex); //NON-NLS - return NbBundle.getMessage(this.getClass(), "HighlightedMatchesSource.getMarkup.queryFailedMsg"); + LOGGER.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + objectId + ", chunkID " + chunkID + ", highlight query: " + highlightField, ex); //NON-NLS + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getText.error.msg"); } } @@ -471,7 +468,7 @@ class HighlightedText implements IndexedText { */ static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection keywords) { if (solrDocumentList.isEmpty()) { - return NbBundle.getMessage(HighlightedText.class, "HighlightedMatchesSource.getMarkup.noMatchMsg"); + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "document"); // DLG: } // It doesn't make sense for there to be more than a single document in diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index 043738ae30..25a32401ef 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,16 +18,14 @@ */ package org.sleuthkit.autopsy.keywordsearch; -import java.util.LinkedHashMap; import java.util.logging.Level; import org.apache.solr.client.solrj.SolrServerException; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.TskData; /** * A "source" for the extracted content viewer that displays "raw" (not @@ -44,7 +42,7 @@ class RawText implements IndexedText { //keep last content cached private String cachedString; private int cachedChunk; - private static final Logger logger = Logger.getLogger(RawText.class.getName()); + private static final Logger LOGGER = Logger.getLogger(RawText.class.getName()); /** * Construct a new RawText object for the given content and object id. This @@ -153,10 +151,10 @@ class RawText implements IndexedText { } else if (this.blackboardArtifact != null) { return getArtifactText(); } - } catch (SolrServerException ex) { - logger.log(Level.SEVERE, "Couldn't get extracted content", ex); //NON-NLS + } catch (SolrServerException | NoOpenCoreException ex) { + LOGGER.log(Level.SEVERE, "Couldn't get extracted text", ex); //NON-NLS } - return NbBundle.getMessage(this.getClass(), "RawText.getText.error.msg"); + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewerRawText.getText.error.msg"); } @NbBundle.Messages({ @@ -208,10 +206,10 @@ class RawText implements IndexedText { hasChunks = true; } } catch (KeywordSearchModuleException ex) { - logger.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS + LOGGER.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS } catch (NoOpenCoreException ex) { - logger.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS + LOGGER.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS } } @@ -225,30 +223,20 @@ class RawText implements IndexedText { * chunks. This means we need to address the content * pages specially. * - * @return the extracted content + * @return the extracted text * - * @throws SolrServerException if something goes wrong + * @throws NoOpenCoreException If no Solr core is available. + * @throws SolrServerException If there's a Solr communication or parsing issue. */ - private String getContentText(int currentPage, boolean hasChunks) throws SolrServerException { + private String getContentText(int currentPage, boolean hasChunks) throws NoOpenCoreException, SolrServerException { final Server solrServer = KeywordSearch.getServer(); if (hasChunks == false) { //if no chunks, it is safe to assume there is no text content //because we are storing extracted text in chunks only //and the non-chunk stores meta-data only - String name = content.getName(); - String msg = null; - if (content instanceof AbstractFile) { - //we know it's AbstractFile, but do quick check to make sure if we index other objects in future - boolean isKnown = TskData.FileKnown.KNOWN.equals(((AbstractFile) content).getKnown()); - if (isKnown && KeywordSearchSettings.getSkipKnown()) { - msg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.knownFileMsg", name); - } - } - if (msg == null) { - msg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.noTxtYetMsg", name); - } - String htmlMsg = NbBundle.getMessage(this.getClass(), "ExtractedContentViewer.getSolrContent.txtBodyItal", msg); + String msg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "file"); + String htmlMsg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.txtBodyItal", msg); return htmlMsg; } @@ -262,33 +250,33 @@ class RawText implements IndexedText { } //not cached - try { - String indexedText = solrServer.getSolrContent(this.objectId, chunkId); - if (indexedText == null) indexedText = ""; - cachedString = EscapeUtil.escapeHtml(indexedText).trim(); - StringBuilder sb = new StringBuilder(cachedString.length() + 20); - sb.append("
").append(cachedString).append("
"); //NON-NLS - cachedString = sb.toString(); - cachedChunk = chunkId; - } catch (NoOpenCoreException ex) { - logger.log(Level.SEVERE, "No open core", ex); //NON-NLS - return ""; - } + String indexedText = solrServer.getSolrContent(this.objectId, chunkId); + if (indexedText == null) indexedText = ""; + cachedString = EscapeUtil.escapeHtml(indexedText).trim(); + StringBuilder sb = new StringBuilder(cachedString.length() + 20); + sb.append("
").append(cachedString).append("
"); //NON-NLS + cachedString = sb.toString(); + cachedChunk = chunkId; + return cachedString; } - private String getArtifactText() throws SolrServerException{ - try { - String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); - if (indexedText == null) indexedText = ""; - indexedText = EscapeUtil.escapeHtml(indexedText).trim(); - StringBuilder sb = new StringBuilder(indexedText.length() + 20); - sb.append("
").append(indexedText).append("
"); //NON-NLS - return sb.toString(); - } catch (NoOpenCoreException ex) { - logger.log(Level.SEVERE, "No open core", ex); //NON-NLS - return ""; - } + /** + * Get extracted artifact for a node from Solr + * + * @return the extracted text + * + * @throws NoOpenCoreException If no Solr core is available. + * @throws SolrServerException If there's a Solr communication or parsing issue. + */ + private String getArtifactText() throws NoOpenCoreException, SolrServerException{ + String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); + if (indexedText == null) indexedText = ""; + indexedText = EscapeUtil.escapeHtml(indexedText).trim(); + StringBuilder sb = new StringBuilder(indexedText.length() + 20); + sb.append("
").append(indexedText).append("
"); //NON-NLS + + return sb.toString(); } } From 3c59ea12e99914357793470f920eef930dbb5f5b Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Wed, 17 Jan 2018 10:17:08 -0500 Subject: [PATCH 02/10] Cleanup --- .../autopsy/keywordsearch/AccountsText.java | 1 - .../keywordsearch/ExtractedContentViewer.java | 16 ++++++++-------- .../autopsy/keywordsearch/HighlightedText.java | 3 +-- .../sleuthkit/autopsy/keywordsearch/RawText.java | 1 - 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java index 812a16bbbf..995a267758 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java @@ -35,7 +35,6 @@ import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrRequest.METHOD; import org.apache.solr.client.solrj.response.QueryResponse; import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.datamodel.BlackboardArtifact; diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java index 27c5ae6b72..c8383f2e4c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -56,7 +56,7 @@ import org.sleuthkit.datamodel.TskCoreException; @ServiceProvider(service = DataContentViewer.class, position = 4) public class ExtractedContentViewer implements DataContentViewer { - private static final Logger logger = Logger.getLogger(ExtractedContentViewer.class.getName()); + private static final Logger LOGGER = Logger.getLogger(ExtractedContentViewer.class.getName()); private static final long INVALID_DOCUMENT_ID = 0L; private static final BlackboardAttribute.Type TSK_ASSOCIATED_ARTIFACT_TYPE = new BlackboardAttribute.Type(TSK_ASSOCIATED_ARTIFACT); @@ -124,7 +124,7 @@ public class ExtractedContentViewer implements DataContentViewer { // if the artifact is an account artifact, get an account text . highlightedHitText = getAccountsText(content, nodeLookup); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Failed to create AccountsText for " + content, ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Failed to create AccountsText for " + content, ex); //NON-NLS } } else if (artifact != null @@ -133,7 +133,7 @@ public class ExtractedContentViewer implements DataContentViewer { //if there is kwh artifact use that to construct the HighlightedText highlightedHitText = new HighlightedText(artifact); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Failed to create HighlightedText for " + artifact, ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Failed to create HighlightedText for " + artifact, ex); //NON-NLS } } @@ -157,7 +157,7 @@ public class ExtractedContentViewer implements DataContentViewer { try { rawArtifactText = getRawArtifactText(nodeLookup); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error creating RawText for " + content, ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Error creating RawText for " + content, ex); //NON-NLS } if (rawArtifactText != null) { @@ -294,7 +294,7 @@ public class ExtractedContentViewer implements DataContentViewer { return true; } } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error getting TSK_ACCOUNT_TYPE attribute from artifact " + art.getArtifactID(), ex); + LOGGER.log(Level.SEVERE, "Error getting TSK_ACCOUNT_TYPE attribute from artifact " + art.getArtifactID(), ex); } } else if (artifactTypeID == TSK_KEYWORD_HIT.getTypeID()) { return true; @@ -358,7 +358,7 @@ public class ExtractedContentViewer implements DataContentViewer { try { return solrServer.queryIsIndexed(objectId); } catch (NoOpenCoreException | KeywordSearchModuleException ex) { - logger.log(Level.SEVERE, "Error querying Solr server", ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Error querying Solr server", ex); //NON-NLS return false; } } @@ -392,7 +392,7 @@ public class ExtractedContentViewer implements DataContentViewer { return blackboardAttribute.getValueLong(); } } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error getting associated artifact attributes", ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Error getting associated artifact attributes", ex); //NON-NLS } } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java index 06f79de439..61dfcfcdc8 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java @@ -40,7 +40,6 @@ import org.apache.solr.client.solrj.SolrRequest.METHOD; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocumentList; import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.autopsy.keywordsearch.KeywordQueryFilter.FilterType; @@ -468,7 +467,7 @@ class HighlightedText implements IndexedText { */ static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection keywords) { if (solrDocumentList.isEmpty()) { - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "document"); // DLG: + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "document"); } // It doesn't make sense for there to be more than a single document in diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index 25a32401ef..1f721f004c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.keywordsearch; import java.util.logging.Level; import org.apache.solr.client.solrj.SolrServerException; import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; From 4cdf2b919efaed651f2c9f69917f71271cd60a4d Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Wed, 17 Jan 2018 10:21:53 -0500 Subject: [PATCH 03/10] Fixed log level. --- .../src/org/sleuthkit/autopsy/keywordsearch/RawText.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index 1f721f004c..5d885feef3 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -204,11 +204,8 @@ class RawText implements IndexedText { } else { hasChunks = true; } - } catch (KeywordSearchModuleException ex) { - LOGGER.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS - - } catch (NoOpenCoreException ex) { - LOGGER.log(Level.WARNING, "Could not get number of chunks: ", ex); //NON-NLS + } catch (KeywordSearchModuleException | NoOpenCoreException ex) { + LOGGER.log(Level.SEVERE, "Could not get number of chunks: ", ex); //NON-NLS } } From e6d269396dc46c572d928950846768d4c717075e Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Fri, 19 Jan 2018 01:07:51 -0500 Subject: [PATCH 04/10] Different message for known files. --- .../keywordsearch/ExtractedContentViewer.java | 1 + .../autopsy/keywordsearch/RawText.java | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java index c8383f2e4c..8f8ae75b8d 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java @@ -50,6 +50,7 @@ import org.sleuthkit.datamodel.TskCoreException; */ @Messages({ "ExtractedContentViewer.getText.error.msg=Error getting text.", + "ExtractedContentViewer.getSolrContent.knownFileMsg=

{0} is a known file (based on MD5 hash) and does not have text in the index.

", "ExtractedContentViewer.getSolrContent.noTxtYetMsg=

There is currently no text in the index for this {0}. It may have no text, it may not have been analyzed yet, there may have been an error extracting text, or keyword search was not enabled during ingest.

", "ExtractedContentViewer.getSolrContent.txtBodyItal={0}" }) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index 5d885feef3..dc281ce100 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -23,8 +23,10 @@ import org.apache.solr.client.solrj.SolrServerException; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.TskData; /** * A "source" for the extracted content viewer that displays "raw" (not @@ -231,7 +233,18 @@ class RawText implements IndexedText { //if no chunks, it is safe to assume there is no text content //because we are storing extracted text in chunks only //and the non-chunk stores meta-data only - String msg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "file"); + String msg = null; + + if (content instanceof AbstractFile) { + //we know it's AbstractFile, but do quick check to make sure if we index other objects in future + boolean isKnown = TskData.FileKnown.KNOWN.equals(((AbstractFile)content).getKnown()); + if (isKnown && KeywordSearchSettings.getSkipKnown()) { + msg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.knownFileMsg", content.getName()); + } + } + if(msg == null) { + msg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "file"); + } String htmlMsg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.txtBodyItal", msg); return htmlMsg; } @@ -247,7 +260,10 @@ class RawText implements IndexedText { //not cached String indexedText = solrServer.getSolrContent(this.objectId, chunkId); - if (indexedText == null) indexedText = ""; + if (indexedText == null || indexedText.isEmpty()) { + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "file"); + } + cachedString = EscapeUtil.escapeHtml(indexedText).trim(); StringBuilder sb = new StringBuilder(cachedString.length() + 20); sb.append("
").append(cachedString).append("
"); //NON-NLS @@ -267,7 +283,10 @@ class RawText implements IndexedText { */ private String getArtifactText() throws NoOpenCoreException, SolrServerException{ String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); - if (indexedText == null) indexedText = ""; + if (indexedText == null || indexedText.isEmpty()) { + return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "artifact"); + } + indexedText = EscapeUtil.escapeHtml(indexedText).trim(); StringBuilder sb = new StringBuilder(indexedText.length() + 20); sb.append("
").append(indexedText).append("
"); //NON-NLS From fc63d677402da5598a4548fa56576468fa9177ae Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Mon, 29 Jan 2018 12:15:39 -0500 Subject: [PATCH 05/10] Moved interesting file artifact creation logic. --- .../modules/filetypeid/FileTypeDetector.java | 53 +++--------- .../filetypeid/FileTypeIdIngestModule.java | 83 ++++++++++++++++--- 2 files changed, 85 insertions(+), 51 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java index c742110f6b..dafae9a42b 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,22 +19,16 @@ package org.sleuthkit.autopsy.modules.filetypeid; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; -import java.util.logging.Level; import java.util.stream.Collectors; import org.apache.tika.Tika; import org.apache.tika.io.TikaInputStream; import org.apache.tika.mime.MimeTypes; -import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; @@ -48,8 +42,8 @@ import org.sleuthkit.datamodel.TskData; */ public class FileTypeDetector { - private static final Logger logger = Logger.getLogger(FileTypeDetector.class.getName()); - private static final Tika tika = new Tika(); + private static final Logger LOGGER = Logger.getLogger(FileTypeDetector.class.getName()); + private static final Tika TIKA = new Tika(); private static final int SLACK_FILE_THRESHOLD = 4096; private final List userDefinedFileTypes; private final List autopsyDefinedFileTypes; @@ -227,7 +221,7 @@ public class FileTypeDetector { ReadContentInputStream stream = new ReadContentInputStream(file); try (TikaInputStream tikaInputStream = TikaInputStream.get(stream)) { - String tikaType = tika.detect(tikaInputStream, file.getName()); + String tikaType = TIKA.detect(tikaInputStream, file.getName()); /* * Remove the Tika suffix from the MIME type name. @@ -270,52 +264,29 @@ public class FileTypeDetector { } /** - * Determines whether or not the a file matches a user-defined custom file - * type. If the file matches and corresponds to an interesting files type - * rule, this method has the side effect of creating an interesting files - * hit artifact and indexing that artifact for keyword search. + * Determines whether or not a file matches a user-defined custom file type. * * @param file The file to test. * - * @return The file type name string or null, if no match is detected. - * - * @throws TskCoreException + * @return The MIME type as a string if a match is found; otherwise null. */ private String detectUserDefinedType(AbstractFile file) { + String retValue = null; + for (FileType fileType : userDefinedFileTypes) { if (fileType.matches(file)) { - if (fileType.createInterestingFileHit()) { - try { - BlackboardArtifact artifact; - artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT); - Collection attributes = new ArrayList<>(); - BlackboardAttribute setNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, FileTypeIdModuleFactory.getModuleName(), fileType.getInterestingFilesSetName()); - attributes.add(setNameAttribute); - BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, FileTypeIdModuleFactory.getModuleName(), fileType.getMimeType()); - attributes.add(ruleNameAttribute); - artifact.addAttributes(attributes); - try { - Case.getCurrentCase().getServices().getBlackboard().indexArtifact(artifact); - } catch (Blackboard.BlackboardException ex) { - logger.log(Level.SEVERE, String.format("Unable to index TSK_INTERESTING_FILE_HIT blackboard artifact %d (file obj_id=%d)", artifact.getArtifactID(), file.getId()), ex); //NON-NLS - } - } catch (TskCoreException ex) { - logger.log(Level.SEVERE, String.format("Unable to create TSK_INTERESTING_FILE_HIT artifact for file (obj_id=%d)", file.getId()), ex); //NON-NLS - } - } - return fileType.getMimeType(); + retValue = fileType.getMimeType(); } } - return null; + return retValue; } /** - * Determines whether or not the a file matches a custom file type defined - * by Autopsy. + * Determines whether or not a file matches a custom file type defined by Autopsy. * * @param file The file to test. * - * @return The file type name string or null, if no match is detected. + * @return The MIME type as a string if a match is found; otherwise null. */ private String detectAutopsyDefinedType(AbstractFile file) { for (FileType fileType : autopsyDefinedFileTypes) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java index 64650ed0c4..4e1843ccf3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2013-2015 Basis Technology Corp. + * + * Copyright 2013-2018 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,9 +18,14 @@ */ package org.sleuthkit.autopsy.modules.filetypeid; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.logging.Level; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.FileIngestModule; import org.sleuthkit.autopsy.ingest.IngestJobContext; @@ -29,17 +34,20 @@ import org.sleuthkit.autopsy.ingest.IngestServices; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.autopsy.ingest.IngestModule.ProcessResult; import org.sleuthkit.autopsy.ingest.IngestModuleReferenceCounter; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; /** * Detects the type of a file based on signature (magic) values. Posts results * to the blackboard. */ @NbBundle.Messages({ - "CannotRunFileTypeDetection=Unable to run file type detection." + "CannotRunFileTypeDetection=Unable to run file type detection." }) public class FileTypeIdIngestModule implements FileIngestModule { - private static final Logger logger = Logger.getLogger(FileTypeIdIngestModule.class.getName()); + private static final Logger LOGGER = Logger.getLogger(FileTypeIdIngestModule.class.getName()); private long jobId; private static final HashMap totalsForIngestJobs = new HashMap<>(); private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter(); @@ -59,7 +67,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { try { return new FileTypeDetector().isDetectable(mimeType); } catch (FileTypeDetector.FileTypeDetectorInitException ex) { - logger.log(Level.SEVERE, "Failed to create file type detector", ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Failed to create file type detector", ex); //NON-NLS return false; } } @@ -91,15 +99,70 @@ public class FileTypeIdIngestModule implements FileIngestModule { */ try { long startTime = System.currentTimeMillis(); - file.setMIMEType(fileTypeDetector.detectMIMEType(file)); + String mimeType = fileTypeDetector.detectMIMEType(file); + file.setMIMEType(mimeType); + FileType fileType = detectUserDefinedFileType(file); + if (fileType != null && fileType.createInterestingFileHit()) { + createInterestingFileHit(file, fileType); + } addToTotals(jobId, (System.currentTimeMillis() - startTime)); return ProcessResult.OK; } catch (Exception e) { - logger.log(Level.WARNING, String.format("Error while attempting to determine file type of file %d", file.getId()), e); //NON-NLS + LOGGER.log(Level.WARNING, String.format("Error while attempting to determine file type of file %d", file.getId()), e); //NON-NLS return ProcessResult.ERROR; } } + /** + * Determines whether or not a file matches a user-defined custom file type. + * + * @param file The file to test. + * + * @return The file type if a match is found; otherwise null. + * + * @throws CustomFileTypesException If there is an issue getting an instance + * of CustomFileTypesManager. + */ + private FileType detectUserDefinedFileType(AbstractFile file) throws CustomFileTypesManager.CustomFileTypesException { + FileType retValue = null; + + CustomFileTypesManager customFileTypesManager = CustomFileTypesManager.getInstance(); + List fileTypesList = customFileTypesManager.getUserDefinedFileTypes(); + for (FileType fileType : fileTypesList) { + if (fileType.matches(file)) { + retValue = fileType; + } + } + + return retValue; + } + + /** + * Create an Interesting File hit using the specified file type rule. + * + * @param file The file from which to generate an artifact. + * @param fileType The file type rule for categorizing the hit. + */ + private void createInterestingFileHit(AbstractFile file, FileType fileType) { + try { + BlackboardArtifact artifact; + artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT); + Collection attributes = new ArrayList<>(); + BlackboardAttribute setNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, FileTypeIdModuleFactory.getModuleName(), fileType.getInterestingFilesSetName()); + attributes.add(setNameAttribute); + BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, FileTypeIdModuleFactory.getModuleName(), fileType.getMimeType()); + attributes.add(ruleNameAttribute); + artifact.addAttributes(attributes); + try { + Case.getCurrentCase().getServices().getBlackboard().indexArtifact(artifact); + } catch (Blackboard.BlackboardException ex) { + LOGGER.log(Level.SEVERE, String.format("Unable to index TSK_INTERESTING_FILE_HIT blackboard artifact %d (file obj_id=%d)", artifact.getArtifactID(), file.getId()), ex); //NON-NLS + } + } catch (TskCoreException ex) { + LOGGER.log(Level.SEVERE, String.format("Unable to create TSK_INTERESTING_FILE_HIT artifact for file (obj_id=%d)", file.getId()), ex); //NON-NLS + } + } + @Override public void shutDown() { /** From 9c9d85a5029fa04cee893a130337dee66f386dc6 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Mon, 29 Jan 2018 12:21:45 -0500 Subject: [PATCH 06/10] Minor tweaks. --- .../modules/filetypeid/FileTypeDetector.java | 1 + .../filetypeid/FileTypeIdIngestModule.java | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java index dafae9a42b..21f16941ab 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java @@ -276,6 +276,7 @@ public class FileTypeDetector { for (FileType fileType : userDefinedFileTypes) { if (fileType.matches(file)) { retValue = fileType.getMimeType(); + break; } } return retValue; diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java index 4e1843ccf3..13c68cd53f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java @@ -49,8 +49,8 @@ public class FileTypeIdIngestModule implements FileIngestModule { private static final Logger LOGGER = Logger.getLogger(FileTypeIdIngestModule.class.getName()); private long jobId; - private static final HashMap totalsForIngestJobs = new HashMap<>(); - private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter(); + private static final HashMap INGEST_JOB_TOTALS = new HashMap<>(); + private static final IngestModuleReferenceCounter REF_COUNTER = new IngestModuleReferenceCounter(); private FileTypeDetector fileTypeDetector; /** @@ -82,7 +82,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { @Override public void startUp(IngestJobContext context) throws IngestModuleException { jobId = context.getJobId(); - refCounter.incrementAndGet(jobId); + REF_COUNTER.incrementAndGet(jobId); try { fileTypeDetector = new FileTypeDetector(); } catch (FileTypeDetector.FileTypeDetectorInitException ex) { @@ -131,6 +131,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { for (FileType fileType : fileTypesList) { if (fileType.matches(file)) { retValue = fileType; + break; } } @@ -169,10 +170,10 @@ public class FileTypeIdIngestModule implements FileIngestModule { * If this is the instance of this module for this ingest job, post a * summary message to the ingest messages box. */ - if (refCounter.decrementAndGet(jobId) == 0) { + if (REF_COUNTER.decrementAndGet(jobId) == 0) { IngestJobTotals jobTotals; synchronized (this) { - jobTotals = totalsForIngestJobs.remove(jobId); + jobTotals = INGEST_JOB_TOTALS.remove(jobId); } if (jobTotals != null) { StringBuilder detailsSb = new StringBuilder(); @@ -201,15 +202,15 @@ public class FileTypeIdIngestModule implements FileIngestModule { * @param matchTimeInc Amount of time to add. */ private static synchronized void addToTotals(long jobId, long matchTimeInc) { - IngestJobTotals ingestJobTotals = totalsForIngestJobs.get(jobId); + IngestJobTotals ingestJobTotals = INGEST_JOB_TOTALS.get(jobId); if (ingestJobTotals == null) { ingestJobTotals = new IngestJobTotals(); - totalsForIngestJobs.put(jobId, ingestJobTotals); + INGEST_JOB_TOTALS.put(jobId, ingestJobTotals); } ingestJobTotals.matchTime += matchTimeInc; ingestJobTotals.numFiles++; - totalsForIngestJobs.put(jobId, ingestJobTotals); + INGEST_JOB_TOTALS.put(jobId, ingestJobTotals); } private static class IngestJobTotals { From 144360a886506d0dfff6aef26f610cce0c0a06ef Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Tue, 6 Feb 2018 22:42:49 -0500 Subject: [PATCH 07/10] Revisions. --- .../autopsy/keywordsearch/AccountsText.java | 6 +++--- .../keywordsearch/ExtractedContentPanel.java | 12 ++++++------ .../keywordsearch/ExtractedContentViewer.java | 14 +++++++------- .../autopsy/keywordsearch/HighlightedText.java | 12 ++++++------ .../sleuthkit/autopsy/keywordsearch/RawText.java | 16 ++++++++-------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java index 995a267758..4796730565 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java @@ -52,7 +52,7 @@ import org.sleuthkit.datamodel.TskCoreException; */ class AccountsText implements IndexedText { - private static final Logger LOGGER = Logger.getLogger(AccountsText.class.getName()); + private static final Logger logger = Logger.getLogger(AccountsText.class.getName()); private static final boolean DEBUG = (Version.getBuildType() == Version.Type.DEVELOPMENT); private static final String CCN_REGEX = "(%?)(B?)([0-9][ \\-]*?){12,19}(\\^?)"; @@ -311,8 +311,8 @@ class AccountsText implements IndexedText { // extracted content (minus highlight tags) is HTML-escaped return "
" + highlightedText + "
"; //NON-NLS } catch (Exception ex) { - LOGGER.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + this.solrObjectId + ", chunkID " + this.currentPage, ex); //NON-NLS - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getText.error.msg"); + logger.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + this.solrObjectId + ", chunkID " + this.currentPage, ex); //NON-NLS + return Bundle.ExtractedContentViewer_getText_error_msg(); } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java index fd8966e254..d6a81371b2 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-17 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,7 @@ import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import javax.swing.JTextPane; @@ -648,7 +649,8 @@ class ExtractedContentPanel extends javax.swing.JPanel { } @NbBundle.Messages({ - "ExtractedContentPanel.SetMarkup.error.msg=Error getting text."}) + "ExtractedContentPanel.getText.error=Error getting text." + }) @Override protected void done() { super.done(); @@ -663,11 +665,9 @@ class ExtractedContentPanel extends javax.swing.JPanel { setPanelText("", false); } - } catch (InterruptedException | ExecutionException ex) { + } catch (InterruptedException | CancellationException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); //NON-NLS - setPanelText(NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentPanel.getText.error.msg"), true); - } // catch and ignore if we were cancelled - catch (java.util.concurrent.CancellationException ex) { + setPanelText(Bundle.ExtractedContentPanel_getText_error(), true); } updateControls(source); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java index 8f8ae75b8d..624e8c497c 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java @@ -57,7 +57,7 @@ import org.sleuthkit.datamodel.TskCoreException; @ServiceProvider(service = DataContentViewer.class, position = 4) public class ExtractedContentViewer implements DataContentViewer { - private static final Logger LOGGER = Logger.getLogger(ExtractedContentViewer.class.getName()); + private static final Logger logger = Logger.getLogger(ExtractedContentViewer.class.getName()); private static final long INVALID_DOCUMENT_ID = 0L; private static final BlackboardAttribute.Type TSK_ASSOCIATED_ARTIFACT_TYPE = new BlackboardAttribute.Type(TSK_ASSOCIATED_ARTIFACT); @@ -125,7 +125,7 @@ public class ExtractedContentViewer implements DataContentViewer { // if the artifact is an account artifact, get an account text . highlightedHitText = getAccountsText(content, nodeLookup); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Failed to create AccountsText for " + content, ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to create AccountsText for " + content, ex); //NON-NLS } } else if (artifact != null @@ -134,7 +134,7 @@ public class ExtractedContentViewer implements DataContentViewer { //if there is kwh artifact use that to construct the HighlightedText highlightedHitText = new HighlightedText(artifact); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Failed to create HighlightedText for " + artifact, ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to create HighlightedText for " + artifact, ex); //NON-NLS } } @@ -158,7 +158,7 @@ public class ExtractedContentViewer implements DataContentViewer { try { rawArtifactText = getRawArtifactText(nodeLookup); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Error creating RawText for " + content, ex); //NON-NLS + logger.log(Level.SEVERE, "Error creating RawText for " + content, ex); //NON-NLS } if (rawArtifactText != null) { @@ -295,7 +295,7 @@ public class ExtractedContentViewer implements DataContentViewer { return true; } } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Error getting TSK_ACCOUNT_TYPE attribute from artifact " + art.getArtifactID(), ex); + logger.log(Level.SEVERE, "Error getting TSK_ACCOUNT_TYPE attribute from artifact " + art.getArtifactID(), ex); } } else if (artifactTypeID == TSK_KEYWORD_HIT.getTypeID()) { return true; @@ -359,7 +359,7 @@ public class ExtractedContentViewer implements DataContentViewer { try { return solrServer.queryIsIndexed(objectId); } catch (NoOpenCoreException | KeywordSearchModuleException ex) { - LOGGER.log(Level.SEVERE, "Error querying Solr server", ex); //NON-NLS + logger.log(Level.SEVERE, "Error querying Solr server", ex); //NON-NLS return false; } } @@ -393,7 +393,7 @@ public class ExtractedContentViewer implements DataContentViewer { return blackboardAttribute.getValueLong(); } } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Error getting associated artifact attributes", ex); //NON-NLS + logger.log(Level.SEVERE, "Error getting associated artifact attributes", ex); //NON-NLS } } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java index 61dfcfcdc8..030519b3da 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java @@ -53,7 +53,7 @@ import org.sleuthkit.datamodel.TskCoreException; */ class HighlightedText implements IndexedText { - private static final Logger LOGGER = Logger.getLogger(HighlightedText.class.getName()); + private static final Logger logger = Logger.getLogger(HighlightedText.class.getName()); private static final boolean DEBUG = (Version.getBuildType() == Version.Type.DEVELOPMENT); @@ -397,7 +397,7 @@ class HighlightedText implements IndexedText { // either be a single chunk containing hits or we narrow our // query down to the current page/chunk. if (response.getResults().size() > 1) { - LOGGER.log(Level.WARNING, "Unexpected number of results for Solr highlighting query: {0}", q); //NON-NLS + logger.log(Level.WARNING, "Unexpected number of results for Solr highlighting query: {0}", q); //NON-NLS } String highlightedContent; Map>> responseHighlight = response.getHighlighting(); @@ -423,14 +423,14 @@ class HighlightedText implements IndexedText { return "
" + highlightedContent + "
"; //NON-NLS } catch (TskCoreException | KeywordSearchModuleException | NoOpenCoreException ex) { - LOGGER.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + objectId + ", chunkID " + chunkID + ", highlight query: " + highlightField, ex); //NON-NLS - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getText.error.msg"); + logger.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + objectId + ", chunkID " + chunkID + ", highlight query: " + highlightField, ex); //NON-NLS + return Bundle.ExtractedContentViewer_getText_error(); } } @Override public String toString() { - return NbBundle.getMessage(this.getClass(), "HighlightedMatchesSource.toString"); + return Bundle.HighlightedMatchesSource_toString(); } @Override @@ -467,7 +467,7 @@ class HighlightedText implements IndexedText { */ static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection keywords) { if (solrDocumentList.isEmpty()) { - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "document"); + return Bundle.ExtractedContentViewer_getSolrContent_noTxtYetMsg("document"); } // It doesn't make sense for there to be more than a single document in diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index dc281ce100..af1d6bc01f 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -43,7 +43,7 @@ class RawText implements IndexedText { //keep last content cached private String cachedString; private int cachedChunk; - private static final Logger LOGGER = Logger.getLogger(RawText.class.getName()); + private static final Logger logger = Logger.getLogger(RawText.class.getName()); /** * Construct a new RawText object for the given content and object id. This @@ -153,9 +153,9 @@ class RawText implements IndexedText { return getArtifactText(); } } catch (SolrServerException | NoOpenCoreException ex) { - LOGGER.log(Level.SEVERE, "Couldn't get extracted text", ex); //NON-NLS + logger.log(Level.SEVERE, "Couldn't get extracted text", ex); //NON-NLS } - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewerRawText.getText.error.msg"); + return Bundle.ExtractedContentViewer_getText_error_msg(); } @NbBundle.Messages({ @@ -207,7 +207,7 @@ class RawText implements IndexedText { hasChunks = true; } } catch (KeywordSearchModuleException | NoOpenCoreException ex) { - LOGGER.log(Level.SEVERE, "Could not get number of chunks: ", ex); //NON-NLS + logger.log(Level.SEVERE, "Could not get number of chunks: ", ex); //NON-NLS } } @@ -239,13 +239,13 @@ class RawText implements IndexedText { //we know it's AbstractFile, but do quick check to make sure if we index other objects in future boolean isKnown = TskData.FileKnown.KNOWN.equals(((AbstractFile)content).getKnown()); if (isKnown && KeywordSearchSettings.getSkipKnown()) { - msg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.knownFileMsg", content.getName()); + msg = Bundle.ExtractedContentViewer_getSolrContent_knownFileMsg(content.getName()); } } if(msg == null) { - msg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "file"); + msg = Bundle.ExtractedContentViewer_getSolrContent_noTxtYetMsg("file"); } - String htmlMsg = NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.txtBodyItal", msg); + String htmlMsg = Bundle.ExtractedContentViewer_getSolrContent_txtBodyItal(msg); return htmlMsg; } @@ -284,7 +284,7 @@ class RawText implements IndexedText { private String getArtifactText() throws NoOpenCoreException, SolrServerException{ String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); if (indexedText == null || indexedText.isEmpty()) { - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "artifact"); + return Bundle.ExtractedContentViewer_getSolrContent_noTxtYetMsg("artifact"); } indexedText = EscapeUtil.escapeHtml(indexedText).trim(); From a7a2c86ab3758d3dab826510bf0d96707294632e Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Wed, 7 Feb 2018 01:31:04 -0500 Subject: [PATCH 08/10] Revisions. --- .../autopsy/keywordsearch/AccountsText.java | 2 +- .../keywordsearch/Bundle_ja.properties | 1 - .../keywordsearch/ExtractedContentViewer.java | 7 --- .../keywordsearch/HighlightedText.java | 25 +++++----- .../autopsy/keywordsearch/IndexedText.java | 10 +++- .../autopsy/keywordsearch/RawText.java | 49 +++++++++++-------- 6 files changed, 51 insertions(+), 43 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java index 4796730565..00d5670151 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/AccountsText.java @@ -312,7 +312,7 @@ class AccountsText implements IndexedText { return "
" + highlightedText + "
"; //NON-NLS } catch (Exception ex) { logger.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + this.solrObjectId + ", chunkID " + this.currentPage, ex); //NON-NLS - return Bundle.ExtractedContentViewer_getText_error_msg(); + return Bundle.IndexedText_errorMessage_errorGettingText(); } } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties index dbaae76b16..2442e5bbc4 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle_ja.properties @@ -199,7 +199,6 @@ KeywordSearchIngestModule.doInBackGround.finalizeMsg=- \u6700\u7d42\u51e6\u7406\ KeywordSearchIngestModule.doInBackGround.pendingMsg=\uff08\u30da\u30f3\u30c7\u30a3\u30f3\u30b0\uff09 SearchRunner.doInBackGround.cancelMsg=\uff08\u30ad\u30e3\u30f3\u30bb\u30eb\u4e2d\u2026\uff09 Server.addDoc.exception.msg2=\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u30cf\u30f3\u30c9\u30e9\u30fc\u3092\u4f7f\u7528\u3057\u307e\u3057\u305f\u304c\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u6b21\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff1a{0} -ExtractedContentViewer.getSolrContent.txtBodyItal={0} KeywordSearchJobSettingsPanel.keywordSearchEncodings.text=- KeywordSearchJobSettingsPanel.languagesValLabel.text=- KeywordSearchJobSettingsPanel.encodingsLabel.text=\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\uff1a diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java index 624e8c497c..b13e1fbca4 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentViewer.java @@ -29,7 +29,6 @@ import java.util.logging.Level; import org.openide.nodes.Node; import org.openide.util.Lookup; import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer; @@ -48,12 +47,6 @@ import org.sleuthkit.datamodel.TskCoreException; * A content viewer that displays the indexed text associated with a file or an * artifact, possibly marked up with HTML to highlight keyword hits. */ -@Messages({ - "ExtractedContentViewer.getText.error.msg=Error getting text.", - "ExtractedContentViewer.getSolrContent.knownFileMsg=

{0} is a known file (based on MD5 hash) and does not have text in the index.

", - "ExtractedContentViewer.getSolrContent.noTxtYetMsg=

There is currently no text in the index for this {0}. It may have no text, it may not have been analyzed yet, there may have been an error extracting text, or keyword search was not enabled during ingest.

", - "ExtractedContentViewer.getSolrContent.txtBodyItal={0}" -}) @ServiceProvider(service = DataContentViewer.class, position = 4) public class ExtractedContentViewer implements DataContentViewer { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java index 030519b3da..14298a044a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/HighlightedText.java @@ -102,13 +102,13 @@ class HighlightedText implements IndexedText { /** * This constructor is used when keyword hits are accessed from the ad-hoc * search results. In that case we have the entire QueryResults object and - need to arrange the paging. + * need to arrange the paging. * * @param objectId The objectID of the content whose text will be * highlighted. * @param QueryResults The QueryResults for the ad-hoc search from whose - results a selection was made leading to this - HighlightedText. + * results a selection was made leading to this + * HighlightedText. */ HighlightedText(long objectId, QueryResults hits) { this.objectId = objectId; @@ -203,10 +203,10 @@ class HighlightedText implements IndexedText { isLiteral = hits.getQuery().isLiteral(); /** - * Organize the hits by page, filter as needed. - * We process *every* keyword here because in the case of a regular - * expression search there may be multiple different keyword - * hits located in different chunks for the same file/artifact. + * Organize the hits by page, filter as needed. We process *every* + * keyword here because in the case of a regular expression search there + * may be multiple different keyword hits located in different chunks + * for the same file/artifact. */ for (Keyword k : hits.getKeywords()) { for (KeywordHit hit : hits.getResults(k)) { @@ -424,13 +424,13 @@ class HighlightedText implements IndexedText { return "
" + highlightedContent + "
"; //NON-NLS } catch (TskCoreException | KeywordSearchModuleException | NoOpenCoreException ex) { logger.log(Level.SEVERE, "Error getting highlighted text for Solr doc id " + objectId + ", chunkID " + chunkID + ", highlight query: " + highlightField, ex); //NON-NLS - return Bundle.ExtractedContentViewer_getText_error(); + return Bundle.IndexedText_errorMessage_errorGettingText(); } } @Override public String toString() { - return Bundle.HighlightedMatchesSource_toString(); + return NbBundle.getMessage(this.getClass(), "HighlightedMatchesSource.toString"); } @Override @@ -462,12 +462,13 @@ class HighlightedText implements IndexedText { * to a Solr query. We expect there to only ever be * a single document. * - * @return Either a string with the keyword highlighted via HTML span tags or a string - * indicating that we did not find a hit in the document. + * @return Either a string with the keyword highlighted via HTML span tags + * or a string indicating that we did not find a hit in the + * document. */ static String attemptManualHighlighting(SolrDocumentList solrDocumentList, String highlightField, Collection keywords) { if (solrDocumentList.isEmpty()) { - return Bundle.ExtractedContentViewer_getSolrContent_noTxtYetMsg("document"); + return Bundle.IndexedText_errorMessage_errorGettingText(); } // It doesn't make sense for there to be more than a single document in diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java index 6bf6a4f3ef..9095788c6a 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,20 @@ */ package org.sleuthkit.autopsy.keywordsearch; +import org.openide.util.NbBundle; + /** * Interface to provide HTML text to display in ExtractedContentViewer. There is * a SOLR implementation of this that interfaces with SOLR to highlight the * keyword hits and a version that does not do markup so that you can simply * view the stored text. */ +@NbBundle.Messages({ + "IndexedText.errorMessage.errorGettingText=

Error retrieving indexed text.

", + "IndexedText.warningMessage.knownFile=

This file is a known file (based on MD5 hash) and does not have indexed text.

", + "IndexedText.warningMessage.noTextAvailable=

No indexed text for this file.

", + "IndexedText.htmlStyle.textBodyItalics={0}" +}) interface IndexedText { /** diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index af1d6bc01f..c7c263ce48 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -155,7 +155,7 @@ class RawText implements IndexedText { } catch (SolrServerException | NoOpenCoreException ex) { logger.log(Level.SEVERE, "Couldn't get extracted text", ex); //NON-NLS } - return Bundle.ExtractedContentViewer_getText_error_msg(); + return Bundle.IndexedText_errorMessage_errorGettingText(); } @NbBundle.Messages({ @@ -185,7 +185,6 @@ class RawText implements IndexedText { return 0; } - @Override public int getNumberPages() { return numPages; @@ -224,7 +223,8 @@ class RawText implements IndexedText { * @return the extracted text * * @throws NoOpenCoreException If no Solr core is available. - * @throws SolrServerException If there's a Solr communication or parsing issue. + * @throws SolrServerException If there's a Solr communication or parsing + * issue. */ private String getContentText(int currentPage, boolean hasChunks) throws NoOpenCoreException, SolrServerException { final Server solrServer = KeywordSearch.getServer(); @@ -234,18 +234,18 @@ class RawText implements IndexedText { //because we are storing extracted text in chunks only //and the non-chunk stores meta-data only String msg = null; - + if (content instanceof AbstractFile) { //we know it's AbstractFile, but do quick check to make sure if we index other objects in future - boolean isKnown = TskData.FileKnown.KNOWN.equals(((AbstractFile)content).getKnown()); + boolean isKnown = TskData.FileKnown.KNOWN.equals(((AbstractFile) content).getKnown()); if (isKnown && KeywordSearchSettings.getSkipKnown()) { - msg = Bundle.ExtractedContentViewer_getSolrContent_knownFileMsg(content.getName()); + msg = Bundle.IndexedText_warningMessage_knownFile(); } } - if(msg == null) { - msg = Bundle.ExtractedContentViewer_getSolrContent_noTxtYetMsg("file"); + if (msg == null) { + msg = Bundle.IndexedText_warningMessage_noTextAvailable(); } - String htmlMsg = Bundle.ExtractedContentViewer_getSolrContent_txtBodyItal(msg); + String htmlMsg = Bundle.IndexedText_htmlStyle_textBodyItalics(msg); return htmlMsg; } @@ -260,38 +260,45 @@ class RawText implements IndexedText { //not cached String indexedText = solrServer.getSolrContent(this.objectId, chunkId); - if (indexedText == null || indexedText.isEmpty()) { - return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "file"); + if (indexedText == null) { + if (content instanceof AbstractFile) { + return Bundle.IndexedText_errorMessage_errorGettingText(); + } else { + return Bundle.IndexedText_warningMessage_noTextAvailable(); + } + } else if (indexedText.isEmpty()) { + return Bundle.IndexedText_warningMessage_noTextAvailable(); } - + cachedString = EscapeUtil.escapeHtml(indexedText).trim(); StringBuilder sb = new StringBuilder(cachedString.length() + 20); sb.append("
").append(cachedString).append("
"); //NON-NLS cachedString = sb.toString(); cachedChunk = chunkId; - + return cachedString; } - + /** * Get extracted artifact for a node from Solr * * @return the extracted text - * + * * @throws NoOpenCoreException If no Solr core is available. - * @throws SolrServerException If there's a Solr communication or parsing issue. + * @throws SolrServerException If there's a Solr communication or parsing + * issue. */ - private String getArtifactText() throws NoOpenCoreException, SolrServerException{ + private String getArtifactText() throws NoOpenCoreException, SolrServerException { String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); if (indexedText == null || indexedText.isEmpty()) { - return Bundle.ExtractedContentViewer_getSolrContent_noTxtYetMsg("artifact"); + return Bundle.IndexedText_errorMessage_errorGettingText(); } - + indexedText = EscapeUtil.escapeHtml(indexedText).trim(); StringBuilder sb = new StringBuilder(indexedText.length() + 20); sb.append("
").append(indexedText).append("
"); //NON-NLS - + return sb.toString(); } - + } From bb0a7c26c7cc5c9538417512f5ca06e51b9ba56e Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Wed, 7 Feb 2018 11:41:44 -0500 Subject: [PATCH 09/10] Revisions. --- .../autopsy/keywordsearch/ExtractedContentPanel.java | 5 +---- .../org/sleuthkit/autopsy/keywordsearch/IndexedText.java | 7 +++---- .../src/org/sleuthkit/autopsy/keywordsearch/RawText.java | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java index d6a81371b2..bc68962693 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/ExtractedContentPanel.java @@ -648,9 +648,6 @@ class ExtractedContentPanel extends javax.swing.JPanel { return source.getText(); } - @NbBundle.Messages({ - "ExtractedContentPanel.getText.error=Error getting text." - }) @Override protected void done() { super.done(); @@ -667,7 +664,7 @@ class ExtractedContentPanel extends javax.swing.JPanel { } catch (InterruptedException | CancellationException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); //NON-NLS - setPanelText(Bundle.ExtractedContentPanel_getText_error(), true); + setPanelText(Bundle.IndexedText_errorMessage_errorGettingText(), true); } updateControls(source); diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java index 9095788c6a..17366483e3 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/IndexedText.java @@ -27,10 +27,9 @@ import org.openide.util.NbBundle; * view the stored text. */ @NbBundle.Messages({ - "IndexedText.errorMessage.errorGettingText=

Error retrieving indexed text.

", - "IndexedText.warningMessage.knownFile=

This file is a known file (based on MD5 hash) and does not have indexed text.

", - "IndexedText.warningMessage.noTextAvailable=

No indexed text for this file.

", - "IndexedText.htmlStyle.textBodyItalics={0}" + "IndexedText.errorMessage.errorGettingText=Error retrieving indexed text.", + "IndexedText.warningMessage.knownFile=This file is a known file (based on MD5 hash) and does not have indexed text.", + "IndexedText.warningMessage.noTextAvailable=No indexed text for this file." }) interface IndexedText { diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java index c7c263ce48..789de3fd50 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/RawText.java @@ -245,8 +245,7 @@ class RawText implements IndexedText { if (msg == null) { msg = Bundle.IndexedText_warningMessage_noTextAvailable(); } - String htmlMsg = Bundle.IndexedText_htmlStyle_textBodyItalics(msg); - return htmlMsg; + return msg; } int chunkId = currentPage; From dca73677b3208a76158c60a2b86229fe6e3670be Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Fri, 9 Feb 2018 23:35:34 -0500 Subject: [PATCH 10/10] Fixed merge. --- .../modules/filetypeid/FileTypeDetector.java | 12 ++++---- .../filetypeid/FileTypeIdIngestModule.java | 28 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java index f13dd8f223..795afd0838 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java @@ -42,8 +42,8 @@ import org.sleuthkit.datamodel.TskData; */ public class FileTypeDetector { - private static final Logger LOGGER = Logger.getLogger(FileTypeDetector.class.getName()); - private static final Tika TIKA = new Tika(); + private static final Logger logger = Logger.getLogger(FileTypeDetector.class.getName()); + private static final Tika tika = new Tika(); private static final int SLACK_FILE_THRESHOLD = 4096; private final List userDefinedFileTypes; private final List autopsyDefinedFileTypes; @@ -224,7 +224,7 @@ public class FileTypeDetector { ReadContentInputStream stream = new ReadContentInputStream(file); try (TikaInputStream tikaInputStream = TikaInputStream.get(stream)) { - String tikaType = TIKA.detect(tikaInputStream, file.getName()); + String tikaType = tika.detect(tikaInputStream, file.getName()); /* * Remove the Tika suffix from the MIME type name. @@ -367,7 +367,7 @@ public class FileTypeDetector { * * @throws TskCoreException if detection is required and there is a problem * writing the result to the case database. - * @deprecated Use detectMIMEType instead, and call AbstractFile.setMIMEType + * @deprecated Use getMIMEType instead, and call AbstractFile.setMIMEType * and AbstractFile.save to save the result to the file object and the * database. */ @@ -391,7 +391,7 @@ public class FileTypeDetector { * @throws TskCoreException if detection is required and there is a problem * writing the result to the case database. * - * @deprecated Use detectMIMEType instead, and call AbstractFile.setMIMEType + * @deprecated Use getMIMEType instead, and call AbstractFile.setMIMEType * and AbstractFile.save to save the result to the file object and the * database. */ @@ -413,7 +413,7 @@ public class FileTypeDetector { * were uncertain, octet-stream is returned. * * @throws TskCoreException - * @deprecated Use detectMIMEType instead. + * @deprecated Use getMIMEType instead. */ @Deprecated public String detect(AbstractFile file) throws TskCoreException { diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java index 13c68cd53f..be0bcdfbb3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeIdIngestModule.java @@ -47,10 +47,10 @@ import org.sleuthkit.datamodel.TskCoreException; }) public class FileTypeIdIngestModule implements FileIngestModule { - private static final Logger LOGGER = Logger.getLogger(FileTypeIdIngestModule.class.getName()); + private static final Logger logger = Logger.getLogger(FileTypeIdIngestModule.class.getName()); private long jobId; - private static final HashMap INGEST_JOB_TOTALS = new HashMap<>(); - private static final IngestModuleReferenceCounter REF_COUNTER = new IngestModuleReferenceCounter(); + private static final HashMap totalsForIngestJobs = new HashMap<>(); + private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter(); private FileTypeDetector fileTypeDetector; /** @@ -67,7 +67,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { try { return new FileTypeDetector().isDetectable(mimeType); } catch (FileTypeDetector.FileTypeDetectorInitException ex) { - LOGGER.log(Level.SEVERE, "Failed to create file type detector", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to create file type detector", ex); //NON-NLS return false; } } @@ -82,7 +82,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { @Override public void startUp(IngestJobContext context) throws IngestModuleException { jobId = context.getJobId(); - REF_COUNTER.incrementAndGet(jobId); + refCounter.incrementAndGet(jobId); try { fileTypeDetector = new FileTypeDetector(); } catch (FileTypeDetector.FileTypeDetectorInitException ex) { @@ -99,7 +99,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { */ try { long startTime = System.currentTimeMillis(); - String mimeType = fileTypeDetector.detectMIMEType(file); + String mimeType = fileTypeDetector.getMIMEType(file); file.setMIMEType(mimeType); FileType fileType = detectUserDefinedFileType(file); if (fileType != null && fileType.createInterestingFileHit()) { @@ -108,7 +108,7 @@ public class FileTypeIdIngestModule implements FileIngestModule { addToTotals(jobId, (System.currentTimeMillis() - startTime)); return ProcessResult.OK; } catch (Exception e) { - LOGGER.log(Level.WARNING, String.format("Error while attempting to determine file type of file %d", file.getId()), e); //NON-NLS + logger.log(Level.WARNING, String.format("Error while attempting to determine file type of file %d", file.getId()), e); //NON-NLS return ProcessResult.ERROR; } } @@ -157,10 +157,10 @@ public class FileTypeIdIngestModule implements FileIngestModule { try { Case.getCurrentCase().getServices().getBlackboard().indexArtifact(artifact); } catch (Blackboard.BlackboardException ex) { - LOGGER.log(Level.SEVERE, String.format("Unable to index TSK_INTERESTING_FILE_HIT blackboard artifact %d (file obj_id=%d)", artifact.getArtifactID(), file.getId()), ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Unable to index TSK_INTERESTING_FILE_HIT blackboard artifact %d (file obj_id=%d)", artifact.getArtifactID(), file.getId()), ex); //NON-NLS } } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, String.format("Unable to create TSK_INTERESTING_FILE_HIT artifact for file (obj_id=%d)", file.getId()), ex); //NON-NLS + logger.log(Level.SEVERE, String.format("Unable to create TSK_INTERESTING_FILE_HIT artifact for file (obj_id=%d)", file.getId()), ex); //NON-NLS } } @@ -170,10 +170,10 @@ public class FileTypeIdIngestModule implements FileIngestModule { * If this is the instance of this module for this ingest job, post a * summary message to the ingest messages box. */ - if (REF_COUNTER.decrementAndGet(jobId) == 0) { + if (refCounter.decrementAndGet(jobId) == 0) { IngestJobTotals jobTotals; synchronized (this) { - jobTotals = INGEST_JOB_TOTALS.remove(jobId); + jobTotals = totalsForIngestJobs.remove(jobId); } if (jobTotals != null) { StringBuilder detailsSb = new StringBuilder(); @@ -202,15 +202,15 @@ public class FileTypeIdIngestModule implements FileIngestModule { * @param matchTimeInc Amount of time to add. */ private static synchronized void addToTotals(long jobId, long matchTimeInc) { - IngestJobTotals ingestJobTotals = INGEST_JOB_TOTALS.get(jobId); + IngestJobTotals ingestJobTotals = totalsForIngestJobs.get(jobId); if (ingestJobTotals == null) { ingestJobTotals = new IngestJobTotals(); - INGEST_JOB_TOTALS.put(jobId, ingestJobTotals); + totalsForIngestJobs.put(jobId, ingestJobTotals); } ingestJobTotals.matchTime += matchTimeInc; ingestJobTotals.numFiles++; - INGEST_JOB_TOTALS.put(jobId, ingestJobTotals); + totalsForIngestJobs.put(jobId, ingestJobTotals); } private static class IngestJobTotals {