bookmark = new ArrayList<>();
bookmark.add(attributes.get(ATTRIBUTE_TYPE.TSK_URL.getTypeID()));
bookmark.add(attributes.get(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID()));
- bookmark.add(attributes.get(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()));
+ bookmark.add(attributes.get(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()));
bookmark.add(attributes.get(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()));
bookmark.add(getFileUniquePath(artifactData.getObjectID()));
return bookmark;
@@ -1015,7 +1015,7 @@ public class ReportGenerator {
history.add(attributes.get(ATTRIBUTE_TYPE.TSK_URL.getTypeID()));
history.add(attributes.get(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()));
history.add(attributes.get(ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID()));
- history.add(attributes.get(ATTRIBUTE_TYPE.TSK_NAME.getTypeID()));
+ history.add(attributes.get(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID()));
history.add(attributes.get(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID()));
history.add(getFileUniquePath(artifactData.getObjectID()));
return history;
diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbIngestModule.java b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbIngestModule.java
index 49e81d60bf..6cdb4764c1 100644
--- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbIngestModule.java
+++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbIngestModule.java
@@ -271,7 +271,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
detailsSb.append("");
services.postMessage(IngestMessage.createDataMessage(++messageId, this,
- "Notable: " + abstractFile.getName(),
+ "Known Bad: " + abstractFile.getName(),
detailsSb.toString(),
abstractFile.getName() + md5Hash,
badFile));
@@ -280,7 +280,6 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
} catch (TskException ex) {
logger.log(Level.WARNING, "Error creating blackboard artifact", ex);
}
-
}
private ProcessResult processFile(AbstractFile file) {
diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties
index 65dbef957c..1bfc26e95b 100644
--- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties
+++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Bundle.properties
@@ -1,91 +1,91 @@
-OpenIDE-Module-Display-Category=Ingest Module
-OpenIDE-Module-Long-Description=\
- Keyword Search ingest module.\n\n\
- The module indexes files found in the disk image at ingest time. \
- It then periodically runs the search on the indexed files using one or more keyword lists (containing pure words and/or regular expressions) and posts results.\n\n\
- The module also contains additional tools integrated in the main GUI, such as keyword list configuration, keyword seach bar in the top-right corner, extracted text viewer and search results viewer showing highlighted keywords found.
-OpenIDE-Module-Name=KeywordSearch
-ListBundleName=Keyword Lists
-ListBundleConfig=Keyword List Configuration
-IndexProgressPanel.statusText.text=Status text
-IndexProgressPanel.cancelButton.text=Cancel
-ExtractedContentPanel.hitLabel.text=Matches on page:
-ExtractedContentPanel.hitCountLabel.text=-
-ExtractedContentPanel.hitOfLabel.text=of
-ExtractedContentPanel.hitTotalLabel.text=-
-ExtractedContentPanel.hitButtonsLabel.text=Match
-ExtractedContentPanel.hitPreviousButton.text=
-ExtractedContentPanel.hitNextButton.text=
-ExtractedContentPanel.copyMenuItem.text=Copy
-ExtractedContentPanel.selectAllMenuItem.text=Select All
-KeywordSearchEditListPanel.saveListButton.text=Copy List
-KeywordSearchEditListPanel.addWordField.text=
-KeywordSearchEditListPanel.addWordButton.text=Add
-KeywordSearchEditListPanel.chRegex.text=Regular Expression
-KeywordSearchEditListPanel.deleteWordButton.text=Remove Selected
-KeywordSearchEditListPanel.cutMenuItem.text=Cut
-KeywordSearchEditListPanel.selectAllMenuItem.text=Select All
-KeywordSearchEditListPanel.pasteMenuItem.text=Paste
-KeywordSearchEditListPanel.copyMenuItem.text=Copy
-KeywordSearchEditListPanel.exportButton.text=Export List
-KeywordSearchEditListPanel.deleteListButton.text=Delete List
-KeywordSearchListsManagementPanel.newListButton.text=New List
-KeywordSearchEditListPanel.useForIngestCheckbox.text=Enable for ingest
-KeywordSearchListsManagementPanel.importButton.text=Import List
-KeywordSearchPanel.searchBox.text=Search...
-KeywordSearchPanel.regExCheckboxMenuItem.text=Use Regular Expressions
-KeywordSearchPanel.settingsLabel.text=
-KeywordSearchListsViewerPanel.searchAddButton.text=Search
-KeywordSearchListsViewerPanel.manageListsButton.text=Manage Lists
-KeywordSearchListsViewerPanel.ingestIndexLabel.text=Files Indexed:
-KeywordSearchEditListPanel.selectorsCombo.toolTipText=Regular Expression selector type (optional)
-KeywordSearchPanel.searchButton.text=
-KeywordSearchPanel.cutMenuItem.text=Cut
-KeywordSearchPanel.copyMenuItem.text=Copy
-KeywordSearchPanel.pasteMenuItem.text=Paste
-KeywordSearchPanel.selectAllMenuItem.text=Select All
-ExtractedContentPanel.pageButtonsLabel.text=Page
-ExtractedContentPanel.pageNextButton.text=
-ExtractedContentPanel.pagePreviousButton.actionCommand=pagePreviousButton
-ExtractedContentPanel.pagePreviousButton.text=
-ExtractedContentPanel.pagesLabel.text=Page:
-ExtractedContentPanel.pageOfLabel.text=of
-ExtractedContentPanel.pageCurLabel.text=-
-ExtractedContentPanel.pageTotalLabel.text=-
-ExtractedContentPanel.hitLabel.toolTipText=
-KeywordSearchEditListPanel.ingestMessagesCheckbox.text=Enable sending messages to inbox during ingest
-KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText=Send messages during triage / ingest when hits on keyword from this list occur
-KeywordSearchConfigurationPanel2.skipNSRLCheckBox.text=Do not add files in NSRL (known files) to keyword index during ingest
-KeywordSearchConfigurationPanel2.skipNSRLCheckBox.toolTipText=Requires Hash DB service to had run previously, or be selected for next ingest.
-KeywordSearchConfigurationPanel2.filesIndexedValue.text=-
-KeywordSearchConfigurationPanel2.filesIndexedLabel.text=Files in keyword index:
-KeywordSearchIngestSimplePanel.languagesLabel.text=Scripts enabled for string extraction from unknown file types:
-KeywordSearchIngestSimplePanel.languagesValLabel.text=-
-KeywordSearchIngestSimplePanel.languagesLabel.toolTipText=Scripts enabled for string extraction from unknown file types. Changes can be done in Advanced Settings.
-KeywordSearchIngestSimplePanel.languagesValLabel.toolTipText=
-KeywordSearchConfigurationPanel3.languagesLabel.text=Enabled scripts (languages):
-KeywordSearchConfigurationPanel2.chunksLabel.text=Chunks in keyword index:
-KeywordSearchConfigurationPanel2.chunksValLabel.text=-
-KeywordSearchConfigurationPanel3.enableUTF8Checkbox.text=Enable UTF8 text extraction
-KeywordSearchConfigurationPanel3.enableUTF16Checkbox.text=Enable UTF16LE and UTF16BE string extraction
-KeywordSearchEditListPanel.keywordOptionsLabel.text=Keyword Options
-KeywordSearchEditListPanel.listOptionsLabel.text=List Options
-KeywordSearchConfigurationPanel3.ingestSettingsLabel.text=Ingest settings for string extraction from unknown file types (changes effective on next ingest):
-KeywordSearchConfigurationPanel2.settingsLabel.text=Settings
-KeywordSearchConfigurationPanel2.informationLabel.text=Information
-KeywordSearchListsManagementPanel.keywordListsLabel.text=Keyword Lists:
-KeywordSearchEditListPanel.keywordsLabel.text=Keywords:
-KeywordSearchConfigurationPanel2.timeRadioButton1.toolTipText=20 mins. (fastest ingest time)
-KeywordSearchConfigurationPanel2.timeRadioButton1.text=20 minutes (slowest feedback, fastest ingest)
-KeywordSearchConfigurationPanel2.timeRadioButton2.toolTipText=10 minutes (faster overall ingest time than default)
-KeywordSearchConfigurationPanel2.timeRadioButton2.text=10 minutes (slower feedback, faster ingest)
-KeywordSearchConfigurationPanel2.timeRadioButton3.toolTipText=5 minutes (overall ingest time will be longer)
-KeywordSearchConfigurationPanel2.timeRadioButton3.text=5 minutes (default)
-KeywordSearchIngestSimplePanel.encodingsLabel.text=Encodings:
-KeywordSearchIngestSimplePanel.keywordSearchEncodings.text=-
-KeywordSearchIngestSimplePanel.titleLabel.text=Select keyword lists to enable during ingest:
-OpenIDE-Module-Short-Description=Keyword Search ingest module, extracted text viewer and keyword search tools
-KeywordSearchListsViewerPanel.manageListsButton.toolTipText=Manage keyword lists, their settings and associated keywords. The settings are shared among all cases.
-KeywordSearchConfigurationPanel2.frequencyLabel.text=Results update frequency during ingest:
-KeywordSearchConfigurationPanel2.timeRadioButton4.text_1=1 minute (faster feedback, longest ingest)
-KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText=1 minute (overall ingest time will be longest)
+OpenIDE-Module-Display-Category=Ingest Module
+OpenIDE-Module-Long-Description=\
+ Keyword Search ingest module.\n\n\
+ The module indexes files found in the disk image at ingest time. \
+ It then periodically runs the search on the indexed files using one or more keyword lists (containing pure words and/or regular expressions) and posts results.\n\n\
+ The module also contains additional tools integrated in the main GUI, such as keyword list configuration, keyword seach bar in the top-right corner, extracted text viewer and search results viewer showing highlighted keywords found.
+OpenIDE-Module-Name=KeywordSearch
+ListBundleName=Keyword Lists
+ListBundleConfig=Keyword List Configuration
+IndexProgressPanel.statusText.text=Status text
+IndexProgressPanel.cancelButton.text=Cancel
+ExtractedContentPanel.hitLabel.text=Matches on page:
+ExtractedContentPanel.hitCountLabel.text=-
+ExtractedContentPanel.hitOfLabel.text=of
+ExtractedContentPanel.hitTotalLabel.text=-
+ExtractedContentPanel.hitButtonsLabel.text=Match
+ExtractedContentPanel.hitPreviousButton.text=
+ExtractedContentPanel.hitNextButton.text=
+ExtractedContentPanel.copyMenuItem.text=Copy
+ExtractedContentPanel.selectAllMenuItem.text=Select All
+KeywordSearchEditListPanel.saveListButton.text=Copy List
+KeywordSearchEditListPanel.addWordField.text=
+KeywordSearchEditListPanel.addWordButton.text=Add
+KeywordSearchEditListPanel.chRegex.text=Regular Expression
+KeywordSearchEditListPanel.deleteWordButton.text=Remove Selected
+KeywordSearchEditListPanel.cutMenuItem.text=Cut
+KeywordSearchEditListPanel.selectAllMenuItem.text=Select All
+KeywordSearchEditListPanel.pasteMenuItem.text=Paste
+KeywordSearchEditListPanel.copyMenuItem.text=Copy
+KeywordSearchEditListPanel.exportButton.text=Export List
+KeywordSearchEditListPanel.deleteListButton.text=Delete List
+KeywordSearchListsManagementPanel.newListButton.text=New List
+KeywordSearchEditListPanel.useForIngestCheckbox.text=Use during ingest
+KeywordSearchListsManagementPanel.importButton.text=Import List
+KeywordSearchPanel.searchBox.text=Search...
+KeywordSearchPanel.regExCheckboxMenuItem.text=Use Regular Expressions
+KeywordSearchPanel.settingsLabel.text=
+KeywordSearchListsViewerPanel.searchAddButton.text=Search
+KeywordSearchListsViewerPanel.manageListsButton.text=Manage Lists
+KeywordSearchListsViewerPanel.ingestIndexLabel.text=Files Indexed:
+KeywordSearchEditListPanel.selectorsCombo.toolTipText=Regular Expression selector type (optional)
+KeywordSearchPanel.searchButton.text=
+KeywordSearchPanel.cutMenuItem.text=Cut
+KeywordSearchPanel.copyMenuItem.text=Copy
+KeywordSearchPanel.pasteMenuItem.text=Paste
+KeywordSearchPanel.selectAllMenuItem.text=Select All
+ExtractedContentPanel.pageButtonsLabel.text=Page
+ExtractedContentPanel.pageNextButton.text=
+ExtractedContentPanel.pagePreviousButton.actionCommand=pagePreviousButton
+ExtractedContentPanel.pagePreviousButton.text=
+ExtractedContentPanel.pagesLabel.text=Page:
+ExtractedContentPanel.pageOfLabel.text=of
+ExtractedContentPanel.pageCurLabel.text=-
+ExtractedContentPanel.pageTotalLabel.text=-
+ExtractedContentPanel.hitLabel.toolTipText=
+KeywordSearchEditListPanel.ingestMessagesCheckbox.text=Send messages to inbox during ingest
+KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText=Send messages during ingest when hits on keyword from this list occur
+KeywordSearchConfigurationPanel2.skipNSRLCheckBox.text=Do not add files in NSRL (known files) to keyword index during ingest
+KeywordSearchConfigurationPanel2.skipNSRLCheckBox.toolTipText=Requires Hash DB service to had run previously, or be selected for next ingest.
+KeywordSearchConfigurationPanel2.filesIndexedValue.text=-
+KeywordSearchConfigurationPanel2.filesIndexedLabel.text=Files in keyword index:
+KeywordSearchIngestSimplePanel.languagesLabel.text=Scripts enabled for string extraction from unknown file types:
+KeywordSearchIngestSimplePanel.languagesValLabel.text=-
+KeywordSearchIngestSimplePanel.languagesLabel.toolTipText=Scripts enabled for string extraction from unknown file types. Changes can be done in Advanced Settings.
+KeywordSearchIngestSimplePanel.languagesValLabel.toolTipText=
+KeywordSearchConfigurationPanel3.languagesLabel.text=Enabled scripts (languages):
+KeywordSearchConfigurationPanel2.chunksLabel.text=Chunks in keyword index:
+KeywordSearchConfigurationPanel2.chunksValLabel.text=-
+KeywordSearchConfigurationPanel3.enableUTF8Checkbox.text=Enable UTF8 text extraction
+KeywordSearchConfigurationPanel3.enableUTF16Checkbox.text=Enable UTF16LE and UTF16BE string extraction
+KeywordSearchEditListPanel.keywordOptionsLabel.text=Keyword Options
+KeywordSearchEditListPanel.listOptionsLabel.text=List Options
+KeywordSearchConfigurationPanel3.ingestSettingsLabel.text=Ingest settings for string extraction from unknown file types (changes effective on next ingest):
+KeywordSearchConfigurationPanel2.settingsLabel.text=Settings
+KeywordSearchConfigurationPanel2.informationLabel.text=Information
+KeywordSearchListsManagementPanel.keywordListsLabel.text=Keyword Lists:
+KeywordSearchEditListPanel.keywordsLabel.text=Keywords:
+KeywordSearchConfigurationPanel2.timeRadioButton1.toolTipText=20 mins. (fastest ingest time)
+KeywordSearchConfigurationPanel2.timeRadioButton1.text=20 minutes (slowest feedback, fastest ingest)
+KeywordSearchConfigurationPanel2.timeRadioButton2.toolTipText=10 minutes (faster overall ingest time than default)
+KeywordSearchConfigurationPanel2.timeRadioButton2.text=10 minutes (slower feedback, faster ingest)
+KeywordSearchConfigurationPanel2.timeRadioButton3.toolTipText=5 minutes (overall ingest time will be longer)
+KeywordSearchConfigurationPanel2.timeRadioButton3.text=5 minutes (default)
+KeywordSearchIngestSimplePanel.encodingsLabel.text=Encodings:
+KeywordSearchIngestSimplePanel.keywordSearchEncodings.text=-
+KeywordSearchIngestSimplePanel.titleLabel.text=Select keyword lists to enable during ingest:
+OpenIDE-Module-Short-Description=Keyword Search ingest module, extracted text viewer and keyword search tools
+KeywordSearchListsViewerPanel.manageListsButton.toolTipText=Manage keyword lists, their settings and associated keywords. The settings are shared among all cases.
+KeywordSearchConfigurationPanel2.frequencyLabel.text=Results update frequency during ingest:
+KeywordSearchConfigurationPanel2.timeRadioButton4.text_1=1 minute (faster feedback, longest ingest)
+KeywordSearchConfigurationPanel2.timeRadioButton4.toolTipText=1 minute (overall ingest time will be longest)
diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/docs/keywordsearch-about.html b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/docs/keywordsearch-about.html
index ec2a45f056..a283f09dde 100644
--- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/docs/keywordsearch-about.html
+++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/docs/keywordsearch-about.html
@@ -1,81 +1,81 @@
-
-
-
-
- Keyword Search
-
-
-
-
- Keyword Search
-
- Autopsy ships a keyword search module, which provides the ingest capability
- and also supports a manual text search mode.
-
- The keyword search ingest module extracts text from the files on the image being ingested and adds them to the index that can then be searched.
-
- Autopsy tries its best to extract maximum amount of text from the files being indexed.
- First, the indexing will try to extract text from supported file formats, such as pure text file format, MS Office Documents, PDF files, Email files, and many others.
- If the file is not supported by the standard text extractor, Autopsy will fallback to string extraction algorithm.
- String extraction on unknown file formats or arbitrary binary files can often still extract a good amount of text from the file, often good enough to provide additional clues.
- However, string extraction will not be able to extract text strings from binary files that have been encrypted.
-
-
- Autopsy ships with some built-in lists that define regular expressions and enable user to search for Phone Numbers, IP addresses, URLs and E-mail addresses.
- However, enabling some of these very general lists can produce a very large number of hits, many of them can be false-positives.
-
-
- Once files are in the index, they can be searched quickly for specific keywords, regular expressions,
- or using keyword search lists that can contain a mixture of keywords and regular expressions.
- Search queries can be executed automatically by the ingest during the ingest run, or at the end of the ingest, depending on the current settings and the time it takes to ingest the image.
-
- Search queries can also be executed manually by the user at any time, as long as there are some files already indexed and ready to be searched.
-
- Keyword search module will save the search results regardless whether the search is performed by the ingest process, or manually by the user.
- The saved results are available in the Directory Tree in the left hand side panel.
-
-
- To see keyword search results in real-time while ingest is running, add keyword lists using the
- Keyword Search Configuration Dialog
- and select the "Use during ingest" check box.
- You can select "Enable sending messages to inbox during ingest" per list, if the hits on that list should be reported in the Inbox, which is recommended for very specific searches.
-
-
- See (Ingest)
- for more information on ingest in general.
-
-
- Once there are files in the index, the Keyword Search Bar
- will be available for use to manually search at any time.
-
-
-
-
+
+
+
+
+ Keyword Search
+
+
+
+
+ Keyword Search
+
+ Autopsy ships a keyword search module, which provides the ingest capability
+ and also supports a manual text search mode.
+
+ The keyword search ingest module extracts text from the files on the image being ingested and adds them to the index that can then be searched.
+
+ Autopsy tries its best to extract maximum amount of text from the files being indexed.
+ First, the indexing will try to extract text from supported file formats, such as pure text file format, MS Office Documents, PDF files, Email files, and many others.
+ If the file is not supported by the standard text extractor, Autopsy will fallback to string extraction algorithm.
+ String extraction on unknown file formats or arbitrary binary files can often still extract a good amount of text from the file, often good enough to provide additional clues.
+ However, string extraction will not be able to extract text strings from binary files that have been encrypted.
+
+
+ Autopsy ships with some built-in lists that define regular expressions and enable user to search for Phone Numbers, IP addresses, URLs and E-mail addresses.
+ However, enabling some of these very general lists can produce a very large number of hits, many of them can be false-positives.
+
+
+ Once files are in the index, they can be searched quickly for specific keywords, regular expressions,
+ or using keyword search lists that can contain a mixture of keywords and regular expressions.
+ Search queries can be executed automatically by the ingest during the ingest run, or at the end of the ingest, depending on the current settings and the time it takes to ingest the image.
+
+ Search queries can also be executed manually by the user at any time, as long as there are some files already indexed and ready to be searched.
+
+ Keyword search module will save the search results regardless whether the search is performed by the ingest process, or manually by the user.
+ The saved results are available in the Directory Tree in the left hand side panel.
+
+
+ To see keyword search results in real-time while ingest is running, add keyword lists using the
+ Keyword Search Configuration Dialog
+ and select the "Use during ingest" check box.
+ You can select "Send messages to inbox during ingest" per list, if the hits on that list should be reported in the Inbox, which is recommended for very specific searches.
+
+
+ See (Ingest)
+ for more information on ingest in general.
+
+
+ Once there are files in the index, the Keyword Search Bar
+ will be available for use to manually search at any time.
+
+
+
+
diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java
index c405e92fda..849aae992e 100644
--- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java
+++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Chrome.java
@@ -150,12 +150,9 @@ public class Chrome extends Extract {
Collection bbattributes = new ArrayList();
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "Recent Activity", ((result.get("url").toString() != null) ? result.get("url").toString() : "")));
- //bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL_DECODED.getTypeID(), "Recent Activity", ((result.get("url").toString() != null) ? EscapeUtil.decodeURL(result.get("url").toString()) : "")));
- //TODO Revisit usage of deprecated constructor per TSK-583
- //bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID(), "Recent Activity", "Last Visited", ((Long.valueOf(result.get("last_visit_time").toString())) / 10000000)));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "Recent Activity", ((Long.valueOf(result.get("last_visit_time").toString())) / 10000000)));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), "Recent Activity", ((result.get("from_visit").toString() != null) ? result.get("from_visit").toString() : "")));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), "Recent Activity", ((result.get("title").toString() != null) ? result.get("title").toString() : "")));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), "Recent Activity", ((result.get("title").toString() != null) ? result.get("title").toString() : "")));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), "Recent Activity", "Chrome"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), "Recent Activity", (Util.extractDomain((result.get("url").toString() != null) ? result.get("url").toString() : ""))));
this.addArtifact(ARTIFACT_TYPE.TSK_WEB_HISTORY, historyFile, bbattributes);
@@ -276,8 +273,8 @@ public class Chrome extends Extract {
//TODO Revisit usage of deprecated constructor as per TSK-583
//bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID(), "Recent Activity", "Last Visited", (date / 10000000)));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "Recent Activity", url));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), "Recent Activity", name));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "Recent Activity", (date / 10000000)));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), "Recent Activity", name));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), "Recent Activity", (date / 10000000)));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), "Recent Activity", "Chrome"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), "Recent Activity", domain));
bbart.addAttributes(bbattributes);
diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java
index dc3920ab8e..980c48aba4 100644
--- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java
+++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractIE.java
@@ -157,8 +157,8 @@ public class ExtractIE extends Extract {
Collection bbattributes = new ArrayList();
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "RecentActivity", url));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), "RecentActivity", name));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "RecentActivity", datetime));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), "RecentActivity", name));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), "RecentActivity", datetime));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), "RecentActivity", "Internet Explorer"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), "RecentActivity", domain));
this.addArtifact(ARTIFACT_TYPE.TSK_WEB_BOOKMARK, favoritesFile, bbattributes);
@@ -507,7 +507,7 @@ public class ExtractIE extends Extract {
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "RecentActivity", ftime));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), "RecentActivity", ""));
- // @@@ NOte that other browser modules are adding NAME in hre for the title
+ // @@@ NOte that other browser modules are adding TITLE in hre for the title
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), "RecentActivity", "Internet Explorer"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), "RecentActivity", domain));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME.getTypeID(), "RecentActivity", user));
diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java
index 70ad839baa..4abfcf0bec 100644
--- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java
+++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/Firefox.java
@@ -132,11 +132,9 @@ public class Firefox extends Extract {
Collection bbattributes = new ArrayList();
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "RecentActivity", ((result.get("url").toString() != null) ? result.get("url").toString() : "")));
//bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL_DECODED.getTypeID(), "RecentActivity", ((result.get("url").toString() != null) ? EscapeUtil.decodeURL(result.get("url").toString()) : "")));
- //TODO Revisit usage of deprecated constructor as per TSK-583
- //bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID(), "RecentActivity", "Last Visited", (Long.valueOf(result.get("visit_date").toString()))));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "RecentActivity", (Long.valueOf(result.get("visit_date").toString()))));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REFERRER.getTypeID(), "RecentActivity", ((result.get("ref").toString() != null) ? result.get("ref").toString() : "")));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), "RecentActivity", ((result.get("title").toString() != null) ? result.get("title").toString() : "")));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), "RecentActivity", ((result.get("title").toString() != null) ? result.get("title").toString() : "")));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), "RecentActivity", "FireFox"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), "RecentActivity", (Util.extractDomain((result.get("url").toString() != null) ? result.get("url").toString() : ""))));
this.addArtifact(ARTIFACT_TYPE.TSK_WEB_HISTORY, historyFile, bbattributes);
@@ -199,10 +197,9 @@ public class Firefox extends Extract {
Collection bbattributes = new ArrayList();
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "RecentActivity", ((result.get("url").toString() != null) ? result.get("url").toString() : "")));
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME.getTypeID(), "RecentActivity", ((result.get("title").toString() != null) ? result.get("title").toString() : "")));
- long time = Long.valueOf(result.get("dateAdded").toString());
- if (time > 0) {
- bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "RecentActivity", Long.valueOf(result.get("dateAdded").toString())));
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE.getTypeID(), "RecentActivity", ((result.get("title").toString() != null) ? result.get("title").toString() : "")));
+ if (Long.valueOf(result.get("dateAdded").toString()) > 0) {
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), "RecentActivity", (Long.valueOf(result.get("dateAdded").toString()))));
}
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME.getTypeID(), "RecentActivity", "FireFox"));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN.getTypeID(), "RecentActivity", (Util.extractDomain((result.get("url").toString() != null) ? result.get("url").toString() : ""))));
@@ -358,8 +355,6 @@ public class Firefox extends Extract {
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL.getTypeID(), "RecentActivity", ((result.get("source").toString() != null) ? result.get("source").toString() : "")));
//bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL_DECODED.getTypeID(), "RecentActivity", ((result.get("source").toString() != null) ? EscapeUtil.decodeURL(result.get("source").toString()) : "")));
- //TODO Revisit usage of deprecated constructor as per TSK-583
- //bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LAST_ACCESSED.getTypeID(), "RecentActivity", "Last Visited", (Long.valueOf(result.get("startTime").toString()))));
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID(), "RecentActivity", (Long.valueOf(result.get("startTime").toString()))));
try {
diff --git a/test/README.txt b/test/README.txt
index d0064b4f95..854f5e1a33 100644
--- a/test/README.txt
+++ b/test/README.txt
@@ -1,13 +1,13 @@
-This folder contains the data and scripts required to run regression tests
-for Autopsy. There is a 'Testing' folder in the root directory that contains
-the Java code that drives Autopsy to perform the tests.
-
-To run these tests:
-- You will need python3. We run this from within Cygwin.
-- Download the input images by typing 'ant test-download-imgs' in the root Autopsy folder.
- This will place images in 'test/input'.
-- Run 'python3 regression.py' from inside of the 'test/scripts' folder.
-- Alternatively, run 'python3 regression.py -l [CONFIGFILE] to run the tests on a specified
- list of images using a configuration file. See config.xml in the 'test/scripts' folder to
- see configuration file formatting.
-- Run 'python3 regression.py -h' to see other options.
+This folder contains the data and scripts required to run regression tests
+for Autopsy. There is a 'Testing' folder in the root directory that contains
+the Java code that drives Autopsy to perform the tests.
+
+To run these tests:
+- You will need python3. We run this from within Cygwin.
+- Download the input images by typing 'ant test-download-imgs' in the root Autopsy folder.
+ This will place images in 'test/input'.
+- Run 'python3 regression.py' from inside of the 'test/scripts' folder.
+- Alternatively, run 'python3 regression.py -l [CONFIGFILE] to run the tests on a specified
+ list of images using a configuration file. See config.xml in the 'test/scripts' folder to
+ see configuration file formatting.
+- Run 'python3 regression.py -h' to see other options.
diff --git a/test/script/Emailer.py b/test/script/Emailer.py
index 5d12e6afa3..7e661e12ea 100644
--- a/test/script/Emailer.py
+++ b/test/script/Emailer.py
@@ -1,49 +1,49 @@
-import smtplib
-from email.mime.image import MIMEImage
-from email.mime.multipart import MIMEMultipart
-from email.mime.text import MIMEText
-from email.mime.base import MIMEBase
-from email import encoders
-import xml
-from xml.dom.minidom import parse, parseString
-
-def send_email(to, server, subj, body, attachments):
- """Send an email with the given information.
-
- Args:
- to: a String, the email address to send the email to
- server: a String, the mail server to send from
- subj: a String, the subject line of the message
- body: a String, the body of the message
- attachments: a listof_pathto_File, the attachements to include
- """
- msg = MIMEMultipart()
- msg['Subject'] = subj
- # me == the sender's email address
- # family = the list of all recipients' email addresses
- msg['From'] = 'AutopsyTest'
- msg['To'] = to
- msg.preamble = 'This is a test'
- container = MIMEText(body, 'plain')
- msg.attach(container)
- Build_email(msg, attachments)
- s = smtplib.SMTP(server)
- try:
- print('Sending Email')
- s.sendmail(msg['From'], msg['To'], msg.as_string())
- except Exception as e:
- print(str(e))
- s.quit()
-
-def Build_email(msg, attachments):
- for file in attachments:
- part = MIMEBase('application', "octet-stream")
- atach = open(file, "rb")
- attch = atach.read()
- noml = file.split("\\")
- nom = noml[len(noml)-1]
- part.set_payload(attch)
- encoders.encode_base64(part)
- part.add_header('Content-Disposition', 'attachment; filename="' + nom + '"')
- msg.attach(part)
-
+import smtplib
+from email.mime.image import MIMEImage
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+from email.mime.base import MIMEBase
+from email import encoders
+import xml
+from xml.dom.minidom import parse, parseString
+
+def send_email(to, server, subj, body, attachments):
+ """Send an email with the given information.
+
+ Args:
+ to: a String, the email address to send the email to
+ server: a String, the mail server to send from
+ subj: a String, the subject line of the message
+ body: a String, the body of the message
+ attachments: a listof_pathto_File, the attachements to include
+ """
+ msg = MIMEMultipart()
+ msg['Subject'] = subj
+ # me == the sender's email address
+ # family = the list of all recipients' email addresses
+ msg['From'] = 'AutopsyTest'
+ msg['To'] = to
+ msg.preamble = 'This is a test'
+ container = MIMEText(body, 'plain')
+ msg.attach(container)
+ Build_email(msg, attachments)
+ s = smtplib.SMTP(server)
+ try:
+ print('Sending Email')
+ s.sendmail(msg['From'], msg['To'], msg.as_string())
+ except Exception as e:
+ print(str(e))
+ s.quit()
+
+def Build_email(msg, attachments):
+ for file in attachments:
+ part = MIMEBase('application', "octet-stream")
+ atach = open(file, "rb")
+ attch = atach.read()
+ noml = file.split("\\")
+ nom = noml[len(noml)-1]
+ part.set_payload(attch)
+ encoders.encode_base64(part)
+ part.add_header('Content-Disposition', 'attachment; filename="' + nom + '"')
+ msg.attach(part)
+
diff --git a/test/script/regression.py b/test/script/regression.py
index b2ad319963..6c640823ed 100644
--- a/test/script/regression.py
+++ b/test/script/regression.py
@@ -1,1854 +1,1854 @@
-#!/usr/bin/python
-# -*- coding: utf_8 -*-
-
- # Autopsy Forensic Browser
- #
- # Copyright 2013 Basis Technology Corp.
- #
- # 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.
- # See the License for the specific language governing permissions and
- # limitations under the License.
-from tskdbdiff import TskDbDiff, TskDbDiffException
-import codecs
-import datetime
-import logging
-import os
-import re
-import shutil
-import socket
-import sqlite3
-import subprocess
-import sys
-from sys import platform as _platform
-import time
-import traceback
-import xml
-from time import localtime, strftime
-from xml.dom.minidom import parse, parseString
-import smtplib
-from email.mime.image import MIMEImage
-from email.mime.multipart import MIMEMultipart
-from email.mime.text import MIMEText
-import re
-import zipfile
-import zlib
-import Emailer
-import srcupdater
-from regression_utils import *
-
-#
-# Please read me...
-#
-# This is the regression testing Python script.
-# It uses an ant command to run build.xml for RegressionTest.java
-#
-# The code is cleanly sectioned and commented.
-# Please follow the current formatting.
-# It is a long and potentially confusing script.
-#
-# Variable, function, and class names are written in Python conventions:
-# this_is_a_variable this_is_a_function() ThisIsAClass
-#
-#
-
-
-# Data Definitions:
-#
-# pathto_X: A path to type X.
-# ConfigFile: An XML file formatted according to the template in myconfig.xml
-# ParsedConfig: A dom object that represents a ConfigFile
-# SQLCursor: A cursor recieved from a connection to an SQL database
-# Nat: A Natural Number
-# Image: An image
-#
-
-# Enumeration of database types used for the simplification of generating database paths
-DBType = enum('OUTPUT', 'GOLD', 'BACKUP')
-
-# Common filename of the output and gold databases (although they are in different directories
-DB_FILENAME = "autopsy.db"
-
-# Backup database filename
-BACKUP_DB_FILENAME = "autopsy_backup.db"
-
-# TODO: Double check this purpose statement
-# Folder name for gold standard database testing
-AUTOPSY_TEST_CASE = "AutopsyTestCase"
-
-# TODO: Double check this purpose statement
-# The filename of the log to store error messages
-COMMON_LOG = "AutopsyErrors.txt"
-
-Day = 0
-
-#----------------------#
-# Main #
-#----------------------#
-def main():
- """Parse the command-line arguments, create the configuration, and run the tests."""
- args = Args()
- parse_result = args.parse()
- test_config = TestConfiguration(args)
- # The arguments were given wrong:
- if not parse_result:
- return
- if(not args.fr):
- antin = ["ant"]
- antin.append("-f")
- antin.append(os.path.join("..","..","build.xml"))
- antin.append("test-download-imgs")
- if SYS is OS.CYGWIN:
- subprocess.call(antin)
- elif SYS is OS.WIN:
- theproc = subprocess.Popen(antin, shell = True, stdout=subprocess.PIPE)
- theproc.communicate()
- # Otherwise test away!
- TestRunner.run_tests(test_config)
-
-
-class TestRunner(object):
- """A collection of functions to run the regression tests."""
-
- def run_tests(test_config):
- """Run the tests specified by the main TestConfiguration.
-
- Executes the AutopsyIngest for each image and dispatches the results based on
- the mode (rebuild or testing)
- """
- test_data_list = [ TestData(image, test_config) for image in test_config.images ]
-
- Reports.html_add_images(test_config.html_log, test_config.images)
-
- logres =[]
- for test_data in test_data_list:
- Errors.clear_print_logs()
- Errors.set_testing_phase(test_data.image)
- if not (test_config.args.rebuild or os.path.exists(test_data.gold_archive)):
- msg = "Gold standard doesn't exist, skipping image:"
- Errors.print_error(msg)
- Errors.print_error(test_data.gold_archive)
- continue
- TestRunner._run_autopsy_ingest(test_data)
-
- if test_config.args.rebuild:
- TestRunner.rebuild(test_data)
- else:
- logres.append(TestRunner._run_test(test_data))
- test_data.printout = Errors.printout
- test_data.printerror = Errors.printerror
-
- Reports.write_html_foot(test_config.html_log)
- # TODO: move this elsewhere
- if (len(logres)>0):
- for lm in logres:
- for ln in lm:
- Errors.add_email_msg(ln)
-
- # TODO: possibly worth putting this in a sub method
- if all([ test_data.overall_passed for test_data in test_data_list ]):
- Errors.add_email_msg("All images passed.\n")
- else:
- msg = "The following images failed:\n"
- for test_data in test_data_list:
- if not test_data.overall_passed:
- msg += "\t" + test_data.image + "\n"
- Errors.add_email_msg(msg)
- html = open(test_config.html_log)
- Errors.add_email_attachment(html.name)
- html.close()
-
- if test_config.email_enabled:
- Emailer.send_email(test_config.mail_to, test_config.mail_server,
- test_config.mail_subject, Errors.email_body, Errors.email_attachs)
-
- def _run_autopsy_ingest(test_data):
- """Run Autopsy ingest for the image in the given TestData.
-
- Also generates the necessary logs for rebuilding or diff.
-
- Args:
- test_data: the TestData to run the ingest on.
- """
- if image_type(test_data.image_file) == IMGTYPE.UNKNOWN:
- Errors.print_error("Error: Image type is unrecognized:")
- Errors.print_error(test_data.image_file + "\n")
- return
-
- logging.debug("--------------------")
- logging.debug(test_data.image_name)
- logging.debug("--------------------")
- TestRunner._run_ant(test_data)
- time.sleep(2) # Give everything a second to process
-
- try:
- # Dump the database before we diff or use it for rebuild
- TskDbDiff.dump_output_db(test_data.get_db_path(DBType.OUTPUT), test_data.get_db_dump_path(DBType.OUTPUT),
- test_data.get_sorted_data_path(DBType.OUTPUT))
- except sqlite3.OperationalError as e:
- print("Ingest did not run properly.",
- "Make sure no other instances of Autopsy are open and try again.")
- sys.exit()
-
- # merges logs into a single log for later diff / rebuild
- copy_logs(test_data)
- Logs.generate_log_data(test_data)
-
- TestRunner._handle_solr(test_data)
- TestRunner._handle_exception(test_data)
-
- #TODO: figure out return type of _run_test (logres)
- def _run_test(test_data):
- """Compare the results of the output to the gold standard.
-
- Args:
- test_data: the TestData
-
- Returns:
- logres?
- """
- TestRunner._extract_gold(test_data)
-
- # Look for core exceptions
- # @@@ Should be moved to TestResultsDiffer, but it didn't know about logres -- need to look into that
- logres = Logs.search_common_log("TskCoreException", test_data)
-
- TestResultsDiffer.run_diff(test_data)
- test_data.overall_passed = (test_data.html_report_passed and
- test_data.errors_diff_passed and test_data.db_diff_passed)
-
- Reports.generate_reports(test_data)
- if(not test_data.overall_passed):
- Errors.add_email_attachment(test_data.common_log_path)
- return logres
-
- def _extract_gold(test_data):
- """Extract gold archive file to output/gold/tmp/
-
- Args:
- test_data: the TestData
- """
- extrctr = zipfile.ZipFile(test_data.gold_archive, 'r', compression=zipfile.ZIP_DEFLATED)
- extrctr.extractall(test_data.main_config.gold)
- extrctr.close
- time.sleep(2)
-
- def _handle_solr(test_data):
- """Clean up SOLR index if in keep mode (-k).
-
- Args:
- test_data: the TestData
- """
- if not test_data.main_config.args.keep:
- if clear_dir(test_data.solr_index):
- print_report([], "DELETE SOLR INDEX", "Solr index deleted.")
- else:
- print_report([], "KEEP SOLR INDEX", "Solr index has been kept.")
-
- def _handle_exception(test_data):
- """If running in exception mode, print exceptions to log.
-
- Args:
- test_data: the TestData
- """
- if test_data.main_config.args.exception:
- exceptions = search_logs(test_data.main_config.args.exception_string, test_data)
- okay = ("No warnings or exceptions found containing text '" +
- test_data.main_config.args.exception_string + "'.")
- print_report(exceptions, "EXCEPTION", okay)
-
- def rebuild(test_data):
- """Rebuild the gold standard with the given TestData.
-
- Copies the test-generated database and html report files into the gold directory.
- """
- test_config = test_data.main_config
- # Errors to print
- errors = []
- # Delete the current gold standards
- gold_dir = test_config.img_gold
- clear_dir(test_config.img_gold)
- tmpdir = make_path(gold_dir, test_data.image_name)
- dbinpth = test_data.get_db_path(DBType.OUTPUT)
- dboutpth = make_path(tmpdir, DB_FILENAME)
- dataoutpth = make_path(tmpdir, test_data.image_name + "SortedData.txt")
- dbdumpinpth = test_data.get_db_dump_path(DBType.OUTPUT)
- dbdumpoutpth = make_path(tmpdir, test_data.image_name + "DBDump.txt")
- if not os.path.exists(test_config.img_gold):
- os.makedirs(test_config.img_gold)
- if not os.path.exists(tmpdir):
- os.makedirs(tmpdir)
- try:
- shutil.copy(dbinpth, dboutpth)
- if file_exists(test_data.get_sorted_data_path(DBType.OUTPUT)):
- shutil.copy(test_data.get_sorted_data_path(DBType.OUTPUT), dataoutpth)
- shutil.copy(dbdumpinpth, dbdumpoutpth)
- error_pth = make_path(tmpdir, test_data.image_name+"SortedErrors.txt")
- shutil.copy(test_data.sorted_log, error_pth)
- except IOError as e:
- Errors.print_error(str(e))
- Errors.add_email_message("Not rebuilt properly")
- print(str(e))
- print(traceback.format_exc())
- # Rebuild the HTML report
- output_html_report_dir = test_data.get_html_report_path(DBType.OUTPUT)
- gold_html_report_dir = make_path(tmpdir, "Report")
-
- try:
- shutil.copytree(output_html_report_dir, gold_html_report_dir)
- except OSError as e:
- errors.append(e.error())
- except Exception as e:
- errors.append("Error: Unknown fatal error when rebuilding the gold html report.")
- errors.append(str(e) + "\n")
- print(traceback.format_exc())
- oldcwd = os.getcwd()
- zpdir = gold_dir
- os.chdir(zpdir)
- os.chdir("..")
- img_gold = "tmp"
- img_archive = make_path(test_data.image_name+"-archive.zip")
- comprssr = zipfile.ZipFile(img_archive, 'w',compression=zipfile.ZIP_DEFLATED)
- TestRunner.zipdir(img_gold, comprssr)
- comprssr.close()
- os.chdir(oldcwd)
- del_dir(test_config.img_gold)
- okay = "Sucessfully rebuilt all gold standards."
- print_report(errors, "REBUILDING", okay)
-
- def zipdir(path, zip):
- for root, dirs, files in os.walk(path):
- for file in files:
- zip.write(os.path.join(root, file))
-
- def _run_ant(test_data):
- """Construct and run the ant build command for the given TestData.
-
- Tests Autopsy by calling RegressionTest.java via the ant build file.
-
- Args:
- test_data: the TestData
- """
- test_config = test_data.main_config
- # Set up the directories
- if dir_exists(test_data.output_path):
- shutil.rmtree(test_data.output_path)
- os.makedirs(test_data.output_path)
- test_data.ant = ["ant"]
- test_data.ant.append("-v")
- test_data.ant.append("-f")
- # case.ant.append(case.build_path)
- test_data.ant.append(os.path.join("..","..","Testing","build.xml"))
- test_data.ant.append("regression-test")
- test_data.ant.append("-l")
- test_data.ant.append(test_data.antlog_dir)
- test_data.ant.append("-Dimg_path=" + test_data.image_file)
- test_data.ant.append("-Dknown_bad_path=" + test_config.known_bad_path)
- test_data.ant.append("-Dkeyword_path=" + test_config.keyword_path)
- test_data.ant.append("-Dnsrl_path=" + test_config.nsrl_path)
- test_data.ant.append("-Dgold_path=" + test_config.gold)
- test_data.ant.append("-Dout_path=" +
- make_local_path(test_data.output_path))
- test_data.ant.append("-Dignore_unalloc=" + "%s" % test_config.args.unallocated)
- test_data.ant.append("-Dtest.timeout=" + str(test_config.timeout))
-
- Errors.print_out("Ingesting Image:\n" + test_data.image_file + "\n")
- Errors.print_out("CMD: " + " ".join(test_data.ant))
- Errors.print_out("Starting test...\n")
- antoutpth = make_local_path(test_data.main_config.output_dir, "antRunOutput.txt")
- antout = open(antoutpth, "a")
- if SYS is OS.CYGWIN:
- subprocess.call(test_data.ant, stdout=subprocess.PIPE)
- elif SYS is OS.WIN:
- theproc = subprocess.Popen(test_data.ant, shell = True, stdout=subprocess.PIPE)
- theproc.communicate()
- antout.close()
-
-
-class TestData(object):
- """Container for the input and output of a single image.
-
- Represents data for the test of a single image, including path to the image,
- database paths, etc.
-
- Attributes:
- main_config: the global TestConfiguration
- ant: a listof_String, the ant command for this TestData
- image_file: a pathto_Image, the image for this TestData
- image: a String, the image file's name
- image_name: a String, the image file's name with a trailing (0)
- output_path: pathto_Dir, the output directory for this TestData
- autopsy_data_file: a pathto_File, the IMAGE_NAMEAutopsy_data.txt file
- warning_log: a pathto_File, the AutopsyLogs.txt file
- antlog_dir: a pathto_File, the antlog.txt file
- test_dbdump: a pathto_File, the database dump, IMAGENAMEDump.txt
- common_log_path: a pathto_File, the IMAGE_NAMECOMMON_LOG file
- sorted_log: a pathto_File, the IMAGENAMESortedErrors.txt file
- reports_dir: a pathto_Dir, the AutopsyTestCase/Reports folder
- gold_data_dir: a pathto_Dir, the gold standard directory
- gold_archive: a pathto_File, the gold standard archive
- logs_dir: a pathto_Dir, the location where autopsy logs are stored
- solr_index: a pathto_Dir, the locatino of the solr index
- html_report_passed: a boolean, did the HTML report diff pass?
- errors_diff_passed: a boolean, did the error diff pass?
- db_diff_passed: a boolean, did the db diff pass?
- overall_passed: a boolean, did the test pass?
- total_test_time: a String representation of the test duration
- start_date: a String representation of this TestData's start date
- end_date: a String representation of the TestData's end date
- total_ingest_time: a String representation of the total ingest time
- artifact_count: a Nat, the number of artifacts
- artifact_fail: a Nat, the number of artifact failures
- heap_space: a String representation of TODO
- service_times: a String representation of TODO
- autopsy_version: a String, the version of autopsy that was run
- ingest_messages: a Nat, the number of ingest messages
- indexed_files: a Nat, the number of files indexed during the ingest
- indexed_chunks: a Nat, the number of chunks indexed during the ingest
- printerror: a listof_String, the error messages printed during this TestData's test
- printout: a listof_String, the messages pritned during this TestData's test
- """
-
- def __init__(self, image, main_config):
- """Init this TestData with it's image and the test configuration.
-
- Args:
- image: the Image to be tested.
- main_config: the global TestConfiguration.
- """
- # Configuration Data
- self.main_config = main_config
- self.ant = []
- self.image_file = str(image)
- # TODO: This 0 should be be refactored out, but it will require rebuilding and changing of outputs.
- self.image = get_image_name(self.image_file)
- self.image_name = self.image + "(0)"
- # Directory structure and files
- self.output_path = make_path(self.main_config.output_dir, self.image_name)
- self.autopsy_data_file = make_path(self.output_path, self.image_name + "Autopsy_data.txt")
- self.warning_log = make_local_path(self.output_path, "AutopsyLogs.txt")
- self.antlog_dir = make_local_path(self.output_path, "antlog.txt")
- self.test_dbdump = make_path(self.output_path, self.image_name +
- "DBDump.txt")
- self.common_log_path = make_local_path(self.output_path, self.image_name + COMMON_LOG)
- self.sorted_log = make_local_path(self.output_path, self.image_name + "SortedErrors.txt")
- self.reports_dir = make_path(self.output_path, AUTOPSY_TEST_CASE, "Reports")
- self.gold_data_dir = make_path(self.main_config.img_gold, self.image_name)
- self.gold_archive = make_path(self.main_config.gold,
- self.image_name + "-archive.zip")
- self.logs_dir = make_path(self.output_path, "logs")
- self.solr_index = make_path(self.output_path, AUTOPSY_TEST_CASE,
- "ModuleOutput", "KeywordSearch")
- # Results and Info
- self.html_report_passed = False
- self.errors_diff_passed = False
- self.db_diff_passed = False
- self.overall_passed = False
- # Ingest info
- self.total_test_time = ""
- self.start_date = ""
- self.end_date = ""
- self.total_ingest_time = ""
- self.artifact_count = 0
- self.artifact_fail = 0
- self.heap_space = ""
- self.service_times = ""
- self.autopsy_version = ""
- self.ingest_messages = 0
- self.indexed_files = 0
- self.indexed_chunks = 0
- # Error tracking
- self.printerror = []
- self.printout = []
-
- def ant_to_string(self):
- string = ""
- for arg in self.ant:
- string += (arg + " ")
- return string
-
- def get_db_path(self, db_type):
- """Get the path to the database file that corresponds to the given DBType.
-
- Args:
- DBType: the DBType of the path to be generated.
- """
- if(db_type == DBType.GOLD):
- db_path = make_path(self.gold_data_dir, DB_FILENAME)
- elif(db_type == DBType.OUTPUT):
- db_path = make_path(self.main_config.output_dir, self.image_name, AUTOPSY_TEST_CASE, DB_FILENAME)
- else:
- db_path = make_path(self.main_config.output_dir, self.image_name, AUTOPSY_TEST_CASE, BACKUP_DB_FILENAME)
- return db_path
-
- def get_html_report_path(self, html_type):
- """Get the path to the HTML Report folder that corresponds to the given DBType.
-
- Args:
- DBType: the DBType of the path to be generated.
- """
- if(html_type == DBType.GOLD):
- return make_path(self.gold_data_dir, "Report")
- else:
- # Autopsy creates an HTML report folder in the form AutopsyTestCase DATE-TIME
- # It's impossible to get the exact time the folder was created, but the folder
- # we are looking for is the only one in the self.reports_dir folder
- html_path = ""
- for fs in os.listdir(self.reports_dir):
- html_path = make_path(self.reports_dir, fs)
- if os.path.isdir(html_path):
- break
- return make_path(html_path, os.listdir(html_path)[0])
-
- def get_sorted_data_path(self, file_type):
- """Get the path to the SortedData file that corresponds to the given DBType.
-
- Args:
- file_type: the DBType of the path to be generated
- """
- return self._get_path_to_file(file_type, "SortedData.txt")
-
- def get_sorted_errors_path(self, file_type):
- """Get the path to the SortedErrors file that correspodns to the given
- DBType.
-
- Args:
- file_type: the DBType of the path to be generated
- """
- return self._get_path_to_file(file_type, "SortedErrors.txt")
-
- def get_db_dump_path(self, file_type):
- """Get the path to the DBDump file that corresponds to the given DBType.
-
- Args:
- file_type: the DBType of the path to be generated
- """
- return self._get_path_to_file(file_type, "DBDump.txt")
-
- def _get_path_to_file(self, file_type, file_name):
- """Get the path to the specified file with the specified type.
-
- Args:
- file_type: the DBType of the path to be generated
- file_name: a String, the filename of the path to be generated
- """
- full_filename = self.image_name + file_name
- if(file_type == DBType.GOLD):
- return make_path(self.gold_data_dir, full_filename)
- else:
- return make_path(self.output_path, full_filename)
-
-
-class TestConfiguration(object):
- """Container for test configuration data.
-
- The Master Test Configuration. Encapsulates consolidated high level input from
- config XML file and command-line arguments.
-
- Attributes:
- args: an Args, the command line arguments
- output_dir: a pathto_Dir, the output directory
- input_dir: a pathto_Dir, the input directory
- gold: a pathto_Dir, the gold directory
- img_gold: a pathto_Dir, the temp directory where gold images are unzipped to
- csv: a pathto_File, the local csv file
- global_csv: a pathto_File, the global csv file
- html_log: a pathto_File
- known_bad_path:
- keyword_path:
- nsrl_path:
- build_path: a pathto_File, the ant build file which runs the tests
- autopsy_version:
- ingest_messages: a Nat, number of ingest messages
- indexed_files: a Nat, the number of indexed files
- indexed_chunks: a Nat, the number of indexed chunks
- timer:
- images: a listof_Image, the images to be tested
- timeout: a Nat, the amount of time before killing the test
- ant: a listof_String, the ant command to run the tests
- """
-
- def __init__(self, args):
- """Inits TestConfiguration and loads a config file if available.
-
- Args:
- args: an Args, the command line arguments.
- """
- self.args = args
- # Paths:
- self.output_dir = ""
- self.input_dir = make_local_path("..","input")
- self.gold = make_path("..", "output", "gold")
- self.img_gold = make_path(self.gold, 'tmp')
- # Logs:
- self.csv = ""
- self.global_csv = ""
- self.html_log = ""
- # Ant info:
- self.known_bad_path = make_path(self.input_dir, "notablehashes.txt-md5.idx")
- self.keyword_path = make_path(self.input_dir, "notablekeywords.xml")
- self.nsrl_path = make_path(self.input_dir, "nsrl.txt-md5.idx")
- self.build_path = make_path("..", "build.xml")
- # Infinite Testing info
- timer = 0
- self.images = []
- # Email info
- self.email_enabled = args.email_enabled
- self.mail_server = ""
- self.mail_to = ""
- self.mail_subject = ""
- # Set the timeout to something huge
- # The entire tester should not timeout before this number in ms
- # However it only seems to take about half this time
- # And it's very buggy, so we're being careful
- self.timeout = 24 * 60 * 60 * 1000 * 1000
-
- if not self.args.single:
- self._load_config_file(self.args.config_file)
- else:
- self.images.append(self.args.single_file)
- self._init_logs()
- #self._init_imgs()
- #self._init_build_info()
-
-
- def _load_config_file(self, config_file):
- """Updates this TestConfiguration's attributes from the config file.
-
- Initializes this TestConfiguration by iterating through the XML config file
- command-line argument. Populates self.images and optional email configuration
-
- Args:
- config_file: ConfigFile - the configuration file to load
- """
- try:
- count = 0
- parsed_config = parse(config_file)
- logres = []
- counts = {}
- if parsed_config.getElementsByTagName("indir"):
- self.input_dir = parsed_config.getElementsByTagName("indir")[0].getAttribute("value").encode().decode("utf_8")
- if parsed_config.getElementsByTagName("global_csv"):
- self.global_csv = parsed_config.getElementsByTagName("global_csv")[0].getAttribute("value").encode().decode("utf_8")
- self.global_csv = make_local_path(self.global_csv)
- if parsed_config.getElementsByTagName("golddir"):
- self.gold = parsed_config.getElementsByTagName("golddir")[0].getAttribute("value").encode().decode("utf_8")
- self.img_gold = make_path(self.gold, 'tmp')
-
- self._init_imgs(parsed_config)
- self._init_build_info(parsed_config)
- self._init_email_info(parsed_config)
-
- except IOError as e:
- msg = "There was an error loading the configuration file.\n"
- msg += "\t" + str(e)
- Errors.add_email_msg(msg)
- logging.critical(traceback.format_exc())
- print(traceback.format_exc())
-
- def _init_logs(self):
- """Setup output folder, logs, and reporting infrastructure."""
- if(not dir_exists(make_path("..", "output", "results"))):
- os.makedirs(make_path("..", "output", "results",))
- self.output_dir = make_path("..", "output", "results", time.strftime("%Y.%m.%d-%H.%M.%S"))
- os.makedirs(self.output_dir)
- self.csv = make_local_path(self.output_dir, "CSV.txt")
- self.html_log = make_path(self.output_dir, "AutopsyTestCase.html")
- log_name = self.output_dir + "\\regression.log"
- logging.basicConfig(filename=log_name, level=logging.DEBUG)
-
- def _init_build_info(self, parsed_config):
- """Initializes paths that point to information necessary to run the AutopsyIngest."""
- build_elements = parsed_config.getElementsByTagName("build")
- if build_elements:
- build_element = build_elements[0]
- build_path = build_element.getAttribute("value").encode().decode("utf_8")
- self.build_path = build_path
-
- def _init_imgs(self, parsed_config):
- """Initialize the list of images to run tests on."""
- for element in parsed_config.getElementsByTagName("image"):
- value = element.getAttribute("value").encode().decode("utf_8")
- print ("Image in Config File: " + value)
- if file_exists(value):
- self.images.append(value)
- else:
- msg = "File: " + value + " doesn't exist"
- Errors.print_error(msg)
- Errors.add_email_msg(msg)
- image_count = len(self.images)
-
- # Sanity check to see if there are obvious gold images that we are not testing
- gold_count = 0
- for file in os.listdir(self.gold):
- if not(file == 'tmp'):
- gold_count+=1
-
- if (image_count > gold_count):
- print("******Alert: There are more input images than gold standards, some images will not be properly tested.\n")
- elif (image_count < gold_count):
- print("******Alert: There are more gold standards than input images, this will not check all gold Standards.\n")
-
- def _init_email_info(self, parsed_config):
- """Initializes email information dictionary"""
- email_elements = parsed_config.getElementsByTagName("email")
- if email_elements:
- mail_to = email_elements[0]
- self.mail_to = mail_to.getAttribute("value").encode().decode("utf_8")
- mail_server_elements = parsed_config.getElementsByTagName("mail_server")
- if mail_server_elements:
- mail_from = mail_server_elements[0]
- self.mail_server = mail_from.getAttribute("value").encode().decode("utf_8")
- subject_elements = parsed_config.getElementsByTagName("subject")
- if subject_elements:
- subject = subject_elements[0]
- self.mail_subject = subject.getAttribute("value").encode().decode("utf_8")
- if self.mail_server and self.mail_to and self.args.email_enabled:
- self.email_enabled = True
- print("Email will be sent to ", self.mail_to)
- else:
- print("No email will be sent.")
-
-
-#-------------------------------------------------#
-# Functions relating to comparing outputs #
-#-------------------------------------------------#
-class TestResultsDiffer(object):
- """Compares results for a single test."""
-
- def run_diff(test_data):
- """Compares results for a single test.
-
- Args:
- test_data: the TestData to use.
- databaseDiff: TskDbDiff object created based off test_data
- """
- try:
- output_db = test_data.get_db_path(DBType.OUTPUT)
- gold_db = test_data.get_db_path(DBType.GOLD)
- output_dir = test_data.output_path
- gold_bb_dump = test_data.get_sorted_data_path(DBType.GOLD)
- gold_dump = test_data.get_db_dump_path(DBType.GOLD)
- test_data.db_diff_pass = all(TskDbDiff(output_db, gold_db, output_dir=output_dir, gold_bb_dump=gold_bb_dump,
- gold_dump=gold_dump).run_diff())
-
- # Compare Exceptions
- # replace is a fucntion that replaces strings of digits with 'd'
- # this is needed so dates and times will not cause the diff to fail
- replace = lambda file: re.sub(re.compile("\d"), "d", file)
- output_errors = test_data.get_sorted_errors_path(DBType.OUTPUT)
- gold_errors = test_data.get_sorted_errors_path(DBType.GOLD)
- passed = TestResultsDiffer._compare_text(output_errors, gold_errors,
- replace)
- test_data.errors_diff_passed = passed
-
- # Compare html output
- gold_report_path = test_data.get_html_report_path(DBType.GOLD)
- output_report_path = test_data.get_html_report_path(DBType.OUTPUT)
- passed = TestResultsDiffer._html_report_diff(gold_report_path,
- output_report_path)
- test_data.html_report_passed = passed
-
- # Clean up tmp folder
- del_dir(test_data.gold_data_dir)
-
- except sqlite3.OperationalError as e:
- Errors.print_error("Tests failed while running the diff:\n")
- Errors.print_error(str(e))
- except TskDbDiffException as e:
- Errors.print_error(str(e))
- except Exception as e:
- Errors.print_error("Tests failed due to an error, try rebuilding or creating gold standards.\n")
- Errors.print_error(str(e) + "\n")
- print(traceback.format_exc())
-
- def _compare_text(output_file, gold_file, process=None):
- """Compare two text files.
-
- Args:
- output_file: a pathto_File, the output text file
- gold_file: a pathto_File, the input text file
- pre-process: (optional) a function of String -> String that will be
- called on each input file before the diff, if specified.
- """
- if(not file_exists(output_file)):
- return False
- output_data = codecs.open(output_file, "r", "utf_8").read()
- gold_data = codecs.open(gold_file, "r", "utf_8").read()
-
- if process is not None:
- output_data = process(output_data)
- gold_data = process(gold_data)
-
- if (not(gold_data == output_data)):
- diff_path = os.path.splitext(os.path.basename(output_file))[0]
- diff_path += "-Diff.txt"
- diff_file = codecs.open(diff_path, "wb", "utf_8")
- dffcmdlst = ["diff", output_file, gold_file]
- subprocess.call(dffcmdlst, stdout = diff_file)
- Errors.add_email_attachment(diff_path)
- msg = "There was a difference in "
- msg += os.path.basename(output_file) + ".\n"
- Errors.add_email_msg(msg)
- Errors.print_error(msg)
- return False
- else:
- return True
-
- def _html_report_diff(gold_report_path, output_report_path):
- """Compare the output and gold html reports.
-
- Args:
- gold_report_path: a pathto_Dir, the gold HTML report directory
- output_report_path: a pathto_Dir, the output HTML report directory
-
- Returns:
- true, if the reports match, false otherwise.
- """
- try:
- gold_html_files = get_files_by_ext(gold_report_path, ".html")
- output_html_files = get_files_by_ext(output_report_path, ".html")
-
- #ensure both reports have the same number of files and are in the same order
- if(len(gold_html_files) != len(output_html_files)):
- msg = "The reports did not have the same number or files."
- msg += "One of the reports may have been corrupted."
- Errors.print_error(msg)
- else:
- gold_html_files.sort()
- output_html_files.sort()
-
- total = {"Gold": 0, "New": 0}
- for gold, output in zip(gold_html_files, output_html_files):
- count = TestResultsDiffer._compare_report_files(gold, output)
- total["Gold"] += count[0]
- total["New"] += count[1]
-
- okay = "The test report matches the gold report."
- errors=["Gold report had " + str(total["Gold"]) +" errors", "New report had " + str(total["New"]) + " errors."]
- print_report(errors, "REPORT COMPARISON", okay)
-
- if total["Gold"] == total["New"]:
- return True
- else:
- Errors.print_error("The reports did not match each other.\n " + errors[0] +" and the " + errors[1])
- return False
- except OSError as e:
- e.print_error()
- return False
- except Exception as e:
- Errors.print_error("Error: Unknown fatal error comparing reports.")
- Errors.print_error(str(e) + "\n")
- logging.critical(traceback.format_exc())
- return False
-
- def _compare_report_files(a_path, b_path):
- """Compares the two specified report html files.
-
- Args:
- a_path: a pathto_File, the first html report file
- b_path: a pathto_File, the second html report file
-
- Returns:
- a tuple of (Nat, Nat), which represent the length of each
- unordered list in the html report files, or (0, 0) if the
- lenghts are the same.
- """
- a_file = open(a_path)
- b_file = open(b_path)
- a = a_file.read()
- b = b_file.read()
- a = a[a.find("