From a15750199b7bf871f196f651908a5ef6bda82845 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 18 Feb 2016 16:26:47 -0500 Subject: [PATCH 01/32] Moved towards allowing for the new filters, fixed UI pending approval --- .../interestingitems/Bundle.properties | 59 ++-- .../interestingitems/Bundle_ja.properties | 135 +++++--- .../modules/interestingitems/FilesSet.java | 213 ++++++++++-- .../interestingitems/FilesSetRulePanel.form | 195 ++++++++--- .../interestingitems/FilesSetRulePanel.java | 291 ++++++++++++---- .../InterestingItemDefsManager.java | 24 +- .../InterestingItemDefsPanel.form | 256 +++++++++----- .../InterestingItemDefsPanel.java | 324 ++++++++++++------ 8 files changed, 1057 insertions(+), 440 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 10dbc8140e..d4ffadc5aa 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -6,14 +6,6 @@ OptionsCategory_Name_InterestingItemDefinitions=Interesting Files OptionsCategory_Keywords_InterestingItemDefinitions=InterestingItemDefinitions InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. -InterestingItemDefsPanel.newSetButton.text=New Set -InterestingItemDefsPanel.editSetButton.text=Edit Set -InterestingItemDefsPanel.deleteSetButton.text=Delete Set -InterestingItemDefsPanel.newRuleButton.text=New Rule -InterestingItemDefsPanel.editRuleButton.text=Edit Rule -InterestingItemDefsPanel.deleteRuleButton.text=Delete Rule -InterestingItemDefsPanel.setsListLabel.text=Rule Sets -InterestingItemDefsPanel.rulesListLabel.text=Rules: FilesSetPanel.title=Interesting Files Set FilesSetPanel.messages.filesSetsMustBeNamed=Interesting files sets must be named. FilesSetPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files @@ -36,29 +28,40 @@ FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ? FilesSetRulePanel.messages.invalidPathRegex=The path regular expression is not valid:\n\n{0} FilesSetRulePanel.dirsRadioButton.text=Directories FilesSetRulePanel.filesRadioButton.text=Files -InterestingItemDefsPanel.bothRadioButton.text=Files and Directories -InterestingItemDefsPanel.dirsRadioButton.text=Directories -InterestingItemDefsPanel.filesRadioButton.text=Files -InterestingItemDefsPanel.fileNameRegexCheckbox.text=Regex -InterestingItemDefsPanel.fileNameExtensionRadioButton.text=Extension Only -InterestingItemDefsPanel.fileNameTextField.text= -InterestingItemDefsPanel.fileNameRadioButton.text=File Name InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists. FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories -InterestingItemDefsPanel.rulePathFilterTextField.text= -InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text=Regex -InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: -InterestingItemDefsPanel.jLabel1.text=Rule Details -InterestingItemDefsPanel.jLabel2.text=File Type: -InterestingItemDefsPanel.jLabel3.text=Name Pattern -InterestingItemDefsPanel.jLabel4.text=Path Pattern: -InterestingItemDefsPanel.jLabel5.text=Description: -InterestingItemDefsPanel.jLabel6.text=Set Details -FilesSetRulePanel.jLabel1.text=Type*\: -FilesSetRulePanel.jLabel2.text=Name Pattern*: +FilesSetRulePanel.jLabel1.text=Type: +FilesSetRulePanel.jLabel2.text=Name Pattern: FilesSetRulePanel.jLabel3.text=Path Pattern: -InterestingItemDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. -FilesSetRulePanel.jLabel4.text=* Required FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. +FilesSetRulePanel.jLabel6.text=MIME Type: +FilesSetRulePanel.jLabel7.text=File Size: +InterestingItemDefsPanel.jLabel6.text=Set Details +InterestingItemDefsPanel.jLabel8.text=File Size: +InterestingItemDefsPanel.jLabel7.text=MIME Type: +InterestingItemDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. +InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text=Regex +InterestingItemDefsPanel.jLabel4.text=Path Pattern: +InterestingItemDefsPanel.jLabel1.text=Rule Details +InterestingItemDefsPanel.dirsRadioButton.text=Directories +InterestingItemDefsPanel.jLabel2.text=File Type: +InterestingItemDefsPanel.newSetButton.text=New Set +InterestingItemDefsPanel.deleteRuleButton.text=Delete Rule +InterestingItemDefsPanel.deleteSetButton.text=Delete Set +InterestingItemDefsPanel.bothRadioButton.text=Files and Directories +InterestingItemDefsPanel.setsListLabel.text=Rule Sets +InterestingItemDefsPanel.fileNameRegexCheckbox.text=Regex +InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files +InterestingItemDefsPanel.rulePathFilterTextField.text= +InterestingItemDefsPanel.fileNameRadioButton.text=File Name +InterestingItemDefsPanel.jLabel5.text=Description: +InterestingItemDefsPanel.fileNameTextField.text= +InterestingItemDefsPanel.jLabel3.text=Name Pattern: +InterestingItemDefsPanel.fileNameExtensionRadioButton.text=Extension Only +InterestingItemDefsPanel.editSetButton.text=Edit Set +InterestingItemDefsPanel.rulesListLabel.text=Rules: +InterestingItemDefsPanel.editRuleButton.text=Edit Rule +InterestingItemDefsPanel.filesRadioButton.text=Files +InterestingItemDefsPanel.newRuleButton.text=New Rule diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 90c0f44998..c164bab02d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -1,59 +1,80 @@ -FilesIdentifierIngestJobSettingsPanel.border.title=\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u4E2D\u306B\u6709\u52B9\u306B\u3059\u308B\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u30BB\u30C3\u30C8\u3092\u9078\u629E\uFF1A +FilesIdentifierIngestJobSettingsPanel.border.title=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u4e2d\u306b\u6709\u52b9\u306b\u3059\u308b\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u3092\u9078\u629e\uff1a FilesSetPanel.descPanel.border.title=\u6982\u8981 FilesSetPanel.descriptionPanel.border.title=\u6982\u8981 -FilesSetPanel.ignoreKnownFilesCheckbox.text=\u65E2\u77E5\u30D5\u30A1\u30A4\u30EB\u3092\u7121\u8996 -FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u30BB\u30C3\u30C8\u306F\u540D\u524D\u304C\u5FC5\u8981\u3067\u3059\u3002 -FilesSetPanel.nameLabel.text=\u30BB\u30C3\u30C8\u540D\uFF1A -FilesSetPanel.title=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u30BB\u30C3\u30C8 -FilesSetRulePanel.dirsRadioButton.text=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA -FilesSetRulePanel.extensionRadioButton.text=\u62E1\u5F35\u5B50\u306E\u307F -FilesSetRulePanel.filesAndDirsRadioButton.text=\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA -FilesSetRulePanel.filesRadioButton.text=\u30D5\u30A1\u30A4\u30EB -FilesSetRulePanel.fullNameRadioButton.text=\u30D5\u30EB\u30CD\u30FC\u30E0 -FilesSetRulePanel.jLabel1.text=\u30BF\u30A4\u30D7*\uFF1A -FilesSetRulePanel.jLabel2.text=\u30CD\u30FC\u30E0\u30D1\u30BF\u30FC\u30F3*\uFF1A -FilesSetRulePanel.jLabel3.text=\u30D1\u30B9\u30D1\u30BF\u30FC\u30F3\uFF1A -FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306E\u30EB\u30FC\u30EB\u306F\u30CD\u30FC\u30E0\u30D1\u30BF\u30FC\u30F3\u3092\u7279\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 -FilesSetRulePanel.messages.invalidCharInName=\u6B63\u898F\u8868\u73FE\u4EE5\u5916\u306F\\\u3001/\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u540D\u524D\u306B\u542B\u3081\u307E\u305B\u3093\u3002 -FilesSetRulePanel.messages.invalidCharInPath=\u6B63\u898F\u8868\u73FE\u4EE5\u5916\u306F\\\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u30D1\u30B9\u306B\u542B\u3081\u307E\u305B\u3093\u3002 -FilesSetRulePanel.messages.invalidNameRegex=\u6B63\u898F\u8868\u73FE\u306F\u6709\u52B9\u306A\u540D\u524D\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF1A\n\n{0} -FilesSetRulePanel.messages.invalidPathRegex=\u6B63\u898F\u8868\u73FE\u306F\u6709\u52B9\u306A\u30D1\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF1A\n\n{0} -FilesSetRulePanel.nameRegexCheckbox.text=\u6B63\u898F\u8868\u73FE -FilesSetRulePanel.pathRegexCheckBox.text=\u6B63\u898F\u8868\u73FE -FilesSetRulePanel.pathSeparatorInfoLabel.text=/\u3092\u30D1\u30B9\u533A\u5207\u308A\u6587\u5B57\u3068\u3057\u3066\u5229\u7528 -FilesSetRulePanel.ruleNameLabel.text=\u30EB\u30FC\u30EB\u540D\uFF1A -FilesSetRulePanel.title=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u30BB\u30C3\u30C8\u30EB\u30FC\u30EB -InterestingItemDefsPanel.bothRadioButton.text=\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA -InterestingItemDefsPanel.deleteRuleButton.text=\u30EB\u30FC\u30EB\u3092\u524A\u9664 -InterestingItemDefsPanel.deleteSetButton.text=\u30BB\u30C3\u30C8\u3092\u524A\u9664 -InterestingItemDefsPanel.dirsRadioButton.text=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA -InterestingItemDefsPanel.editRuleButton.text=\u30EB\u30FC\u30EB\u3092\u7DE8\u96C6 -InterestingItemDefsPanel.editSetButton.text=\u30BB\u30C3\u30C8\u3092\u7DE8\u96C6 -InterestingItemDefsPanel.fileNameExtensionRadioButton.text=\u62E1\u5F35\u5B50\u306E\u307F -InterestingItemDefsPanel.fileNameRadioButton.text=\u30D5\u30A1\u30A4\u30EB\u540D -InterestingItemDefsPanel.fileNameRegexCheckbox.text=\u6B63\u898F\u8868\u73FE -InterestingItemDefsPanel.filesRadioButton.text=\u30D5\u30A1\u30A4\u30EB -InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=\u65E2\u77E5\u30D5\u30A1\u30A4\u30EB\u3092\u7121\u8996 -InterestingItemDefsPanel.jLabel1.text=\u30EB\u30FC\u30EB\u8A73\u7D30 -InterestingItemDefsPanel.jLabel2.text=\u30D5\u30A1\u30A4\u30EB\u30BF\u30A4\u30D7\uFF1A -InterestingItemDefsPanel.jLabel3.text=\u30CD\u30FC\u30E0\u30D1\u30BF\u30FC\u30F3 -InterestingItemDefsPanel.jLabel4.text=\u30D1\u30B9\u30D1\u30BF\u30FC\u30F3\uFF1A -InterestingItemDefsPanel.jLabel5.text=\u6982\u8981\uFF1A -InterestingItemDefsPanel.jLabel6.text=\u30BB\u30C3\u30C8\u8A73\u7D30 -InterestingItemDefsPanel.jTextArea1.text=\u6307\u5B9A\u3055\u308C\u305F\u6761\u4EF6\u3068\u4E00\u81F4\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u306E\u304C\u53EF\u80FD\u306A\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u3059\u3002\u5404\u30BB\u30C3\u30C8\u306B\u306F\u30D5\u30A1\u30A4\u30EB\u540D\u304A\u3088\u3073\u30DA\u30A2\u30EC\u30F3\u30C8\u30D1\u30B9\u30D1\u30BF\u30FC\u30F3\u3092\u3082\u3068\u306B\u4E00\u81F4\u3059\u308B\u3001\u30EB\u30FC\u30EB\u30EA\u30B9\u30C8\u304C\u3042\u308A\u307E\u3059\u3002 -InterestingItemDefsPanel.newRuleButton.text=\u65B0\u898F\u30EB\u30FC\u30EB -InterestingItemDefsPanel.newSetButton.text=\u65B0\u898F\u30BB\u30C3\u30C8 -InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text=\u6B63\u898F\u8868\u73FE -InterestingItemDefsPanel.rulesListLabel.text=\u30EB\u30FC\u30EB\uFF1A -InterestingItemDefsPanel.setsListLabel.text=\u30EB\u30FC\u30EB\u30BB\u30C3\u30C8 -InterestingItemsIdentifierIngestModule.moduleDescription=\u7591\u308F\u3057\u3044\u30A2\u30A4\u30C6\u30E0\u30EB\u30FC\u30EB\u30BB\u30C3\u30C8\u306E\u5B9A\u7FA9\u3092\u3082\u3068\u306B\u7591\u308F\u3057\u3044\u30A2\u30A4\u30C6\u30E0\u3092\u691C\u77E5\u3057\u307E\u3059\u3002 -InterestingItemsIdentifierIngestModule.moduleName=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u691C\u77E5 -OpenIDE-Module-Display-Category=\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB -OpenIDE-Module-Long-Description=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u691C\u77E5\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB\u3002\n\n\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u30EB\u30FC\u30EB\u30BB\u30C3\u30C8\u306E\u5B9A\u7FA9\u3092\u3082\u3068\u306B\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u77E5\u3057\u307E\u3059\u3002 -OpenIDE-Module-Name=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u691C\u77E5 -OpenIDE-Module-Short-Description=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB\u691C\u77E5\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u30E2\u30B8\u30E5\u30FC\u30EB -OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308F\u3057\u3044\u30D5\u30A1\u30A4\u30EB -OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308F\u3057\u3044\u30A2\u30A4\u30C6\u30E0\u5B9A\u7FA9 -InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540D\u524D\u304C{0}\u306E\u30EB\u30FC\u30EB\u30BB\u30C3\u30C8\u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059\u3002 -FilesSetRulePanel.jLabel4.text=*\u5FC5\u9808 -FilesSetRulePanel.jLabel5.text=\u898B\u3064\u3051\u305F\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u60C5\u5831\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002 \ No newline at end of file +FilesSetPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 +FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u306f\u540d\u524d\u304c\u5fc5\u8981\u3067\u3059\u3002 +FilesSetPanel.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a +FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8 +FilesSetRulePanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f +FilesSetRulePanel.filesAndDirsRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FilesSetRulePanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb +FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 +FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a +FilesSetRulePanel.jLabel2.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3*\uff1a +FilesSetRulePanel.jLabel3.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a +FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +FilesSetRulePanel.messages.invalidCharInName=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001/\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u540d\u524d\u306b\u542b\u3081\u307e\u305b\u3093\u3002 +FilesSetRulePanel.messages.invalidCharInPath=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u30d1\u30b9\u306b\u542b\u3081\u307e\u305b\u3093\u3002 +FilesSetRulePanel.messages.invalidNameRegex=\u6b63\u898f\u8868\u73fe\u306f\u6709\u52b9\u306a\u540d\u524d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff1a\n\n{0} +FilesSetRulePanel.messages.invalidPathRegex=\u6b63\u898f\u8868\u73fe\u306f\u6709\u52b9\u306a\u30d1\u30b9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff1a\n\n{0} +FilesSetRulePanel.nameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe +FilesSetRulePanel.pathRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +FilesSetRulePanel.pathSeparatorInfoLabel.text=/\u3092\u30d1\u30b9\u533a\u5207\u308a\u6587\u5b57\u3068\u3057\u3066\u5229\u7528 +FilesSetRulePanel.ruleNameLabel.text=\u30eb\u30fc\u30eb\u540d\uff1a +FilesSetRulePanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u30eb\u30fc\u30eb +InterestingItemsIdentifierIngestModule.moduleDescription=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306e\u5b9a\u7fa9\u3092\u3082\u3068\u306b\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u3092\u691c\u77e5\u3057\u307e\u3059\u3002 +InterestingItemsIdentifierIngestModule.moduleName=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u77e5 +OpenIDE-Module-Display-Category=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb +OpenIDE-Module-Long-Description=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u77e5\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb\u3002\n\n\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306e\u5b9a\u7fa9\u3092\u3082\u3068\u306b\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u77e5\u3057\u307e\u3059\u3002 +OpenIDE-Module-Name=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u77e5 +OpenIDE-Module-Short-Description=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u77e5\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb +OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb +OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u5b9a\u7fa9 +InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 +FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +InterestingItemDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 + +InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text=\u6b63\u898f\u8868\u73fe + +InterestingItemDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a + +InterestingItemDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 + +InterestingItemDefsPanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea + +InterestingItemDefsPanel.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a + +InterestingItemDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 + +InterestingItemDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 + +InterestingItemDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 + +InterestingItemDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea + +InterestingItemDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 + +InterestingItemDefsPanel.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe + +InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 + +InterestingItemDefsPanel.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d + +InterestingItemDefsPanel.jLabel5.text=\u6982\u8981\uff1a + +InterestingItemDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 + +InterestingItemDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f + +InterestingItemDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 + +InterestingItemDefsPanel.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a + +InterestingItemDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 + +InterestingItemDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb + +InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb + +InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index a1fb1fff66..7ea4d3a19d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -45,12 +45,12 @@ final class FilesSet { /** * Constructs an interesting files set. * - * @param name The name of the set. - * @param description A description of the set, may be null. + * @param name The name of the set. + * @param description A description of the set, may be null. * @param ignoreKnownFiles Whether or not to exclude known files from the - * set. - * @param rules The rules that define the set. May be null, but a - * set with no rules is the empty set. + * set. + * @param rules The rules that define the set. May be null, but a set with + * no rules is the empty set. */ FilesSet(String name, String description, boolean ignoreKnownFiles, Map rules) { if ((name == null) || (name.isEmpty())) { @@ -110,7 +110,7 @@ final class FilesSet { * @param file A file to test for set membership. * * @return The name of the first set membership rule satisfied by the file, - * will be null if the file does not belong to the set. + * will be null if the file does not belong to the set. */ String fileIsMemberOf(AbstractFile file) { if ((this.ignoreKnownFiles) && (file.getKnown() == TskData.FileKnown.KNOWN)) { @@ -140,31 +140,30 @@ final class FilesSet { private final String uuid; private final String ruleName; private final FileNameFilter fileNameFilter; - private final MetaTypeFilter metaTypeFilter; + private final MetaTypeCondition metaTypeFilter; private final ParentPathFilter pathFilter; - private final List filters = new ArrayList<>(); + private final MimeTypeCondition mimeTypeFilter; + private final FileSizeCondition fileSizeFilter; + private final List filters = new ArrayList<>(); /** * Construct an interesting files set membership rule. * - * @param ruleName The name of the rule. + * @param ruleName The name of the rule. * @param fileNameFilter A file name filter. * @param metaTypeFilter A file meta-type filter. - * @param pathFilter A file path filter, may be null. + * @param pathFilter A file path filter, may be null. */ - Rule(String ruleName, FileNameFilter fileNameFilter, MetaTypeFilter metaTypeFilter, ParentPathFilter pathFilter) { + Rule(String ruleName, FileNameFilter fileNameFilter, MetaTypeCondition metaTypeFilter, ParentPathFilter pathFilter, MimeTypeCondition mimeTypeFilter, FileSizeCondition fileSizeFilter) { // since ruleName is optional, ruleUUID can be used to uniquely identify a rule. this.uuid = UUID.randomUUID().toString(); - - if (ruleName == null) { - throw new IllegalArgumentException("Interesting files set rule name cannot be null"); - } - if (fileNameFilter == null) { - throw new IllegalArgumentException("Interesting files set rule file name filter cannot be null"); - } if (metaTypeFilter == null) { throw new IllegalArgumentException("Interesting files set rule meta-type filter cannot be null"); } + if (ruleName == null && fileNameFilter == null && mimeTypeFilter == null) { + throw new IllegalArgumentException("Must have at least one filter on rule."); + } + this.ruleName = ruleName; /* @@ -172,15 +171,28 @@ final class FilesSet { * fastest, so do it first */ this.metaTypeFilter = metaTypeFilter; - this.filters.add(this.metaTypeFilter); + if (this.metaTypeFilter != null) { + this.filters.add(this.metaTypeFilter); + } this.fileNameFilter = fileNameFilter; - this.filters.add(fileNameFilter); + if (this.fileNameFilter != null) { + this.filters.add(fileNameFilter); + } + this.mimeTypeFilter = mimeTypeFilter; + if (this.mimeTypeFilter != null) { + this.filters.add(mimeTypeFilter); + } this.pathFilter = pathFilter; if (this.pathFilter != null) { this.filters.add(this.pathFilter); } + + this.fileSizeFilter = fileSizeFilter; + if (this.fileSizeFilter != null) { + this.filters.add(this.fileSizeFilter); + } } /** @@ -206,7 +218,7 @@ final class FilesSet { * * @return A meta-type filter. */ - MetaTypeFilter getMetaTypeFilter() { + MetaTypeCondition getMetaTypeFilter() { return this.metaTypeFilter; } @@ -227,7 +239,7 @@ final class FilesSet { * @return True if the rule is satisfied, false otherwise. */ boolean isSatisfied(AbstractFile file) { - for (FileAttributeFilter filter : filters) { + for (FileAttributeCondition filter : filters) { if (!filter.passes(file)) { return false; } @@ -252,11 +264,18 @@ final class FilesSet { return this.uuid; } + /** + * @return the mimeTypeFilter + */ + public MimeTypeCondition getMimeTypeFilter() { + return mimeTypeFilter; + } + /** * An interface for the file attribute filters of which interesting * files set membership rules are composed. */ - static interface FileAttributeFilter { + static interface FileAttributeCondition { /** * Tests whether or not a file satisfies the conditions of a filter. @@ -268,12 +287,144 @@ final class FilesSet { boolean passes(AbstractFile file); } + /** + * A class for filtering files based upon their MIME types. + */ + static final class MimeTypeCondition implements FileAttributeCondition { + + private String mimeType; + + /** + * Constructs a MimeTypeFilter + * + * @param mimeType The mime type to filter for + */ + MimeTypeCondition(String mimeType) { + this.mimeType = mimeType; + } + + /** + * @inheritDoc + */ + @Override + public boolean passes(AbstractFile file) { + return this.mimeType.equals(file.getMIMEType()); + } + + /** + * Gets the mime type that is being filtered + * + * @return the mime type + */ + public String getMimeType() { + return this.mimeType; + } + + } + + static final class FileSizeCondition implements FileAttributeCondition { + + static enum COMPARATOR { + + LESS_THAN, + LESS_THAN_EQUAL, + EQUAL, + GREATER_THAN, + GREATER_THAN_EQUAL; + + public static COMPARATOR fromSymbol(String symbol) { + if (symbol.equals("<=") || symbol.equals("≤")) { + return LESS_THAN_EQUAL; + } + else if (symbol.equals("<")) { + return LESS_THAN; + } + else if (symbol.equals("==") || symbol.equals("=")) { + return EQUAL; + } + else if (symbol.equals(">")) { + return GREATER_THAN; + } + else if (symbol.equals(">=") || symbol.equals("≥")) { + return GREATER_THAN_EQUAL; + } + else { + throw new IllegalArgumentException("Invalid symbol"); + } + } + } + + static enum SIZE_UNIT { + + BYTE(1), + KILOBYTE(1024), + MEGABYTE(1024 * 1024), + GIGABYTE(1024 * 1024 * 1024); + private long size; + + private SIZE_UNIT(long size) { + this.size = size; + } + + public long getSize() { + return this.size; + } + + public static SIZE_UNIT fromName(String name) { + if (name.equals("Bytes")) { + return BYTE; + } + else if (name.equals("Kilobytes")) { + return KILOBYTE; + } + else if (name.equals("Megabytes")) { + return MEGABYTE; + } + else if (name.equals("Gigabytes")) { + return GIGABYTE; + } + else { + throw new IllegalArgumentException("Invalid symbol"); + } + } + } + private COMPARATOR comparator; + private SIZE_UNIT unit; + private int sizeValue; + + FileSizeCondition(COMPARATOR comparator, SIZE_UNIT uint, int sizeValue) { + this.comparator = comparator; + this.unit = unit; + this.sizeValue = sizeValue; + } + + @Override + public boolean passes(AbstractFile file) { + long fileSize = file.getSize(); + long filterSize = this.unit.getSize() * this.sizeValue; + switch (this.comparator) { + case GREATER_THAN: + return fileSize > filterSize; + case GREATER_THAN_EQUAL: + return fileSize >= filterSize; + case LESS_THAN_EQUAL: + return fileSize <= filterSize; + case LESS_THAN: + return fileSize < filterSize; + default: + return fileSize == filterSize; + + } + } + + } + /** * A file meta-type filter for an interesting files set membership rule. * The immutability of a meta-type filter object allows it to be safely * published to multiple threads. */ - static final class MetaTypeFilter implements FileAttributeFilter { + static final class MetaTypeCondition implements FileAttributeCondition { enum Type { @@ -289,7 +440,7 @@ final class FilesSet { * * @param metaType The meta-type to match, must. */ - MetaTypeFilter(Type type) { + MetaTypeCondition(Type type) { this.type = type; } @@ -312,7 +463,7 @@ final class FilesSet { /** * Gets the meta-type the filter matches. * - * @return A member of the MetaTypeFilter.Type enumeration. + * @return A member of the MetaTypeCondition.Type enumeration. */ Type getMetaType() { return this.type; @@ -322,7 +473,7 @@ final class FilesSet { /** * An interface for file attribute filters that do textual matching. */ - static interface TextFilter extends FileAttributeFilter { + static interface TextFilter extends FileAttributeCondition { /** * Gets the text the filter matches. @@ -336,7 +487,7 @@ final class FilesSet { * expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); @@ -396,7 +547,7 @@ final class FilesSet { * expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ @Override public boolean isRegex() { @@ -523,7 +674,7 @@ final class FilesSet { * Construct a file name extension regular expression filter. * * @param extension The file name extension regular expression to be - * matched. + * matched. */ ExtensionFilter(Pattern extension) { super(extension.pattern(), false); @@ -557,7 +708,7 @@ final class FilesSet { * expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index dbc69c5ac9..a4b0290c01 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -25,59 +25,77 @@ - - - + + + + + + - - - + + + + + - + - + - - - - - - - - + + + - + + - + - + - - - - - - + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - + @@ -85,41 +103,52 @@ - + - + - - - - - + + + + + - + - - - - - + + + + + - - + + + + + + + + + + + + + @@ -138,6 +167,9 @@ + + + @@ -257,13 +289,6 @@ - - - - - - - @@ -271,5 +296,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index f45b4e8287..c33350c4c3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -18,14 +18,22 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.SortedSet; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import org.apache.tika.mime.MediaType; +import org.apache.tika.mime.MimeTypes; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; /** * A panel that allows a user to create and edit interesting files set @@ -33,6 +41,14 @@ import org.sleuthkit.autopsy.coreutils.Logger; */ final class FilesSetRulePanel extends javax.swing.JPanel { + @Messages({ + "FilesSetRulePanel.bytes=Bytes", + "FilesSetRulePanel.kiloBytes=Kilobytes", + "FilesSetRulePanel.megaBytes=Megabytes", + "FilesSetRulePanel.gigaBytes=Gigabytes" + }) + + private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); private static final Logger logger = Logger.getLogger(FilesSetRulePanel.class.getName()); private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS private static final List ILLEGAL_FILE_NAME_CHARS = InterestingItemDefsManager.getIllegalFileNameChars(); @@ -44,6 +60,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSetRulePanel() { initComponents(); populateComponentsWithDefaultValues(); + customInit(); } /** @@ -57,6 +74,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { populateTypeFilterComponents(rule); populateNameFilterComponents(rule); populatePathFilterComponents(rule); + customInit(); } /** @@ -65,6 +83,38 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private void populateComponentsWithDefaultValues() { this.filesRadioButton.setSelected(true); this.fullNameRadioButton.setSelected(true); + this.equalitySymbolComboBox.setSelectedIndex(2); + this.fileSizeComboBox.setSelectedIndex(1); + } + + private void customInit() { + Set fileTypesCollated = new HashSet<>(); + for (MediaType mediaType : mediaTypes) { + fileTypesCollated.add(mediaType.toString()); + } + + FileTypeDetector fileTypeDetector; + try { + fileTypeDetector = new FileTypeDetector(); + List userDefinedFileTypes = fileTypeDetector.getUserDefinedTypes(); + fileTypesCollated.addAll(userDefinedFileTypes); + + } catch (FileTypeDetector.FileTypeDetectorInitException ex) { + logger.log(Level.SEVERE, "Unable to get user defined file types", ex); + } + + List toSort = new ArrayList<>(fileTypesCollated); + toSort.sort((String string1, String string2) -> { + int result = String.CASE_INSENSITIVE_ORDER.compare(string1, string2); + if (result == 0) { + result = string1.compareTo(string2); + } + return result; + }); + + for (String file : toSort) { + mimeTypeComboBox.addItem(file); + } } /** @@ -77,12 +127,12 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Populates the UI components that display the meta-type filter for a rule. + * Populates the UI components that display the meta-type condition for a rule. * * @param rule The files set rule to be edited. */ private void populateTypeFilterComponents(FilesSet.Rule rule) { - FilesSet.Rule.MetaTypeFilter typeFilter = rule.getMetaTypeFilter(); + FilesSet.Rule.MetaTypeCondition typeFilter = rule.getMetaTypeFilter(); switch (typeFilter.getMetaType()) { case FILES: this.filesRadioButton.setSelected(true); @@ -97,7 +147,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Populates the UI components that display the name filter for a rule. + * Populates the UI components that display the name condition for a rule. * * @param rule The files set rule to be edited. */ @@ -113,8 +163,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Populates the UI components that display the optional path filter for a - * rule. + * Populates the UI components that display the optional path condition for a + rule. * * @param rule The files set rule to be edited. */ @@ -135,7 +185,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { */ boolean isValidRuleDefinition() { - // The rule must have name filter text. + // The rule must have name condition text. if (this.nameTextField.getText().isEmpty()) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.emptyNameFilter"), @@ -144,7 +194,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { return false; } - // The name filter must either be a regular expression that compiles or + // The name condition must either be a regular expression that compiles or // a string without illegal file name chars. if (this.nameRegexCheckbox.isSelected()) { try { @@ -166,7 +216,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } } - // The path filter, if specified, must either be a regular expression + // The path condition, if specified, must either be a regular expression // that compiles or a string without illegal file path chars. if (!this.pathTextField.getText().isEmpty()) { if (this.pathRegexCheckBox.isSelected()) { @@ -203,12 +253,12 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Gets the name filter for the rule that was created or edited. Should only + * Gets the name condition for the rule that was created or edited. Should only * be called if isValidDefintion() returns true. * - * @return A name filter. + * @return A name condition. * - * @throws IllegalStateException if the specified name filter is not valid. + * @throws IllegalStateException if the specified name condition is not valid. */ FilesSet.Rule.FileNameFilter getFileNameFilter() throws IllegalStateException { FilesSet.Rule.FileNameFilter filter = null; @@ -242,27 +292,60 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Gets the file meta-type filter for the rule that was created or edited. + * Gets the mime type condition based upon the panel input * - * @return A type filter. + * @return the mime type condition, null if no condition is specified */ - FilesSet.Rule.MetaTypeFilter getMetaTypeFilter() { + FilesSet.Rule.MimeTypeCondition getMimeTypeCondition() { + FilesSet.Rule.MimeTypeCondition condition = null; + if (!this.mimeTypeComboBox.getSelectedItem().equals("")) { + condition = new FilesSet.Rule.MimeTypeCondition((String) this.mimeTypeComboBox.getSelectedItem()); + } + return condition; + } + + /** + * Gets the file size condition created based upon the panel input + * + * @return the file size condition, null if no condition is specified + */ + FilesSet.Rule.FileSizeCondition getFileSizeCondition() { + FilesSet.Rule.FileSizeCondition condition = null; + if ((Integer) this.fileSizeSpinner.getValue() != 0) { + try { + FilesSet.Rule.FileSizeCondition.COMPARATOR comparator = FilesSet.Rule.FileSizeCondition.COMPARATOR.fromSymbol((String) this.equalitySymbolComboBox.getSelectedItem()); + FilesSet.Rule.FileSizeCondition.SIZE_UNIT unit = FilesSet.Rule.FileSizeCondition.SIZE_UNIT.fromName((String) this.fileSizeComboBox.getSelectedItem()); + int fileSizeValue = (Integer) this.fileSizeSpinner.getValue(); + condition = new FilesSet.Rule.FileSizeCondition(comparator, unit, fileSizeValue); + } catch (IllegalArgumentException ex) { + //Swallowing up exception because if invalid data is given, this should return null + } + } + return condition; + } + + /** + * Gets the file meta-type condition for the rule that was created or edited. + * + * @return A type condition. + */ + FilesSet.Rule.MetaTypeCondition getMetaTypeFilter() { if (this.filesRadioButton.isSelected()) { - return new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.FILES); + return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } else if (this.dirsRadioButton.isSelected()) { - return new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.DIRECTORIES); + return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); } else { - return new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.FILES_AND_DIRECTORIES); + return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); } } /** - * Gets the optional path filter for the rule that was created or edited. + * Gets the optional path condition for the rule that was created or edited. * Should only be called if isValidDefintion() returns true. * - * @return A path filter or null if no path filter was specified. + * @return A path condition or null if no path condition was specified. * - * @throws IllegalStateException if the specified path filter is not valid. + * @throws IllegalStateException if the specified path condition is not valid. */ FilesSet.Rule.ParentPathFilter getPathFilter() throws IllegalStateException { FilesSet.Rule.ParentPathFilter filter = null; @@ -298,11 +381,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Checks an input string for the use of illegal characters. * - * @param toBeChecked The input string. + * @param toBeChecked The input string. * @param illegalChars The characters deemed to be illegal. * * @return True if the string does not contain illegal characters, false - * otherwise. + * otherwise. */ private static boolean containsOnlyLegalChars(String toBeChecked, List illegalChars) { for (String illegalChar : illegalChars) { @@ -314,15 +397,23 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Sets the state of the name filter UI components consistent with the state - * of the UI components in the type button group. + * Sets the state of the name condition UI components consistent with the state + of the UI components in the type button group. */ private void setComponentsForSearchType() { if (!this.filesRadioButton.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); + this.mimeTypeComboBox.setEnabled(false); + this.equalitySymbolComboBox.setEnabled(false); + this.fileSizeComboBox.setEnabled(false); + this.fileSizeSpinner.setEnabled(false); } else { this.extensionRadioButton.setEnabled(true); + this.mimeTypeComboBox.setEnabled(true); + this.equalitySymbolComboBox.setEnabled(true); + this.fileSizeComboBox.setEnabled(true); + this.fileSizeSpinner.setEnabled(true); } } @@ -352,12 +443,22 @@ final class FilesSetRulePanel extends javax.swing.JPanel { pathTextField = new javax.swing.JTextField(); pathRegexCheckBox = new javax.swing.JCheckBox(); pathSeparatorInfoLabel = new javax.swing.JLabel(); - jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); + mimeTypeComboBox = new javax.swing.JComboBox(); + equalitySymbolComboBox = new javax.swing.JComboBox(); + fileSizeComboBox = new javax.swing.JComboBox(); + fileSizeSpinner = new javax.swing.JSpinner(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N ruleNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameTextField.text")); // NOI18N + ruleNameTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ruleNameTextFieldActionPerformed(evt); + } + }); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel1.text")); // NOI18N @@ -403,13 +504,24 @@ final class FilesSetRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(pathRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathRegexCheckBox.text")); // NOI18N - pathSeparatorInfoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/info-icon-16.png"))); // NOI18N NON-NLS + pathSeparatorInfoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/info-icon-16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(pathSeparatorInfoLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathSeparatorInfoLabel.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel4.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel5.text")); // NOI18N + mimeTypeComboBox.setEditable(true); + mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + + equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + + fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); + + fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel6.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel7.text")); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -417,80 +529,102 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(jLabel7)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(filesRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(filesAndDirsRadioButton)))) .addGroup(layout.createSequentialGroup() - .addComponent(jLabel3) + .addComponent(jLabel5) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(ruleNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pathRegexCheckBox) - .addGap(45, 45, 45) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pathSeparatorInfoLabel)) - .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(ruleNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18)) + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1) - .addGap(27, 27, 27))) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(filesRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(dirsRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filesAndDirsRadioButton)) - .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addComponent(jLabel2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(nameTextField)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addGap(78, 78, 78) - .addComponent(fullNameRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(extensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(nameRegexCheckbox))) - .addComponent(jLabel4) - .addComponent(jLabel5)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(fullNameRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(extensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(nameRegexCheckbox))) + .addGap(0, 0, Short.MAX_VALUE))))) + .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel5) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 19, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(dirsRadioButton) .addComponent(filesRadioButton) + .addComponent(dirsRadioButton) .addComponent(filesAndDirsRadioButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fullNameRadioButton) .addComponent(extensionRadioButton) .addComponent(nameRegexCheckbox)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(pathSeparatorInfoLabel) - .addComponent(pathRegexCheckBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(pathRegexCheckBox) + .addComponent(pathSeparatorInfoLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel4)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addGap(19, 19, 19) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel7)) + .addContainerGap()) ); }// //GEN-END:initComponents @@ -506,17 +640,26 @@ final class FilesSetRulePanel extends javax.swing.JPanel { setComponentsForSearchType(); }//GEN-LAST:event_filesRadioButtonActionPerformed + private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_ruleNameTextFieldActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton dirsRadioButton; + private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; + private javax.swing.JComboBox fileSizeComboBox; + private javax.swing.JSpinner fileSizeSpinner; private javax.swing.JRadioButton filesAndDirsRadioButton; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.ButtonGroup nameButtonGroup; private javax.swing.JCheckBox nameRegexCheckbox; private javax.swing.JTextField nameTextField; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 781846cabe..4039974695 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -313,7 +313,7 @@ final class InterestingItemDefsManager extends Observable { } // Read in the type filter. - FilesSet.Rule.MetaTypeFilter metaTypeFilter = FilesSetXML.readMetaTypeFilter(elem); + FilesSet.Rule.MetaTypeCondition metaTypeFilter = FilesSetXML.readMetaTypeFilter(elem); if (metaTypeFilter == null) { // Malformed attribute. return null; @@ -331,7 +331,7 @@ final class InterestingItemDefsManager extends Observable { } } - return new FilesSet.Rule(ruleName, nameFilter, metaTypeFilter, pathFilter); + return new FilesSet.Rule(ruleName, nameFilter, metaTypeFilter, pathFilter, null, null); } /** @@ -372,7 +372,7 @@ final class InterestingItemDefsManager extends Observable { // The rule must have a meta-type filter, unless a TSK Framework // definitions file is being read. - FilesSet.Rule.MetaTypeFilter metaTypeFilter = null; + FilesSet.Rule.MetaTypeCondition metaTypeFilter = null; if (!elem.getAttribute(FilesSetXML.TYPE_FILTER_ATTR).isEmpty()) { metaTypeFilter = FilesSetXML.readMetaTypeFilter(elem); if (metaTypeFilter == null) { @@ -380,7 +380,7 @@ final class InterestingItemDefsManager extends Observable { return null; } } else { - metaTypeFilter = new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.FILES); + metaTypeFilter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } // The rule may have a path filter. Null is o.k., but if the attribute @@ -395,7 +395,7 @@ final class InterestingItemDefsManager extends Observable { } } - return new FilesSet.Rule(ruleName, extFilter, metaTypeFilter, pathFilter); + return new FilesSet.Rule(ruleName, extFilter, metaTypeFilter, pathFilter, null, null); } /** @@ -435,19 +435,19 @@ final class InterestingItemDefsManager extends Observable { * * @return The meta-type filter, or null if there is an error (logged). */ - private static FilesSet.Rule.MetaTypeFilter readMetaTypeFilter(Element ruleElement) { - FilesSet.Rule.MetaTypeFilter filter = null; + private static FilesSet.Rule.MetaTypeCondition readMetaTypeFilter(Element ruleElement) { + FilesSet.Rule.MetaTypeCondition filter = null; String filterAttribute = ruleElement.getAttribute(FilesSetXML.TYPE_FILTER_ATTR); if (!filterAttribute.isEmpty()) { switch (filterAttribute) { case FilesSetXML.TYPE_FILTER_VALUE_FILES: - filter = new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.FILES); + filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); break; case FilesSetXML.TYPE_FILTER_VALUE_DIRS: - filter = new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.DIRECTORIES); + filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); break; case FilesSetXML.TYPE_FILTER_VALUE_FILES_AND_DIRS: - filter = new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.FILES_AND_DIRECTORIES); + filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); break; default: logger.log(Level.SEVERE, "Found {0} " + FilesSetXML.TYPE_FILTER_ATTR + " attribute with unrecognized value ''{0}'', ignoring malformed rule definition", filterAttribute); // NON-NLS @@ -456,7 +456,7 @@ final class InterestingItemDefsManager extends Observable { } else { // Accept TSK Framework interesting files set definitions, // default to files. - filter = new FilesSet.Rule.MetaTypeFilter(FilesSet.Rule.MetaTypeFilter.Type.FILES); + filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } return filter; } @@ -534,7 +534,7 @@ final class InterestingItemDefsManager extends Observable { ruleElement.setAttribute(FilesSetXML.REGEX_ATTR, Boolean.toString(nameFilter.isRegex())); // Add the type filter attribute. - FilesSet.Rule.MetaTypeFilter typeFilter = rule.getMetaTypeFilter(); + FilesSet.Rule.MetaTypeCondition typeFilter = rule.getMetaTypeFilter(); switch (typeFilter.getMetaType()) { case FILES: ruleElement.setAttribute(FilesSetXML.TYPE_FILTER_ATTR, FilesSetXML.TYPE_FILTER_VALUE_FILES); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 6b92c6b39f..7f78c98257 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -28,17 +28,16 @@ - - + - - + + @@ -68,80 +67,114 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + - - - - - - + + + + + + + + + + + - + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - + + + + - + @@ -149,27 +182,26 @@ - - - + + - + - + - + - + @@ -196,22 +228,37 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -700,6 +747,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index caa6098f55..5a34363ac8 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -20,25 +20,45 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.awt.EventQueue; import java.awt.Font; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.SortedSet; import java.util.TreeMap; +import java.util.logging.Level; import javax.swing.DefaultListModel; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.apache.tika.mime.MediaType; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel; +import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; +import org.apache.tika.mime.MediaType; +import org.apache.tika.mime.MimeTypes; +import org.sleuthkit.autopsy.coreutils.Logger; + /** * A panel that allows a user to make interesting item definitions. */ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { + @NbBundle.Messages({ + "InterestingItemDefsPanel.bytes=Bytes", + "InterestingItemDefsPanel.kiloBytes=Kilobytes", + "InterestingItemDefsPanel.megaBytes=Megabytes", + "InterestingItemDefsPanel.gigaBytes=Gigabytes" + }) + private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); private final DefaultListModel setsListModel = new DefaultListModel<>(); private final DefaultListModel rulesListModel = new DefaultListModel<>(); + private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName()); // The following is a map of interesting files set names to interesting // files set definitions. It is a snapshot of the files set definitions @@ -54,11 +74,44 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp */ InterestingItemDefsPanel() { this.initComponents(); + this.customInit(); this.setsList.setModel(setsListModel); this.setsList.addListSelectionListener(new InterestingItemDefsPanel.SetsListSelectionListener()); this.rulesList.setModel(rulesListModel); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); } + + private void customInit() { + Set fileTypesCollated = new HashSet<>(); + for (MediaType mediaType : mediaTypes) { + fileTypesCollated.add(mediaType.toString()); + } + + FileTypeDetector fileTypeDetector; + try { + fileTypeDetector = new FileTypeDetector(); + List userDefinedFileTypes = fileTypeDetector.getUserDefinedTypes(); + fileTypesCollated.addAll(userDefinedFileTypes); + + } catch (FileTypeDetector.FileTypeDetectorInitException ex) { + logger.log(Level.SEVERE, "Unable to get user defined file types", ex); + } + + List toSort = new ArrayList<>(fileTypesCollated); + toSort.sort((String string1, String string2) -> { + int result = String.CASE_INSENSITIVE_ORDER.compare(string1, string2); + if (result == 0) { + result = string1.compareTo(string2); + } + return result; + }); + + for (String file : toSort) { + mimeTypeComboBox.addItem(file); + } + this.fileSizeUnitComboBox.setSelectedIndex(1); + this.equalitySignComboBox.setSelectedIndex(2); + } /** * @inheritDoc @@ -191,8 +244,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp if (rule != null) { // Get the filters that make up the rule. FilesSet.Rule.FileNameFilter nameFilter = rule.getFileNameFilter(); - FilesSet.Rule.MetaTypeFilter typeFilter = rule.getMetaTypeFilter(); + FilesSet.Rule.MetaTypeCondition typeFilter = rule.getMetaTypeFilter(); FilesSet.Rule.ParentPathFilter pathFilter = rule.getPathFilter(); + FilesSet.Rule.MimeTypeCondition mimeTypeFilter = rule.getMimeTypeFilter(); // Populate the components that display the properties of the // selected rule. @@ -218,6 +272,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp InterestingItemDefsPanel.this.rulePathFilterTextField.setText(""); InterestingItemDefsPanel.this.rulePathFilterRegexCheckBox.setSelected(false); } + InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeFilter.getMimeType()); // Enable the new, edit and delete rule buttons. InterestingItemDefsPanel.this.newRuleButton.setEnabled(true); @@ -316,7 +371,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp if (selectedRule != null) { rules.remove(selectedRule.getUuid()); } - FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameFilter(), panel.getMetaTypeFilter(), panel.getPathFilter()); + FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameFilter(), panel.getMetaTypeFilter(), panel.getPathFilter(), panel.getMimeTypeCondition(), panel.getFileSizeCondition()); rules.put(newRule.getUuid(), newRule); // Add the new/edited files set definition, replacing any previous @@ -388,12 +443,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp editRuleButton = new javax.swing.JButton(); rulesListLabel = new javax.swing.JLabel(); rulesListScrollPane = new javax.swing.JScrollPane(); - rulesList = new javax.swing.JList<>(); + rulesList = new javax.swing.JList(); setDescScrollPanel = new javax.swing.JScrollPane(); setDescriptionTextArea = new javax.swing.JTextArea(); editSetButton = new javax.swing.JButton(); setsListScrollPane = new javax.swing.JScrollPane(); - setsList = new javax.swing.JList<>(); + setsList = new javax.swing.JList(); fileNameExtensionRadioButton = new javax.swing.JRadioButton(); jLabel3 = new javax.swing.JLabel(); fileNameTextField = new javax.swing.JTextField(); @@ -415,6 +470,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp rulePathFilterRegexCheckBox = new javax.swing.JCheckBox(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); + jLabel7 = new javax.swing.JLabel(); + mimeTypeComboBox = new javax.swing.JComboBox(); + jLabel8 = new javax.swing.JLabel(); + equalitySignComboBox = new javax.swing.JComboBox(); + jSpinner1 = new javax.swing.JSpinner(); + fileSizeUnitComboBox = new javax.swing.JComboBox(); setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -594,96 +655,138 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jTextArea1.setWrapStyleWord(true); jScrollPane2.setViewportView(jTextArea1); + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel7.text")); // NOI18N + + mimeTypeComboBox.setEditable(true); + mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + mimeTypeComboBox.setEnabled(false); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel8.text")); // NOI18N + + equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + equalitySignComboBox.setEnabled(false); + + jSpinner1.setEnabled(false); + + fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); + fileSizeUnitComboBox.setEnabled(false); + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setsListLabel) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(deleteSetButton))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(10, 10, 10) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rulesListLabel) - .addComponent(jLabel5) - .addComponent(ignoreKnownFilesCheckbox) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel2) - .addComponent(jLabel1)) - .addGap(18, 18, 18) - .addComponent(filesRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(bothRadioButton)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(9, 9, 9) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(2, 2, 2) - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(346, 346, 346) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel2) + .addComponent(jLabel1))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setsListLabel) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(setsListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(fileNameRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileNameExtensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileNameRegexCheckbox)) - .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(deleteSetButton))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(22, 22, 22) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rulePathFilterRegexCheckBox) - .addComponent(rulePathFilterTextField))))) + .addComponent(filesRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(bothRadioButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(fileNameRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileNameExtensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileNameRegexCheckbox)) + .addComponent(rulePathFilterRegexCheckBox))) .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(354, 354, 354) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(rulePathFilterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeUnitComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) + .addComponent(rulesListLabel)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) + .addComponent(jLabel5)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) + .addComponent(ignoreKnownFilesCheckbox)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) + .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) + .addComponent(jLabel6)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(346, 346, 346) .addComponent(newRuleButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGap(18, 18, 18) .addComponent(editRuleButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGap(18, 18, 18) .addComponent(deleteRuleButton)) - .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel6) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(354, 354, 354) + .addComponent(jLabel4))) + .addContainerGap(26, Short.MAX_VALUE)) ); + + jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {fileNameTextField, mimeTypeComboBox, rulePathFilterTextField}); + jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel6) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ignoreKnownFilesCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rulesListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newRuleButton) .addComponent(editRuleButton) .addComponent(deleteRuleButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) .addGap(2, 2, 2) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -705,19 +808,31 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addComponent(jLabel4) .addComponent(rulePathFilterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rulePathFilterRegexCheckBox)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(setsListLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(rulePathFilterRegexCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newSetButton) - .addComponent(editSetButton) - .addComponent(deleteSetButton)))) - .addContainerGap()) + .addComponent(jLabel7) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(9, 9, 9) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8) + .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(setsListLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(newSetButton) + .addComponent(editSetButton) + .addComponent(deleteSetButton))))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, newRuleButton, newSetButton}); @@ -729,33 +844,36 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 710, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(0, 20, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(0, 11, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 468, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 468, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 11, Short.MAX_VALUE)) ); }// //GEN-END:initComponents + private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_dirsRadioButtonActionPerformed + private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed this.doFileSetsDialog(null); }//GEN-LAST:event_newSetButtonActionPerformed - private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed - this.doFileSetsDialog(this.setsList.getSelectedValue()); - }//GEN-LAST:event_editSetButtonActionPerformed - - private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newRuleButtonActionPerformed - this.doFilesSetRuleDialog(null); - }//GEN-LAST:event_newRuleButtonActionPerformed - - private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editRuleButtonActionPerformed - this.doFilesSetRuleDialog(this.rulesList.getSelectedValue()); - }//GEN-LAST:event_editRuleButtonActionPerformed + private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteRuleButtonActionPerformed + // Interesting file sets are immutable for thread safety, + // so editing a files set rule definition is a replacement + // operation. Preserve the existing rules from the set being + // edited, except for the deleted rule. + FilesSet oldSet = this.setsList.getSelectedValue(); + Map rules = new HashMap<>(oldSet.getRules()); + FilesSet.Rule selectedRule = this.rulesList.getSelectedValue(); + rules.remove(selectedRule.getUuid()); + this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules); + }//GEN-LAST:event_deleteRuleButtonActionPerformed private void deleteSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSetButtonActionPerformed FilesSet selectedSet = this.setsList.getSelectedValue(); @@ -771,25 +889,21 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp } }//GEN-LAST:event_deleteSetButtonActionPerformed - private void deleteRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteRuleButtonActionPerformed - // Interesting file sets are immutable for thread safety, - // so editing a files set rule definition is a replacement - // operation. Preserve the existing rules from the set being - // edited, except for the deleted rule. - FilesSet oldSet = this.setsList.getSelectedValue(); - Map rules = new HashMap<>(oldSet.getRules()); - FilesSet.Rule selectedRule = this.rulesList.getSelectedValue(); - rules.remove(selectedRule.getUuid()); - this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules); - }//GEN-LAST:event_deleteRuleButtonActionPerformed - private void ignoreKnownFilesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ignoreKnownFilesCheckboxActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ignoreKnownFilesCheckboxActionPerformed - private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_dirsRadioButtonActionPerformed + private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed + this.doFileSetsDialog(this.setsList.getSelectedValue()); + }//GEN-LAST:event_editSetButtonActionPerformed + + private void editRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editRuleButtonActionPerformed + this.doFilesSetRuleDialog(this.rulesList.getSelectedValue()); + }//GEN-LAST:event_editRuleButtonActionPerformed + + private void newRuleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newRuleButtonActionPerformed + this.doFilesSetRuleDialog(null); + }//GEN-LAST:event_newRuleButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton bothRadioButton; @@ -798,11 +912,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JRadioButton dirsRadioButton; private javax.swing.JButton editRuleButton; private javax.swing.JButton editSetButton; + private javax.swing.JComboBox equalitySignComboBox; private javax.swing.ButtonGroup fileNameButtonGroup; private javax.swing.JRadioButton fileNameExtensionRadioButton; private javax.swing.JRadioButton fileNameRadioButton; private javax.swing.JCheckBox fileNameRegexCheckbox; private javax.swing.JTextField fileNameTextField; + private javax.swing.JComboBox fileSizeUnitComboBox; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JCheckBox ignoreKnownFilesCheckbox; private javax.swing.JLabel jLabel1; @@ -811,10 +927,14 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JSpinner jSpinner1; private javax.swing.JTextArea jTextArea1; + private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JButton newRuleButton; private javax.swing.JButton newSetButton; private javax.swing.JCheckBox rulePathFilterRegexCheckBox; From 730ee53fc74784ece89af97c400069342bf1ea59 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 18 Feb 2016 17:23:58 -0500 Subject: [PATCH 02/32] filter -> condition --- .../interestingitems/Bundle.properties | 6 +- .../interestingitems/Bundle_ja.properties | 3 +- .../modules/interestingitems/FilesSet.java | 272 +++++++++--------- .../interestingitems/FilesSetRulePanel.java | 76 ++--- .../InterestingItemDefsManager.java | 132 ++++----- .../InterestingItemDefsPanel.form | 20 +- .../InterestingItemDefsPanel.java | 68 ++--- 7 files changed, 292 insertions(+), 285 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index d4ffadc5aa..8b16637fc3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -21,7 +21,7 @@ FilesSetRulePanel.nameRegexCheckbox.text=Regex FilesSetRulePanel.ruleNameTextField.text= FilesSetRulePanel.nameTextField.text= FilesSetRulePanel.ruleNameLabel.text=Rule Name: -FilesSetRulePanel.messages.emptyNameFilter=You must specify a name pattern for this rule. +FilesSetRulePanel.messages.emptyNameCondition=You must specify a name pattern for this rule. FilesSetRulePanel.messages.invalidNameRegex=The name regular expression is not valid:\n\n{0} FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ?, \", <, or > unless it is a regular expression. @@ -42,7 +42,6 @@ InterestingItemDefsPanel.jLabel6.text=Set Details InterestingItemDefsPanel.jLabel8.text=File Size: InterestingItemDefsPanel.jLabel7.text=MIME Type: InterestingItemDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. -InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text=Regex InterestingItemDefsPanel.jLabel4.text=Path Pattern: InterestingItemDefsPanel.jLabel1.text=Rule Details InterestingItemDefsPanel.dirsRadioButton.text=Directories @@ -54,7 +53,6 @@ InterestingItemDefsPanel.bothRadioButton.text=Files and Directories InterestingItemDefsPanel.setsListLabel.text=Rule Sets InterestingItemDefsPanel.fileNameRegexCheckbox.text=Regex InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files -InterestingItemDefsPanel.rulePathFilterTextField.text= InterestingItemDefsPanel.fileNameRadioButton.text=File Name InterestingItemDefsPanel.jLabel5.text=Description: InterestingItemDefsPanel.fileNameTextField.text= @@ -65,3 +63,5 @@ InterestingItemDefsPanel.rulesListLabel.text=Rules: InterestingItemDefsPanel.editRuleButton.text=Edit Rule InterestingItemDefsPanel.filesRadioButton.text=Files InterestingItemDefsPanel.newRuleButton.text=New Rule +InterestingItemDefsPanel.rulePathConditionTextField.text= +InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index c164bab02d..90793dce8e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -35,8 +35,6 @@ InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u30 FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 InterestingItemDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 -InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text=\u6b63\u898f\u8868\u73fe - InterestingItemDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a InterestingItemDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 @@ -78,3 +76,4 @@ InterestingItemDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 +InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 7ea4d3a19d..0e8fff948b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -35,8 +36,9 @@ import org.sleuthkit.datamodel.TskData; * Interesting files set definition objects are immutable, so they may be safely * published to multiple threads. */ -final class FilesSet { +final class FilesSet implements Serializable { + private static final long serialVersionUID = 1L; private final String name; private final String description; private final boolean ignoreKnownFiles; @@ -135,33 +137,34 @@ final class FilesSet { * A set membership rule for an interesting files set. The immutability of a * rule object allows it to be safely published to multiple threads. */ - static class Rule { + static class Rule implements Serializable { + private static final long serialVersionUID = 1L; private final String uuid; private final String ruleName; - private final FileNameFilter fileNameFilter; - private final MetaTypeCondition metaTypeFilter; - private final ParentPathFilter pathFilter; - private final MimeTypeCondition mimeTypeFilter; - private final FileSizeCondition fileSizeFilter; - private final List filters = new ArrayList<>(); + private final FileNameCondition fileNameCondition; + private final MetaTypeCondition metaTypeCondition; + private final ParentPathCondition pathCondition; + private final MimeTypeCondition mimeTypeCondition; + private final FileSizeCondition fileSizeCondition; + private final List conditions = new ArrayList<>(); /** * Construct an interesting files set membership rule. * * @param ruleName The name of the rule. - * @param fileNameFilter A file name filter. - * @param metaTypeFilter A file meta-type filter. - * @param pathFilter A file path filter, may be null. + * @param fileNameCondition A file name condition. + * @param metaTypeCondition A file meta-type condition. + * @param pathCondition A file path condition, may be null. */ - Rule(String ruleName, FileNameFilter fileNameFilter, MetaTypeCondition metaTypeFilter, ParentPathFilter pathFilter, MimeTypeCondition mimeTypeFilter, FileSizeCondition fileSizeFilter) { + Rule(String ruleName, FileNameCondition fileNameCondition, MetaTypeCondition metaTypeCondition, ParentPathCondition pathCondition, MimeTypeCondition mimeTypeCondition, FileSizeCondition fileSizeCondition) { // since ruleName is optional, ruleUUID can be used to uniquely identify a rule. this.uuid = UUID.randomUUID().toString(); - if (metaTypeFilter == null) { - throw new IllegalArgumentException("Interesting files set rule meta-type filter cannot be null"); + if (metaTypeCondition == null) { + throw new IllegalArgumentException("Interesting files set rule meta-type condition cannot be null"); } - if (ruleName == null && fileNameFilter == null && mimeTypeFilter == null) { - throw new IllegalArgumentException("Must have at least one filter on rule."); + if (ruleName == null && fileNameCondition == null && mimeTypeCondition == null) { + throw new IllegalArgumentException("Must have at least one condition on rule."); } this.ruleName = ruleName; @@ -170,28 +173,28 @@ final class FilesSet { * The rules are evaluated in the order added. MetaType check is * fastest, so do it first */ - this.metaTypeFilter = metaTypeFilter; - if (this.metaTypeFilter != null) { - this.filters.add(this.metaTypeFilter); + this.metaTypeCondition = metaTypeCondition; + if (this.metaTypeCondition != null) { + this.conditions.add(this.metaTypeCondition); } - this.fileNameFilter = fileNameFilter; - if (this.fileNameFilter != null) { - this.filters.add(fileNameFilter); + this.fileNameCondition = fileNameCondition; + if (this.fileNameCondition != null) { + this.conditions.add(fileNameCondition); } - this.mimeTypeFilter = mimeTypeFilter; - if (this.mimeTypeFilter != null) { - this.filters.add(mimeTypeFilter); + this.mimeTypeCondition = mimeTypeCondition; + if (this.mimeTypeCondition != null) { + this.conditions.add(mimeTypeCondition); } - this.pathFilter = pathFilter; - if (this.pathFilter != null) { - this.filters.add(this.pathFilter); + this.pathCondition = pathCondition; + if (this.pathCondition != null) { + this.conditions.add(this.pathCondition); } - - this.fileSizeFilter = fileSizeFilter; - if (this.fileSizeFilter != null) { - this.filters.add(this.fileSizeFilter); + + this.fileSizeCondition = fileSizeCondition; + if (this.fileSizeCondition != null) { + this.conditions.add(this.fileSizeCondition); } } @@ -205,30 +208,30 @@ final class FilesSet { } /** - * Get the file name filter for the rule. + * Get the file name condition for the rule. * - * @return A file name filter. + * @return A file name condition. */ - FileNameFilter getFileNameFilter() { - return this.fileNameFilter; + FileNameCondition getFileNameCondition() { + return this.fileNameCondition; } /** - * Get the meta-type filter for the rule. + * Get the meta-type condition for the rule. * - * @return A meta-type filter. + * @return A meta-type condition. */ - MetaTypeCondition getMetaTypeFilter() { - return this.metaTypeFilter; + MetaTypeCondition getMetaTypeCondition() { + return this.metaTypeCondition; } /** - * Get the path filter for the rule. + * Get the path condition for the rule. * - * @return A path filter, may be null. + * @return A path condition, may be null. */ - ParentPathFilter getPathFilter() { - return this.pathFilter; + ParentPathCondition getPathCondition() { + return this.pathCondition; } /** @@ -239,8 +242,8 @@ final class FilesSet { * @return True if the rule is satisfied, false otherwise. */ boolean isSatisfied(AbstractFile file) { - for (FileAttributeCondition filter : filters) { - if (!filter.passes(file)) { + for (FileAttributeCondition condition : conditions) { + if (!condition.passes(file)) { return false; } } @@ -254,7 +257,7 @@ final class FilesSet { public String toString() { // This override is designed to provide a display name for use with // javax.swing.DefaultListModel. - return this.ruleName + " (" + fileNameFilter.getTextToMatch() + ")"; + return this.ruleName + " (" + fileNameCondition.getTextToMatch() + ")"; } /** @@ -265,20 +268,21 @@ final class FilesSet { } /** - * @return the mimeTypeFilter + * @return the mimeTypeCondition */ - public MimeTypeCondition getMimeTypeFilter() { - return mimeTypeFilter; + public MimeTypeCondition getMimeTypeCondition() { + return mimeTypeCondition; } /** - * An interface for the file attribute filters of which interesting + * An interface for the file attribute conditions of which interesting * files set membership rules are composed. */ - static interface FileAttributeCondition { + static interface FileAttributeCondition extends Serializable { /** - * Tests whether or not a file satisfies the conditions of a filter. + * Tests whether or not a file satisfies the conditions of a + * condition. * * @param file The file to test. * @@ -288,16 +292,17 @@ final class FilesSet { } /** - * A class for filtering files based upon their MIME types. + * A class for checking files based upon their MIME types. */ static final class MimeTypeCondition implements FileAttributeCondition { + private static final long serialVersionUID = 1L; private String mimeType; /** - * Constructs a MimeTypeFilter + * Constructs a MimeTypeCondition * - * @param mimeType The mime type to filter for + * @param mimeType The mime type to condition for */ MimeTypeCondition(String mimeType) { this.mimeType = mimeType; @@ -312,7 +317,7 @@ final class FilesSet { } /** - * Gets the mime type that is being filtered + * Gets the mime type that is being checked * * @return the mime type */ @@ -324,6 +329,8 @@ final class FilesSet { static final class FileSizeCondition implements FileAttributeCondition { + private static final long serialVersionUID = 1L; + static enum COMPARATOR { LESS_THAN, @@ -331,24 +338,19 @@ final class FilesSet { EQUAL, GREATER_THAN, GREATER_THAN_EQUAL; - + public static COMPARATOR fromSymbol(String symbol) { if (symbol.equals("<=") || symbol.equals("≤")) { return LESS_THAN_EQUAL; - } - else if (symbol.equals("<")) { + } else if (symbol.equals("<")) { return LESS_THAN; - } - else if (symbol.equals("==") || symbol.equals("=")) { + } else if (symbol.equals("==") || symbol.equals("=")) { return EQUAL; - } - else if (symbol.equals(">")) { + } else if (symbol.equals(">")) { return GREATER_THAN; - } - else if (symbol.equals(">=") || symbol.equals("≥")) { + } else if (symbol.equals(">=") || symbol.equals("≥")) { return GREATER_THAN_EQUAL; - } - else { + } else { throw new IllegalArgumentException("Invalid symbol"); } } @@ -369,21 +371,17 @@ final class FilesSet { public long getSize() { return this.size; } - + public static SIZE_UNIT fromName(String name) { if (name.equals("Bytes")) { return BYTE; - } - else if (name.equals("Kilobytes")) { + } else if (name.equals("Kilobytes")) { return KILOBYTE; - } - else if (name.equals("Megabytes")) { + } else if (name.equals("Megabytes")) { return MEGABYTE; - } - else if (name.equals("Gigabytes")) { + } else if (name.equals("Gigabytes")) { return GIGABYTE; - } - else { + } else { throw new IllegalArgumentException("Invalid symbol"); } } @@ -401,18 +399,18 @@ final class FilesSet { @Override public boolean passes(AbstractFile file) { long fileSize = file.getSize(); - long filterSize = this.unit.getSize() * this.sizeValue; + long conditionSize = this.unit.getSize() * this.sizeValue; switch (this.comparator) { case GREATER_THAN: - return fileSize > filterSize; + return fileSize > conditionSize; case GREATER_THAN_EQUAL: - return fileSize >= filterSize; + return fileSize >= conditionSize; case LESS_THAN_EQUAL: - return fileSize <= filterSize; + return fileSize <= conditionSize; case LESS_THAN: - return fileSize < filterSize; + return fileSize < conditionSize; default: - return fileSize == filterSize; + return fileSize == conditionSize; } } @@ -420,12 +418,14 @@ final class FilesSet { } /** - * A file meta-type filter for an interesting files set membership rule. - * The immutability of a meta-type filter object allows it to be safely - * published to multiple threads. + * A file meta-type condition for an interesting files set membership + * rule. The immutability of a meta-type condition object allows it to + * be safely published to multiple threads. */ static final class MetaTypeCondition implements FileAttributeCondition { + private static final long serialVersionUID = 1L; + enum Type { FILES, @@ -436,7 +436,7 @@ final class FilesSet { private final Type type; /** - * Construct a meta-type filter. + * Construct a meta-type condition. * * @param metaType The meta-type to match, must. */ @@ -461,7 +461,7 @@ final class FilesSet { } /** - * Gets the meta-type the filter matches. + * Gets the meta-type the condition matches. * * @return A member of the MetaTypeCondition.Type enumeration. */ @@ -471,20 +471,20 @@ final class FilesSet { } /** - * An interface for file attribute filters that do textual matching. + * An interface for file attribute conditions that do textual matching. */ - static interface TextFilter extends FileAttributeCondition { + static interface TextCondition extends FileAttributeCondition { /** - * Gets the text the filter matches. + * Gets the text the condition matches. * * @return The text. */ String getTextToMatch(); /** - * Queries whether or not the text the filter matches is a regular - * expression. + * Queries whether or not the text the condition matches is a + * regular expression. * * @return True if the text to be matched is a regular expression, * false otherwise. @@ -492,7 +492,7 @@ final class FilesSet { boolean isRegex(); /** - * Determines whether a string of text matches the filter. + * Determines whether a string of text matches the condition. * * @param textToMatch The text string. * @@ -503,19 +503,20 @@ final class FilesSet { } /** - * An abstract base class for file attribute filters that do textual + * An abstract base class for file attribute conditions that do textual * matching. */ - private static abstract class AbstractTextFilter implements TextFilter { + private static abstract class AbstractTextCondition implements TextCondition { + private static final long serialVersionUID = 1L; private final TextMatcher textMatcher; /** - * Construct a case-insensitive text filter. + * Construct a case-insensitive text condition. * * @param text The text to be matched. */ - AbstractTextFilter(String text, Boolean partialMatch) { + AbstractTextCondition(String text, Boolean partialMatch) { if (partialMatch) { this.textMatcher = new FilesSet.Rule.CaseInsensitivePartialStringComparisionMatcher(text); } else { @@ -524,16 +525,16 @@ final class FilesSet { } /** - * Construct a regular expression text filter. + * Construct a regular expression text condition. * * @param regex The regular expression to be matched. */ - AbstractTextFilter(Pattern regex) { + AbstractTextCondition(Pattern regex) { this.textMatcher = new FilesSet.Rule.RegexMatcher(regex); } /** - * Get the text the filter matches. + * Get the text the condition matches. * * @return The text. */ @@ -543,8 +544,8 @@ final class FilesSet { } /** - * Queries whether or not the text the filter matches is a regular - * expression. + * Queries whether or not the text the condition matches is a + * regular expression. * * @return True if the text to be matched is a regular expression, * false otherwise. @@ -555,7 +556,7 @@ final class FilesSet { } /** - * Determines whether a string of text matches the filter. + * Determines whether a string of text matches the condition. * * @param textToMatch The text string. * @@ -575,27 +576,29 @@ final class FilesSet { } /** - * A file path filter for an interesting files set membership rule. The - * immutability of a path filter object allows it to be safely published - * to multiple threads. + * A file path condition for an interesting files set membership rule. + * The immutability of a path condition object allows it to be safely + * published to multiple threads. */ - static final class ParentPathFilter extends AbstractTextFilter { + static final class ParentPathCondition extends AbstractTextCondition { + + private static final long serialVersionUID = 1L; /** - * Construct a case-insensitive file path filter. + * Construct a case-insensitive file path condition. * * @param path The path to be matched. */ - ParentPathFilter(String path) { + ParentPathCondition(String path) { super(path, true); } /** - * Construct a file path regular expression filter. + * Construct a file path regular expression condition. * * @param path The path regular expression to be matched. */ - ParentPathFilter(Pattern path) { + ParentPathCondition(Pattern path) { super(path); } @@ -610,34 +613,37 @@ final class FilesSet { } /** - * A "tagging" interface to group name and extension filters separately - * from path filters for type safety when constructing rules. + * A "tagging" interface to group name and extension conditions + * separately from path conditions for type safety when constructing + * rules. */ - static interface FileNameFilter extends TextFilter { + static interface FileNameCondition extends TextCondition { } /** - * A file name filter for an interesting files set membership rule. The - * immutability of a file name filter object allows it to be safely - * published to multiple threads. + * A file name condition for an interesting files set membership rule. + * The immutability of a file name condition object allows it to be + * safely published to multiple threads. */ - static final class FullNameFilter extends AbstractTextFilter implements FileNameFilter { + static final class FullNameCondition extends AbstractTextCondition implements FileNameCondition { + + private static final long serialVersionUID = 1L; /** - * Construct a case-insensitive full file name filter. + * Construct a case-insensitive full file name condition. * * @param name The file name to be matched. */ - FullNameFilter(String name) { + FullNameCondition(String name) { super(name, false); } /** - * Construct a full file name regular expression filter. + * Construct a full file name regular expression condition. * * @param name The file name regular expression to be matched. */ - FullNameFilter(Pattern name) { + FullNameCondition(Pattern name) { super(name); } @@ -652,18 +658,20 @@ final class FilesSet { } /** - * A file name extension filter for an interesting files set membership - * rule. The immutability of a file name extension filter object allows - * it to be safely published to multiple threads. + * A file name extension condition for an interesting files set + * membership rule. The immutability of a file name extension condition + * object allows it to be safely published to multiple threads. */ - static final class ExtensionFilter extends AbstractTextFilter implements FileNameFilter { + static final class ExtensionCondition extends AbstractTextCondition implements FileNameCondition { + + private static final long serialVersionUID = 1L; /** - * Construct a case-insensitive file name extension filter. + * Construct a case-insensitive file name extension condition. * * @param extension The file name extension to be matched. */ - ExtensionFilter(String extension) { + ExtensionCondition(String extension) { // If there is a leading ".", strip it since // AbstractFile.getFileNameExtension() returns just the // extension chars and not the dot. @@ -671,12 +679,12 @@ final class FilesSet { } /** - * Construct a file name extension regular expression filter. + * Construct a file name extension regular expression condition. * * @param extension The file name extension regular expression to be * matched. */ - ExtensionFilter(Pattern extension) { + ExtensionCondition(Pattern extension) { super(extension.pattern(), false); } @@ -692,7 +700,7 @@ final class FilesSet { /** * An interface for objects that do textual matches, used to compose a - * text filter. + * text condition. */ private static interface TextMatcher { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index c33350c4c3..40ae5b98ad 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -71,9 +71,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSetRulePanel(FilesSet.Rule rule) { initComponents(); populateRuleNameComponent(rule); - populateTypeFilterComponents(rule); - populateNameFilterComponents(rule); - populatePathFilterComponents(rule); + populateTypeConditionComponents(rule); + populateNameConditionComponents(rule); + populatePathConditionComponents(rule); customInit(); } @@ -131,9 +131,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @param rule The files set rule to be edited. */ - private void populateTypeFilterComponents(FilesSet.Rule rule) { - FilesSet.Rule.MetaTypeCondition typeFilter = rule.getMetaTypeFilter(); - switch (typeFilter.getMetaType()) { + private void populateTypeConditionComponents(FilesSet.Rule rule) { + FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); + switch (typeCondition.getMetaType()) { case FILES: this.filesRadioButton.setSelected(true); break; @@ -151,11 +151,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @param rule The files set rule to be edited. */ - private void populateNameFilterComponents(FilesSet.Rule rule) { - FilesSet.Rule.FileNameFilter nameFilter = rule.getFileNameFilter(); - this.nameTextField.setText(nameFilter.getTextToMatch()); - this.nameRegexCheckbox.setSelected(nameFilter.isRegex()); - if (nameFilter instanceof FilesSet.Rule.FullNameFilter) { + private void populateNameConditionComponents(FilesSet.Rule rule) { + FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition(); + this.nameTextField.setText(nameCondition.getTextToMatch()); + this.nameRegexCheckbox.setSelected(nameCondition.isRegex()); + if (nameCondition instanceof FilesSet.Rule.FullNameCondition) { this.fullNameRadioButton.setSelected(true); } else { this.extensionRadioButton.setSelected(true); @@ -168,11 +168,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @param rule The files set rule to be edited. */ - private void populatePathFilterComponents(FilesSet.Rule rule) { - FilesSet.Rule.ParentPathFilter pathFilter = rule.getPathFilter(); - if (pathFilter != null) { - this.pathTextField.setText(pathFilter.getTextToMatch()); - this.pathRegexCheckBox.setSelected(pathFilter.isRegex()); + private void populatePathConditionComponents(FilesSet.Rule rule) { + FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition(); + if (pathCondition != null) { + this.pathTextField.setText(pathCondition.getTextToMatch()); + this.pathRegexCheckBox.setSelected(pathCondition.isRegex()); } } @@ -188,7 +188,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { // The rule must have name condition text. if (this.nameTextField.getText().isEmpty()) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( - NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.emptyNameFilter"), + NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.emptyNameCondition"), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(notifyDesc); return false; @@ -260,35 +260,35 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @throws IllegalStateException if the specified name condition is not valid. */ - FilesSet.Rule.FileNameFilter getFileNameFilter() throws IllegalStateException { - FilesSet.Rule.FileNameFilter filter = null; + FilesSet.Rule.FileNameCondition getFileNameCondition() throws IllegalStateException { + FilesSet.Rule.FileNameCondition condition = null; if (!this.nameTextField.getText().isEmpty()) { if (this.nameRegexCheckbox.isSelected()) { try { Pattern pattern = Pattern.compile(this.nameTextField.getText()); if (this.fullNameRadioButton.isSelected()) { - filter = new FilesSet.Rule.FullNameFilter(pattern); + condition = new FilesSet.Rule.FullNameCondition(pattern); } else { - filter = new FilesSet.Rule.ExtensionFilter(pattern); + condition = new FilesSet.Rule.ExtensionCondition(pattern); } } catch (PatternSyntaxException ex) { - logger.log(Level.SEVERE, "Attempt to get regex name filter that does not compile", ex); // NON-NLS - throw new IllegalStateException("The files set rule panel name filter is not in a valid state"); // NON-NLS + logger.log(Level.SEVERE, "Attempt to get regex name condition that does not compile", ex); // NON-NLS + throw new IllegalStateException("The files set rule panel name condition is not in a valid state"); // NON-NLS } } else { if (FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) { if (this.fullNameRadioButton.isSelected()) { - filter = new FilesSet.Rule.FullNameFilter(this.nameTextField.getText()); + condition = new FilesSet.Rule.FullNameCondition(this.nameTextField.getText()); } else { - filter = new FilesSet.Rule.ExtensionFilter(this.nameTextField.getText()); + condition = new FilesSet.Rule.ExtensionCondition(this.nameTextField.getText()); } } else { - logger.log(Level.SEVERE, "Attempt to get name filter with illegal chars"); // NON-NLS - throw new IllegalStateException("The files set rule panel name filter is not in a valid state"); // NON-NLS + logger.log(Level.SEVERE, "Attempt to get name condition with illegal chars"); // NON-NLS + throw new IllegalStateException("The files set rule panel name condition is not in a valid state"); // NON-NLS } } } - return filter; + return condition; } /** @@ -329,7 +329,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @return A type condition. */ - FilesSet.Rule.MetaTypeCondition getMetaTypeFilter() { + FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() { if (this.filesRadioButton.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } else if (this.dirsRadioButton.isSelected()) { @@ -347,15 +347,15 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @throws IllegalStateException if the specified path condition is not valid. */ - FilesSet.Rule.ParentPathFilter getPathFilter() throws IllegalStateException { - FilesSet.Rule.ParentPathFilter filter = null; + FilesSet.Rule.ParentPathCondition getPathCondition() throws IllegalStateException { + FilesSet.Rule.ParentPathCondition condition = null; if (!this.pathTextField.getText().isEmpty()) { if (this.pathRegexCheckBox.isSelected()) { try { - filter = new FilesSet.Rule.ParentPathFilter(Pattern.compile(this.pathTextField.getText())); + condition = new FilesSet.Rule.ParentPathCondition(Pattern.compile(this.pathTextField.getText())); } catch (PatternSyntaxException ex) { - logger.log(Level.SEVERE, "Attempt to get malformed path filter", ex); // NON-NLS - throw new IllegalStateException("The files set rule panel path filter is not in a valid state"); // NON-NLS + logger.log(Level.SEVERE, "Attempt to get malformed path condition", ex); // NON-NLS + throw new IllegalStateException("The files set rule panel path condition is not in a valid state"); // NON-NLS } } else { String path = this.pathTextField.getText(); @@ -368,14 +368,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel { if (!path.endsWith(FilesSetRulePanel.SLEUTHKIT_PATH_SEPARATOR)) { path += FilesSetRulePanel.SLEUTHKIT_PATH_SEPARATOR; } - filter = new FilesSet.Rule.ParentPathFilter(path); + condition = new FilesSet.Rule.ParentPathCondition(path); } else { - logger.log(Level.SEVERE, "Attempt to get path filter with illegal chars"); // NON-NLS - throw new IllegalStateException("The files set rule panel path filter is not in a valid state"); // NON-NLS + logger.log(Level.SEVERE, "Attempt to get path condition with illegal chars"); // NON-NLS + throw new IllegalStateException("The files set rule panel path condition is not in a valid state"); // NON-NLS } } } - return filter; + return condition; } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 4039974695..a3fdc11926 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -140,11 +140,11 @@ final class InterestingItemDefsManager extends Observable { // to allow Autopsy to use TSK Framework interesting files set // definitions. // 2. The TSK Framework has an interesting files module that supports - // simple globbing with "*" characters. Name rules and path filters with + // simple globbing with "*" characters. Name rules and path conditions with // "*" characters will be converted to regexes to allow Autopsy to use // TSK Framework interesting files set definitions. - // 3. Type filters are required by Autopsy, but not by TSK Frmaework. - // Missing type filters will defualt to "files" filters. + // 3. Type conditions are required by Autopsy, but not by TSK Frmaework. + // Missing type conditions will defualt to "files" conditions. private static final String REGEX_ATTR = "regex"; //NON-NLS private static final String PATH_REGEX_ATTR = "pathRegex"; //NON-NLS private static final String TYPE_FILTER_VALUE_FILES_AND_DIRS = "files_and_dirs"; //NON-NLS @@ -288,16 +288,16 @@ final class InterestingItemDefsManager extends Observable { private static FilesSet.Rule readFileNameRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); - // The content of the rule tag is a file name filter. It may be a + // The content of the rule tag is a file name condition. It may be a // regex, or it may be from a TSK Framework rule definition with a // "*" globbing char, or it may be simple text. String content = elem.getTextContent(); - FilesSet.Rule.FullNameFilter nameFilter; + FilesSet.Rule.FullNameCondition namecondition; String regex = elem.getAttribute(FilesSetXML.REGEX_ATTR); if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { // NON-NLS Pattern pattern = compileRegex(content); if (pattern != null) { - nameFilter = new FilesSet.Rule.FullNameFilter(pattern); + namecondition = new FilesSet.Rule.FullNameCondition(pattern); } else { logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.NAME_RULE_TAG + " regex, ignoring malformed '{0}' rule definition", ruleName); // NON-NLS return null; @@ -309,29 +309,29 @@ final class InterestingItemDefsManager extends Observable { return null; } } - nameFilter = new FilesSet.Rule.FullNameFilter(content); + namecondition = new FilesSet.Rule.FullNameCondition(content); } - // Read in the type filter. - FilesSet.Rule.MetaTypeCondition metaTypeFilter = FilesSetXML.readMetaTypeFilter(elem); - if (metaTypeFilter == null) { + // Read in the type condition. + FilesSet.Rule.MetaTypeCondition metaTypecondition = FilesSetXML.readMetaTypecondition(elem); + if (metaTypecondition == null) { // Malformed attribute. return null; } - // Read in the optional path filter. Null is o.k., but if the attribute + // Read in the optional path condition. Null is o.k., but if the attribute // is there, be sure it is not malformed. - FilesSet.Rule.ParentPathFilter pathFilter = null; + FilesSet.Rule.ParentPathCondition pathcondition = null; if (!elem.getAttribute(FilesSetXML.PATH_FILTER_ATTR).isEmpty() || !elem.getAttribute(FilesSetXML.PATH_REGEX_ATTR).isEmpty()) { - pathFilter = FilesSetXML.readPathFilter(elem); - if (pathFilter == null) { + pathcondition = FilesSetXML.readPathcondition(elem); + if (pathcondition == null) { // Malformed attribute. return null; } } - return new FilesSet.Rule(ruleName, nameFilter, metaTypeFilter, pathFilter, null, null); + return new FilesSet.Rule(ruleName, namecondition, metaTypecondition, pathcondition, null, null); } /** @@ -346,16 +346,16 @@ final class InterestingItemDefsManager extends Observable { private static FilesSet.Rule readFileExtensionRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); - // The content of the rule tag is a file name extension filter. It may + // The content of the rule tag is a file name extension condition. It may // be a regex, or it may be from a TSK Framework rule definition // with a "*" globbing char. String content = elem.getTextContent(); - FilesSet.Rule.ExtensionFilter extFilter; + FilesSet.Rule.ExtensionCondition extcondition; String regex = elem.getAttribute(FilesSetXML.REGEX_ATTR); if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { // NON-NLS Pattern pattern = compileRegex(content); if (pattern != null) { - extFilter = new FilesSet.Rule.ExtensionFilter(pattern); + extcondition = new FilesSet.Rule.ExtensionCondition(pattern); } else { logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.EXTENSION_RULE_TAG + " regex, ignoring malformed {0} rule definition", ruleName); // NON-NLS return null; @@ -367,35 +367,35 @@ final class InterestingItemDefsManager extends Observable { return null; } } - extFilter = new FilesSet.Rule.ExtensionFilter(content); + extcondition = new FilesSet.Rule.ExtensionCondition(content); } - // The rule must have a meta-type filter, unless a TSK Framework + // The rule must have a meta-type condition, unless a TSK Framework // definitions file is being read. - FilesSet.Rule.MetaTypeCondition metaTypeFilter = null; + FilesSet.Rule.MetaTypeCondition metaTypecondition = null; if (!elem.getAttribute(FilesSetXML.TYPE_FILTER_ATTR).isEmpty()) { - metaTypeFilter = FilesSetXML.readMetaTypeFilter(elem); - if (metaTypeFilter == null) { + metaTypecondition = FilesSetXML.readMetaTypecondition(elem); + if (metaTypecondition == null) { // Malformed attribute. return null; } } else { - metaTypeFilter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + metaTypecondition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } - // The rule may have a path filter. Null is o.k., but if the attribute + // The rule may have a path condition. Null is o.k., but if the attribute // is there, it must not be malformed. - FilesSet.Rule.ParentPathFilter pathFilter = null; + FilesSet.Rule.ParentPathCondition pathcondition = null; if (!elem.getAttribute(FilesSetXML.PATH_FILTER_ATTR).isEmpty() || !elem.getAttribute(FilesSetXML.PATH_REGEX_ATTR).isEmpty()) { - pathFilter = FilesSetXML.readPathFilter(elem); - if (pathFilter == null) { + pathcondition = FilesSetXML.readPathcondition(elem); + if (pathcondition == null) { // Malformed attribute. return null; } } - return new FilesSet.Rule(ruleName, extFilter, metaTypeFilter, pathFilter, null, null); + return new FilesSet.Rule(ruleName, extcondition, metaTypecondition, pathcondition, null, null); } /** @@ -428,62 +428,62 @@ final class InterestingItemDefsManager extends Observable { } /** - * Construct a meta-type filter for an interesting files set membership + * Construct a meta-type condition for an interesting files set membership * rule from data in an XML element. * * @param ruleElement The XML element. * - * @return The meta-type filter, or null if there is an error (logged). + * @return The meta-type condition, or null if there is an error (logged). */ - private static FilesSet.Rule.MetaTypeCondition readMetaTypeFilter(Element ruleElement) { - FilesSet.Rule.MetaTypeCondition filter = null; - String filterAttribute = ruleElement.getAttribute(FilesSetXML.TYPE_FILTER_ATTR); - if (!filterAttribute.isEmpty()) { - switch (filterAttribute) { + private static FilesSet.Rule.MetaTypeCondition readMetaTypecondition(Element ruleElement) { + FilesSet.Rule.MetaTypeCondition condition = null; + String conditionAttribute = ruleElement.getAttribute(FilesSetXML.TYPE_FILTER_ATTR); + if (!conditionAttribute.isEmpty()) { + switch (conditionAttribute) { case FilesSetXML.TYPE_FILTER_VALUE_FILES: - filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); break; case FilesSetXML.TYPE_FILTER_VALUE_DIRS: - filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); break; case FilesSetXML.TYPE_FILTER_VALUE_FILES_AND_DIRS: - filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); break; default: - logger.log(Level.SEVERE, "Found {0} " + FilesSetXML.TYPE_FILTER_ATTR + " attribute with unrecognized value ''{0}'', ignoring malformed rule definition", filterAttribute); // NON-NLS + logger.log(Level.SEVERE, "Found {0} " + FilesSetXML.TYPE_FILTER_ATTR + " attribute with unrecognized value ''{0}'', ignoring malformed rule definition", conditionAttribute); // NON-NLS break; } } else { // Accept TSK Framework interesting files set definitions, // default to files. - filter = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } - return filter; + return condition; } /** - * Construct a path filter for an interesting files set membership rule + * Construct a path condition for an interesting files set membership rule * from data in an XML element. * * @param ruleElement The XML element. * - * @return The path filter, or null if there is an error (logged). + * @return The path condition, or null if there is an error (logged). */ - private static FilesSet.Rule.ParentPathFilter readPathFilter(Element ruleElement) { - FilesSet.Rule.ParentPathFilter filter = null; + private static FilesSet.Rule.ParentPathCondition readPathcondition(Element ruleElement) { + FilesSet.Rule.ParentPathCondition condition = null; String path = ruleElement.getAttribute(FilesSetXML.PATH_FILTER_ATTR); String pathRegex = ruleElement.getAttribute(FilesSetXML.PATH_REGEX_ATTR); if (!pathRegex.isEmpty() && path.isEmpty()) { try { Pattern pattern = Pattern.compile(pathRegex); - filter = new FilesSet.Rule.ParentPathFilter(pattern); + condition = new FilesSet.Rule.ParentPathCondition(pattern); } catch (PatternSyntaxException ex) { - logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.PATH_REGEX_ATTR + " regex, ignoring malformed path filter definition", ex); // NON-NLS + logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.PATH_REGEX_ATTR + " regex, ignoring malformed path condition definition", ex); // NON-NLS } } else if (!path.isEmpty() && pathRegex.isEmpty()) { - filter = new FilesSet.Rule.ParentPathFilter(path); + condition = new FilesSet.Rule.ParentPathCondition(path); } - return filter; + return condition; } /** @@ -517,11 +517,11 @@ final class InterestingItemDefsManager extends Observable { // Add the child elements for the set membership rules. for (FilesSet.Rule rule : set.getRules().values()) { - // Add a rule element with the appropriate name filter + // Add a rule element with the appropriate name condition // type tag. - FilesSet.Rule.FileNameFilter nameFilter = rule.getFileNameFilter(); + FilesSet.Rule.FileNameCondition namecondition = rule.getFileNameCondition(); Element ruleElement; - if (nameFilter instanceof FilesSet.Rule.FullNameFilter) { + if (namecondition instanceof FilesSet.Rule.FullNameCondition) { ruleElement = doc.createElement(FilesSetXML.NAME_RULE_TAG); } else { ruleElement = doc.createElement(FilesSetXML.EXTENSION_RULE_TAG); @@ -530,12 +530,12 @@ final class InterestingItemDefsManager extends Observable { // Add the rule name attribute. ruleElement.setAttribute(FilesSetXML.NAME_ATTR, rule.getName()); - // Add the name filter regex attribute - ruleElement.setAttribute(FilesSetXML.REGEX_ATTR, Boolean.toString(nameFilter.isRegex())); + // Add the name condition regex attribute + ruleElement.setAttribute(FilesSetXML.REGEX_ATTR, Boolean.toString(namecondition.isRegex())); - // Add the type filter attribute. - FilesSet.Rule.MetaTypeCondition typeFilter = rule.getMetaTypeFilter(); - switch (typeFilter.getMetaType()) { + // Add the type condition attribute. + FilesSet.Rule.MetaTypeCondition typecondition = rule.getMetaTypeCondition(); + switch (typecondition.getMetaType()) { case FILES: ruleElement.setAttribute(FilesSetXML.TYPE_FILTER_ATTR, FilesSetXML.TYPE_FILTER_VALUE_FILES); break; @@ -547,18 +547,18 @@ final class InterestingItemDefsManager extends Observable { break; } - // Add the optional path filter. - FilesSet.Rule.ParentPathFilter pathFilter = rule.getPathFilter(); - if (pathFilter != null) { - if (pathFilter.isRegex()) { - ruleElement.setAttribute(FilesSetXML.PATH_REGEX_ATTR, pathFilter.getTextToMatch()); + // Add the optional path condition. + FilesSet.Rule.ParentPathCondition pathcondition = rule.getPathCondition(); + if (pathcondition != null) { + if (pathcondition.isRegex()) { + ruleElement.setAttribute(FilesSetXML.PATH_REGEX_ATTR, pathcondition.getTextToMatch()); } else { - ruleElement.setAttribute(FilesSetXML.PATH_FILTER_ATTR, pathFilter.getTextToMatch()); + ruleElement.setAttribute(FilesSetXML.PATH_FILTER_ATTR, pathcondition.getTextToMatch()); } } - // Add the name filter text as the rule element content. - ruleElement.setTextContent(nameFilter.getTextToMatch()); + // Add the name condition text as the rule element content. + ruleElement.setTextContent(namecondition.getTextToMatch()); setElement.appendChild(ruleElement); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 7f78c98257..ccca90757a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -113,7 +113,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -224,10 +224,10 @@ - + - + @@ -518,16 +518,16 @@ - + - + - + @@ -698,15 +698,15 @@ - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 5a34363ac8..3636f08c91 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -177,8 +177,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.fileNameRadioButton.setSelected(true); this.fileNameRegexCheckbox.setSelected(false); this.filesRadioButton.setSelected(true); - this.rulePathFilterTextField.setText(""); - this.rulePathFilterRegexCheckBox.setSelected(false); + this.rulePathConditionTextField.setText(""); + this.rulePathConditionRegexCheckBox.setSelected(false); this.newRuleButton.setEnabled(!this.setsListModel.isEmpty()); this.editRuleButton.setEnabled(false); this.deleteRuleButton.setEnabled(false); @@ -242,19 +242,19 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Get the selected rule and populate the rule components. FilesSet.Rule rule = InterestingItemDefsPanel.this.rulesList.getSelectedValue(); if (rule != null) { - // Get the filters that make up the rule. - FilesSet.Rule.FileNameFilter nameFilter = rule.getFileNameFilter(); - FilesSet.Rule.MetaTypeCondition typeFilter = rule.getMetaTypeFilter(); - FilesSet.Rule.ParentPathFilter pathFilter = rule.getPathFilter(); - FilesSet.Rule.MimeTypeCondition mimeTypeFilter = rule.getMimeTypeFilter(); + // Get the conditions that make up the rule. + FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition(); + FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); + FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition(); + FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition(); // Populate the components that display the properties of the // selected rule. - InterestingItemDefsPanel.this.fileNameTextField.setText(nameFilter.getTextToMatch()); - InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameFilter instanceof FilesSet.Rule.FullNameFilter); - InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameFilter instanceof FilesSet.Rule.ExtensionFilter); - InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameFilter.isRegex()); - switch (typeFilter.getMetaType()) { + InterestingItemDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch()); + InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition); + InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition); + InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex()); + switch (typeCondition.getMetaType()) { case FILES: InterestingItemDefsPanel.this.filesRadioButton.setSelected(true); break; @@ -265,14 +265,14 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp InterestingItemDefsPanel.this.bothRadioButton.setSelected(true); break; } - if (pathFilter != null) { - InterestingItemDefsPanel.this.rulePathFilterTextField.setText(pathFilter.getTextToMatch()); - InterestingItemDefsPanel.this.rulePathFilterRegexCheckBox.setSelected(pathFilter.isRegex()); + if (pathCondition != null) { + InterestingItemDefsPanel.this.rulePathConditionTextField.setText(pathCondition.getTextToMatch()); + InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(pathCondition.isRegex()); } else { - InterestingItemDefsPanel.this.rulePathFilterTextField.setText(""); - InterestingItemDefsPanel.this.rulePathFilterRegexCheckBox.setSelected(false); + InterestingItemDefsPanel.this.rulePathConditionTextField.setText(""); + InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false); } - InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeFilter.getMimeType()); + InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); // Enable the new, edit and delete rule buttons. InterestingItemDefsPanel.this.newRuleButton.setEnabled(true); @@ -371,7 +371,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp if (selectedRule != null) { rules.remove(selectedRule.getUuid()); } - FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameFilter(), panel.getMetaTypeFilter(), panel.getPathFilter(), panel.getMimeTypeCondition(), panel.getFileSizeCondition()); + FilesSet.Rule newRule = new FilesSet.Rule(panel.getRuleName(), panel.getFileNameCondition(), panel.getMetaTypeCondition(), panel.getPathCondition(), panel.getMimeTypeCondition(), panel.getFileSizeCondition()); rules.put(newRule.getUuid(), newRule); // Add the new/edited files set definition, replacing any previous @@ -454,7 +454,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp fileNameTextField = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); fileNameRadioButton = new javax.swing.JRadioButton(); - rulePathFilterTextField = new javax.swing.JTextField(); + rulePathConditionTextField = new javax.swing.JTextField(); ignoreKnownFilesCheckbox = new javax.swing.JCheckBox(); fileNameRegexCheckbox = new javax.swing.JCheckBox(); separator = new javax.swing.JSeparator(); @@ -467,7 +467,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp dirsRadioButton = new javax.swing.JRadioButton(); jLabel1 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); - rulePathFilterRegexCheckBox = new javax.swing.JCheckBox(); + rulePathConditionRegexCheckBox = new javax.swing.JCheckBox(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel7 = new javax.swing.JLabel(); @@ -566,9 +566,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameRadioButton.text")); // NOI18N fileNameRadioButton.setEnabled(false); - rulePathFilterTextField.setEditable(false); - rulePathFilterTextField.setFont(rulePathFilterTextField.getFont().deriveFont(rulePathFilterTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - rulePathFilterTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathFilterTextField.text")); // NOI18N + rulePathConditionTextField.setEditable(false); + rulePathConditionTextField.setFont(rulePathConditionTextField.getFont().deriveFont(rulePathConditionTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); + rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathConditionTextField.text")); // NOI18N ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N @@ -639,9 +639,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel4.text")); // NOI18N - rulePathFilterRegexCheckBox.setFont(rulePathFilterRegexCheckBox.getFont().deriveFont(rulePathFilterRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(rulePathFilterRegexCheckBox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathFilterRegexCheckBox.text")); // NOI18N - rulePathFilterRegexCheckBox.setEnabled(false); + rulePathConditionRegexCheckBox.setFont(rulePathConditionRegexCheckBox.getFont().deriveFont(rulePathConditionRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); + org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N + rulePathConditionRegexCheckBox.setEnabled(false); jScrollPane2.setFont(jScrollPane2.getFont().deriveFont(jScrollPane2.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -713,7 +713,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addComponent(fileNameExtensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fileNameRegexCheckbox)) - .addComponent(rulePathFilterRegexCheckBox))) + .addComponent(rulePathConditionRegexCheckBox))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(354, 354, 354) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -722,7 +722,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(rulePathFilterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() @@ -762,7 +762,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addContainerGap(26, Short.MAX_VALUE)) ); - jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {fileNameTextField, mimeTypeComboBox, rulePathFilterTextField}); + jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {fileNameTextField, mimeTypeComboBox, rulePathConditionTextField}); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -806,9 +806,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) - .addComponent(rulePathFilterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rulePathFilterRegexCheckBox) + .addComponent(rulePathConditionRegexCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) @@ -937,8 +937,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JButton newRuleButton; private javax.swing.JButton newSetButton; - private javax.swing.JCheckBox rulePathFilterRegexCheckBox; - private javax.swing.JTextField rulePathFilterTextField; + private javax.swing.JCheckBox rulePathConditionRegexCheckBox; + private javax.swing.JTextField rulePathConditionTextField; private javax.swing.JList rulesList; private javax.swing.JLabel rulesListLabel; private javax.swing.JScrollPane rulesListScrollPane; From 863229043e5f7a626e3aa23eb30702ce93f08e9a Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Fri, 19 Feb 2016 11:18:55 -0500 Subject: [PATCH 03/32] UI updates --- .../interestingitems/Bundle.properties | 10 +- .../interestingitems/Bundle_ja.properties | 2 - .../interestingitems/FilesSetRulePanel.form | 182 +++++++----- .../interestingitems/FilesSetRulePanel.java | 257 +++++++++++------ .../InterestingItemDefsPanel.form | 271 +++++++++--------- .../InterestingItemDefsPanel.java | 241 ++++++++-------- 6 files changed, 548 insertions(+), 415 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 8b16637fc3..88de28993b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -20,7 +20,7 @@ FilesSetRulePanel.fullNameRadioButton.text=Full Name FilesSetRulePanel.nameRegexCheckbox.text=Regex FilesSetRulePanel.ruleNameTextField.text= FilesSetRulePanel.nameTextField.text= -FilesSetRulePanel.ruleNameLabel.text=Rule Name: +FilesSetRulePanel.ruleNameLabel.text=Rule Name (Optional): FilesSetRulePanel.messages.emptyNameCondition=You must specify a name pattern for this rule. FilesSetRulePanel.messages.invalidNameRegex=The name regular expression is not valid:\n\n{0} FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression. @@ -33,11 +33,7 @@ FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: -FilesSetRulePanel.jLabel2.text=Name Pattern: -FilesSetRulePanel.jLabel3.text=Path Pattern: FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. -FilesSetRulePanel.jLabel6.text=MIME Type: -FilesSetRulePanel.jLabel7.text=File Size: InterestingItemDefsPanel.jLabel6.text=Set Details InterestingItemDefsPanel.jLabel8.text=File Size: InterestingItemDefsPanel.jLabel7.text=MIME Type: @@ -65,3 +61,7 @@ InterestingItemDefsPanel.filesRadioButton.text=Files InterestingItemDefsPanel.newRuleButton.text=New Rule InterestingItemDefsPanel.rulePathConditionTextField.text= InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex +FilesSetRulePanel.nameCheck.text=Name Pattern: +FilesSetRulePanel.pathCheck.text=Path Pattern: +FilesSetRulePanel.mimeCheck.text=MIME Type: +FilesSetRulePanel.fileCheck.text=File Size: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 90793dce8e..146458ca0b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -11,8 +11,6 @@ FilesSetRulePanel.filesAndDirsRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3 FilesSetRulePanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a -FilesSetRulePanel.jLabel2.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3*\uff1a -FilesSetRulePanel.jLabel3.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 FilesSetRulePanel.messages.invalidCharInName=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001/\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u540d\u524d\u306b\u542b\u3081\u307e\u305b\u3093\u3002 FilesSetRulePanel.messages.invalidCharInPath=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u30d1\u30b9\u306b\u542b\u3081\u307e\u305b\u3093\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index a4b0290c01..ba8ac2492b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -23,52 +23,40 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + + + - - - - - + + + @@ -79,21 +67,34 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -110,45 +111,45 @@ - + - + - + - + - + - + - - - - - - + - + - + - + - + + + + + + @@ -217,18 +218,12 @@ - - - - - - - + @@ -239,6 +234,7 @@ + @@ -249,6 +245,7 @@ + @@ -256,13 +253,7 @@ - - - - - - - + @@ -270,6 +261,7 @@ + @@ -277,6 +269,7 @@ + @@ -287,6 +280,7 @@ + @@ -302,6 +296,7 @@ + @@ -313,6 +308,7 @@ + @@ -323,6 +319,7 @@ + @@ -333,24 +330,51 @@ + - + - + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 40ae5b98ad..537c67008c 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -19,6 +19,7 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.util.ArrayList; +import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -26,6 +27,7 @@ import java.util.SortedSet; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import javax.swing.AbstractButton; import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MimeTypes; import org.openide.DialogDisplayer; @@ -127,7 +129,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Populates the UI components that display the meta-type condition for a rule. + * Populates the UI components that display the meta-type condition for a + * rule. * * @param rule The files set rule to be edited. */ @@ -163,8 +166,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Populates the UI components that display the optional path condition for a - rule. + * Populates the UI components that display the optional path condition for + * a rule. * * @param rule The files set rule to be edited. */ @@ -253,12 +256,13 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Gets the name condition for the rule that was created or edited. Should only - * be called if isValidDefintion() returns true. + * Gets the name condition for the rule that was created or edited. Should + * only be called if isValidDefintion() returns true. * * @return A name condition. * - * @throws IllegalStateException if the specified name condition is not valid. + * @throws IllegalStateException if the specified name condition is not + * valid. */ FilesSet.Rule.FileNameCondition getFileNameCondition() throws IllegalStateException { FilesSet.Rule.FileNameCondition condition = null; @@ -325,7 +329,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Gets the file meta-type condition for the rule that was created or edited. + * Gets the file meta-type condition for the rule that was created or + * edited. * * @return A type condition. */ @@ -345,7 +350,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @return A path condition or null if no path condition was specified. * - * @throws IllegalStateException if the specified path condition is not valid. + * @throws IllegalStateException if the specified path condition is not + * valid. */ FilesSet.Rule.ParentPathCondition getPathCondition() throws IllegalStateException { FilesSet.Rule.ParentPathCondition condition = null; @@ -397,23 +403,28 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } /** - * Sets the state of the name condition UI components consistent with the state - of the UI components in the type button group. + * Sets the state of the name condition UI components consistent with the + * state of the UI components in the type button group. */ private void setComponentsForSearchType() { if (!this.filesRadioButton.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); this.mimeTypeComboBox.setEnabled(false); + this.mimeTypeComboBox.setSelectedIndex(0); this.equalitySymbolComboBox.setEnabled(false); this.fileSizeComboBox.setEnabled(false); this.fileSizeSpinner.setEnabled(false); + this.fileSizeSpinner.setValue(0); + this.fileCheck.setEnabled(false); + this.fileCheck.setSelected(false); + this.mimeCheck.setEnabled(false); + this.mimeCheck.setSelected(false); + } else { this.extensionRadioButton.setEnabled(true); - this.mimeTypeComboBox.setEnabled(true); - this.equalitySymbolComboBox.setEnabled(true); - this.fileSizeComboBox.setEnabled(true); - this.fileSizeSpinner.setEnabled(true); + this.fileCheck.setEnabled(true); + this.mimeCheck.setEnabled(true); } } @@ -434,12 +445,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { dirsRadioButton = new javax.swing.JRadioButton(); filesRadioButton = new javax.swing.JRadioButton(); filesAndDirsRadioButton = new javax.swing.JRadioButton(); - jLabel2 = new javax.swing.JLabel(); nameTextField = new javax.swing.JTextField(); fullNameRadioButton = new javax.swing.JRadioButton(); extensionRadioButton = new javax.swing.JRadioButton(); nameRegexCheckbox = new javax.swing.JCheckBox(); - jLabel3 = new javax.swing.JLabel(); pathTextField = new javax.swing.JTextField(); pathRegexCheckBox = new javax.swing.JCheckBox(); pathSeparatorInfoLabel = new javax.swing.JLabel(); @@ -448,8 +457,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { equalitySymbolComboBox = new javax.swing.JComboBox(); fileSizeComboBox = new javax.swing.JComboBox(); fileSizeSpinner = new javax.swing.JSpinner(); - jLabel6 = new javax.swing.JLabel(); - jLabel7 = new javax.swing.JLabel(); + nameCheck = new javax.swing.JCheckBox(); + pathCheck = new javax.swing.JCheckBox(); + mimeCheck = new javax.swing.JCheckBox(); + fileCheck = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N @@ -486,83 +497,106 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel2.text")); // NOI18N - nameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameTextField.text")); // NOI18N + nameTextField.setEnabled(false); nameButtonGroup.add(fullNameRadioButton); org.openide.awt.Mnemonics.setLocalizedText(fullNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fullNameRadioButton.text")); // NOI18N + fullNameRadioButton.setEnabled(false); nameButtonGroup.add(extensionRadioButton); org.openide.awt.Mnemonics.setLocalizedText(extensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.extensionRadioButton.text")); // NOI18N + extensionRadioButton.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(nameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameRegexCheckbox.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel3.text")); // NOI18N + nameRegexCheckbox.setEnabled(false); pathTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathTextField.text")); // NOI18N + pathTextField.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(pathRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathRegexCheckBox.text")); // NOI18N + pathRegexCheckBox.setEnabled(false); pathSeparatorInfoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/info-icon-16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(pathSeparatorInfoLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathSeparatorInfoLabel.text")); // NOI18N + pathSeparatorInfoLabel.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel5.text")); // NOI18N mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + mimeTypeComboBox.setEnabled(false); equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + equalitySymbolComboBox.setEnabled(false); fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); + fileSizeComboBox.setEnabled(false); fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); + fileSizeSpinner.setEnabled(false); - org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel6.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(nameCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameCheck.text")); // NOI18N + nameCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + nameCheckActionPerformed(evt); + } + }); - org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel7.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(pathCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathCheck.text")); // NOI18N + pathCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + pathCheckActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(mimeCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.mimeCheck.text")); // NOI18N + mimeCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mimeCheckActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(fileCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileCheck.text")); // NOI18N + fileCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fileCheckActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGap(8, 8, 8) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel6) - .addComponent(jLabel7)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1) - .addComponent(jLabel2)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(filesRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(dirsRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(filesAndDirsRadioButton)))) + .addComponent(filesAndDirsRadioButton)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel5) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(layout.createSequentialGroup() - .addComponent(jLabel5) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(ruleNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) + .addContainerGap() + .addComponent(nameCheck) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(pathCheck) + .addGap(4, 4, 4) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pathRegexCheckBox) @@ -572,15 +606,26 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addGap(0, 0, Short.MAX_VALUE) .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() - .addComponent(fullNameRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(extensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(nameRegexCheckbox))) - .addGap(0, 0, Short.MAX_VALUE))))) + .addComponent(fullNameRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(extensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(nameRegexCheckbox) + .addGap(0, 0, Short.MAX_VALUE)))) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(mimeCheck) + .addComponent(fileCheck)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap()) ); layout.setVerticalGroup( @@ -593,37 +638,37 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addComponent(filesRadioButton) .addComponent(dirsRadioButton) .addComponent(filesAndDirsRadioButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(nameCheck)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fullNameRadioButton) .addComponent(extensionRadioButton) .addComponent(nameRegexCheckbox)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel3)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(pathCheck)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(pathRegexCheckBox) .addComponent(pathSeparatorInfoLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(18, 18, 18) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel6)) - .addGap(19, 19, 19) + .addComponent(mimeCheck)) + .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel7)) + .addComponent(fileCheck)) + .addGap(15, 15, 15) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); }// //GEN-END:initComponents @@ -644,25 +689,75 @@ final class FilesSetRulePanel extends javax.swing.JPanel { // TODO add your handling code here: }//GEN-LAST:event_ruleNameTextFieldActionPerformed + private void nameCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameCheckActionPerformed + if (!this.nameCheck.isSelected()) { + this.nameTextField.setEnabled(false); + this.nameTextField.setText(""); + this.fullNameRadioButton.setEnabled(false); + this.extensionRadioButton.setEnabled(false); + this.nameRegexCheckbox.setEnabled(false); + } else { + this.nameTextField.setEnabled(true); + this.fullNameRadioButton.setEnabled(true); + this.extensionRadioButton.setEnabled(true); + this.nameRegexCheckbox.setEnabled(true); + } + }//GEN-LAST:event_nameCheckActionPerformed + + private void pathCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathCheckActionPerformed + if (!this.pathCheck.isSelected()) { + this.pathTextField.setEnabled(false); + this.pathTextField.setText(""); + this.pathRegexCheckBox.setEnabled(false); + this.pathSeparatorInfoLabel.setEnabled(false); + } else { + this.pathTextField.setEnabled(true); + this.pathRegexCheckBox.setEnabled(true); + this.pathSeparatorInfoLabel.setEnabled(true); + } + }//GEN-LAST:event_pathCheckActionPerformed + + private void mimeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeCheckActionPerformed + if (!this.mimeCheck.isSelected()) { + this.mimeTypeComboBox.setEnabled(false); + this.mimeTypeComboBox.setSelectedIndex(0); + } else { + this.mimeTypeComboBox.setEnabled(true); + } + }//GEN-LAST:event_mimeCheckActionPerformed + + private void fileCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileCheckActionPerformed + if (!this.fileCheck.isSelected()) { + this.fileSizeComboBox.setEnabled(false); + this.fileSizeSpinner.setEnabled(false); + this.fileSizeSpinner.setValue(0); + this.equalitySymbolComboBox.setEnabled(false); + } else { + this.fileSizeComboBox.setEnabled(true); + this.fileSizeSpinner.setEnabled(true); + this.equalitySymbolComboBox.setEnabled(true); + } + }//GEN-LAST:event_fileCheckActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton dirsRadioButton; private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; + private javax.swing.JCheckBox fileCheck; private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; private javax.swing.JRadioButton filesAndDirsRadioButton; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel7; + private javax.swing.JCheckBox mimeCheck; private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.ButtonGroup nameButtonGroup; + private javax.swing.JCheckBox nameCheck; private javax.swing.JCheckBox nameRegexCheckbox; private javax.swing.JTextField nameTextField; + private javax.swing.JCheckBox pathCheck; private javax.swing.JCheckBox pathRegexCheckBox; private javax.swing.JLabel pathSeparatorInfoLabel; private javax.swing.JTextField pathTextField; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index ccca90757a..3a09c7c846 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -28,17 +28,14 @@ - - + + - - - - + @@ -66,103 +63,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + - - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - + + - - + + - + - - + + - - + + - - + + - + @@ -170,11 +163,20 @@ - - + + + + + + + + + + + - + @@ -183,57 +185,75 @@ + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + - + - + @@ -241,24 +261,8 @@ - - - - - - - - - - - - - - - - - + @@ -489,6 +493,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 3636f08c91..c6bacc0bb1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -557,6 +557,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp fileNameTextField.setEditable(false); fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); fileNameTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameTextField.text")); // NOI18N + fileNameTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fileNameTextFieldActionPerformed(evt); + } + }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel5.text")); // NOI18N @@ -675,164 +680,166 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setsListLabel) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(setsListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(deleteSetButton))) + .addGap(18, 18, 18) + .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(12, 12, 12) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel1) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel2) + .addGap(27, 27, 27) + .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(bothRadioButton) + .addGap(27, 27, 27)))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(380, 380, 380) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel2) - .addComponent(jLabel1))) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setsListLabel) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(deleteSetButton))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(22, 22, 22) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(filesRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(dirsRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bothRadioButton)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(fileNameRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileNameExtensionRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileNameRegexCheckbox)) - .addComponent(rulePathConditionRegexCheckBox))) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(354, 354, 354) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(jLabel7) - .addComponent(jLabel8)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel3) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeUnitComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, 245, Short.MAX_VALUE) + .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(rulesListLabel)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(jLabel5)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(ignoreKnownFilesCheckbox)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(jLabel6)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(346, 346, 346) + .addGap(360, 360, 360) .addComponent(newRuleButton) .addGap(18, 18, 18) .addComponent(editRuleButton) .addGap(18, 18, 18) .addComponent(deleteRuleButton)) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(354, 354, 354) - .addComponent(jLabel4))) - .addContainerGap(26, Short.MAX_VALUE)) + .addGap(456, 456, 456) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(fileNameRadioButton) + .addGap(4, 4, 4) + .addComponent(fileNameExtensionRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(fileNameRegexCheckbox)) + .addComponent(rulePathConditionRegexCheckBox)))) + .addGap(20, 20, 20)) ); - - jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {fileNameTextField, mimeTypeComboBox, rulePathConditionTextField}); - jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(separator) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(jLabel6) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel5) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ignoreKnownFilesCheckbox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rulesListLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newRuleButton) - .addComponent(editRuleButton) - .addComponent(deleteRuleButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1) - .addGap(2, 2, 2) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent(filesRadioButton) - .addComponent(dirsRadioButton) - .addComponent(bothRadioButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel3) - .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(fileNameRadioButton) - .addComponent(fileNameExtensionRadioButton) - .addComponent(fileNameRegexCheckbox)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(setsListLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(newSetButton) + .addComponent(editSetButton) + .addComponent(deleteSetButton))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel6) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ignoreKnownFilesCheckbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rulesListLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(newRuleButton) + .addComponent(editRuleButton) + .addComponent(deleteRuleButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addGap(2, 2, 2) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(filesRadioButton) + .addComponent(dirsRadioButton) + .addComponent(bothRadioButton)) + .addGap(16, 16, 16) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(fileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(fileNameRadioButton) + .addComponent(fileNameExtensionRadioButton) + .addComponent(fileNameRegexCheckbox)))) + .addGap(14, 14, 14) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(rulePathConditionRegexCheckBox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(10, 10, 10) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(9, 9, 9) + .addGap(16, 16, 16) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 444, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(setsListLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newSetButton) - .addComponent(editSetButton) - .addComponent(deleteSetButton))))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap()) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deleteRuleButton, deleteSetButton, editRuleButton, editSetButton, newRuleButton, newSetButton}); @@ -844,14 +851,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 710, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 20, Short.MAX_VALUE)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 728, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 34, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 468, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 11, Short.MAX_VALUE)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE) ); }// //GEN-END:initComponents @@ -905,6 +910,10 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.doFilesSetRuleDialog(null); }//GEN-LAST:event_newRuleButtonActionPerformed + private void fileNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTextFieldActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_fileNameTextFieldActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton bothRadioButton; private javax.swing.JButton deleteRuleButton; From 2280e1005a1df8cc3b427da56f9d277987f9fee3 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Fri, 19 Feb 2016 16:50:40 -0500 Subject: [PATCH 04/32] UI Updates --- .../interestingitems/Bundle.properties | 7 +- .../interestingitems/Bundle_ja.properties | 3 - .../interestingitems/FilesSetRulePanel.form | 106 ++++----- .../interestingitems/FilesSetRulePanel.java | 214 +++++++++++------- .../InterestingItemDefsPanel.form | 1 - .../InterestingItemDefsPanel.java | 38 ++-- 6 files changed, 201 insertions(+), 168 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 88de28993b..979d52c648 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -26,11 +26,8 @@ FilesSetRulePanel.messages.invalidNameRegex=The name regular expression is not v FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidPathRegex=The path regular expression is not valid:\n\n{0} -FilesSetRulePanel.dirsRadioButton.text=Directories -FilesSetRulePanel.filesRadioButton.text=Files InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists. FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator -FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. @@ -64,4 +61,6 @@ InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.mimeCheck.text=MIME Type: -FilesSetRulePanel.fileCheck.text=File Size: +FilesSetRulePanel.filesCheck.text=Files +FilesSetRulePanel.directoriesCheck.text=Directories +FilesSetRulePanel.fileSizeCheck.text=File Size: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 146458ca0b..1cc779b485 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -5,10 +5,7 @@ FilesSetPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u306f\u540d\u524d\u304c\u5fc5\u8981\u3067\u3059\u3002 FilesSetPanel.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8 -FilesSetRulePanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f -FilesSetRulePanel.filesAndDirsRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -FilesSetRulePanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index ba8ac2492b..4c2f046fbb 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -27,24 +27,24 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -81,7 +81,7 @@ - + @@ -107,9 +107,8 @@ - - - + + @@ -142,7 +141,7 @@ - + @@ -179,45 +178,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -298,9 +258,12 @@ + + + - + @@ -366,14 +329,35 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 537c67008c..3843a27c14 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -18,8 +18,9 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.ArrayList; -import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -27,7 +28,9 @@ import java.util.SortedSet; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import javax.swing.AbstractButton; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JOptionPane; import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MimeTypes; import org.openide.DialogDisplayer; @@ -55,6 +58,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS private static final List ILLEGAL_FILE_NAME_CHARS = InterestingItemDefsManager.getIllegalFileNameChars(); private static final List ILLEGAL_FILE_PATH_CHARS = InterestingItemDefsManager.getIllegalFilePathChars(); + private JButton okButton; + private JButton cancelButton; /** * Constructs a files set rule panel in create rule mode. @@ -83,7 +88,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * Populates the UI components with default values. */ private void populateComponentsWithDefaultValues() { - this.filesRadioButton.setSelected(true); + this.filesCheck.setSelected(true); this.fullNameRadioButton.setSelected(true); this.equalitySymbolComboBox.setSelectedIndex(2); this.fileSizeComboBox.setSelectedIndex(1); @@ -117,6 +122,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { for (String file : toSort) { mimeTypeComboBox.addItem(file); } + this.setOkButton(); } /** @@ -128,6 +134,55 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.ruleNameTextField.setText(rule.getName()); } + private void setOkButton() { + if (this.okButton != null) { + if (!(this.filesCheck.isSelected() || this.directoriesCheck.isSelected()) + || !(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() + || this.nameCheck.isSelected() || this.pathCheck.isSelected())) { + this.okButton.setEnabled(false); + } + else { + this.okButton.setEnabled(true); + } + } + } + + private JOptionPane getOptionPane(JComponent parent) { + JOptionPane pane = null; + if (!(parent instanceof JOptionPane)) { + pane = getOptionPane((JComponent) parent.getParent()); + } else { + pane = (JOptionPane) parent; + } + return pane; + } + + /** + * Sets the buttons for ending the panel + * + * @param ok The ok button + * @param cancel The cancel button + */ + public void setButtons(JButton ok, JButton cancel) { + this.okButton = ok; + this.cancelButton = cancel; + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JOptionPane pane = getOptionPane(okButton); + pane.setValue(okButton); + } + }); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JOptionPane pane = getOptionPane(cancelButton); + pane.setValue(cancelButton); + } + }); + this.setOkButton(); + } + /** * Populates the UI components that display the meta-type condition for a * rule. @@ -138,13 +193,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); switch (typeCondition.getMetaType()) { case FILES: - this.filesRadioButton.setSelected(true); + this.filesCheck.setSelected(true); break; case DIRECTORIES: - this.dirsRadioButton.setSelected(true); + this.directoriesCheck.setSelected(true); break; case FILES_AND_DIRECTORIES: - this.filesAndDirsRadioButton.setSelected(true); + this.filesCheck.setSelected(true); + this.directoriesCheck.setSelected(true); break; } } @@ -335,9 +391,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @return A type condition. */ FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() { - if (this.filesRadioButton.isSelected()) { + if (this.filesCheck.isSelected() && !this.directoriesCheck.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - } else if (this.dirsRadioButton.isSelected()) { + } else if (this.directoriesCheck.isSelected() && !this.filesCheck.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); } else { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); @@ -407,7 +463,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * state of the UI components in the type button group. */ private void setComponentsForSearchType() { - if (!this.filesRadioButton.isSelected()) { + if (this.directoriesCheck.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); this.mimeTypeComboBox.setEnabled(false); @@ -416,14 +472,14 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.fileSizeComboBox.setEnabled(false); this.fileSizeSpinner.setEnabled(false); this.fileSizeSpinner.setValue(0); - this.fileCheck.setEnabled(false); - this.fileCheck.setSelected(false); + this.fileSizeCheck.setEnabled(false); + this.fileSizeCheck.setSelected(false); this.mimeCheck.setEnabled(false); this.mimeCheck.setSelected(false); } else { this.extensionRadioButton.setEnabled(true); - this.fileCheck.setEnabled(true); + this.fileSizeCheck.setEnabled(true); this.mimeCheck.setEnabled(true); } } @@ -442,9 +498,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { ruleNameLabel = new javax.swing.JLabel(); ruleNameTextField = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); - dirsRadioButton = new javax.swing.JRadioButton(); - filesRadioButton = new javax.swing.JRadioButton(); - filesAndDirsRadioButton = new javax.swing.JRadioButton(); nameTextField = new javax.swing.JTextField(); fullNameRadioButton = new javax.swing.JRadioButton(); extensionRadioButton = new javax.swing.JRadioButton(); @@ -460,7 +513,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { nameCheck = new javax.swing.JCheckBox(); pathCheck = new javax.swing.JCheckBox(); mimeCheck = new javax.swing.JCheckBox(); - fileCheck = new javax.swing.JCheckBox(); + fileSizeCheck = new javax.swing.JCheckBox(); + filesCheck = new javax.swing.JCheckBox(); + directoriesCheck = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N @@ -473,30 +528,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel1.text")); // NOI18N - typeButtonGroup.add(dirsRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadioButton.text")); // NOI18N - dirsRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - dirsRadioButtonActionPerformed(evt); - } - }); - - typeButtonGroup.add(filesRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadioButton.text")); // NOI18N - filesRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - filesRadioButtonActionPerformed(evt); - } - }); - - typeButtonGroup.add(filesAndDirsRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadioButton.text")); // NOI18N - filesAndDirsRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - filesAndDirsRadioButtonActionPerformed(evt); - } - }); - nameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameTextField.text")); // NOI18N nameTextField.setEnabled(false); @@ -526,6 +557,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); + mimeTypeComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mimeTypeComboBoxActionPerformed(evt); + } + }); equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySymbolComboBox.setEnabled(false); @@ -557,10 +593,25 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - org.openide.awt.Mnemonics.setLocalizedText(fileCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileCheck.text")); // NOI18N - fileCheck.addActionListener(new java.awt.event.ActionListener() { + org.openide.awt.Mnemonics.setLocalizedText(fileSizeCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fileSizeCheck.text")); // NOI18N + fileSizeCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - fileCheckActionPerformed(evt); + fileSizeCheckActionPerformed(evt); + } + }); + + filesCheck.setSelected(true); + org.openide.awt.Mnemonics.setLocalizedText(filesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesCheck.text")); // NOI18N + filesCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + filesCheckActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(directoriesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.directoriesCheck.text")); // NOI18N + directoriesCheck.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + directoriesCheckActionPerformed(evt); } }); @@ -573,21 +624,20 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addGap(8, 8, 8) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(filesRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(filesAndDirsRadioButton)) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel5) - .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(64, 64, 64) + .addComponent(filesCheck) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(directoriesCheck)) + .addComponent(jLabel5)) + .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(nameCheck) @@ -616,7 +666,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(mimeCheck) - .addComponent(fileCheck)) + .addComponent(fileSizeCheck)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() @@ -635,9 +685,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(filesRadioButton) - .addComponent(dirsRadioButton) - .addComponent(filesAndDirsRadioButton)) + .addComponent(filesCheck) + .addComponent(directoriesCheck)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -664,7 +713,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addComponent(equalitySymbolComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(fileCheck)) + .addComponent(fileSizeCheck)) .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -673,18 +722,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { ); }// //GEN-END:initComponents - private void filesAndDirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioButtonActionPerformed - setComponentsForSearchType(); - }//GEN-LAST:event_filesAndDirsRadioButtonActionPerformed - - private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed - setComponentsForSearchType(); - }//GEN-LAST:event_dirsRadioButtonActionPerformed - - private void filesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioButtonActionPerformed - setComponentsForSearchType(); - }//GEN-LAST:event_filesRadioButtonActionPerformed - private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ruleNameTextFieldActionPerformed @@ -702,6 +739,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.extensionRadioButton.setEnabled(true); this.nameRegexCheckbox.setEnabled(true); } + this.setOkButton(); }//GEN-LAST:event_nameCheckActionPerformed private void pathCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pathCheckActionPerformed @@ -715,6 +753,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.pathRegexCheckBox.setEnabled(true); this.pathSeparatorInfoLabel.setEnabled(true); } + this.setOkButton(); }//GEN-LAST:event_pathCheckActionPerformed private void mimeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeCheckActionPerformed @@ -724,10 +763,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } else { this.mimeTypeComboBox.setEnabled(true); } + this.setOkButton(); }//GEN-LAST:event_mimeCheckActionPerformed - private void fileCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileCheckActionPerformed - if (!this.fileCheck.isSelected()) { + private void fileSizeCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSizeCheckActionPerformed + if (!this.fileSizeCheck.isSelected()) { this.fileSizeComboBox.setEnabled(false); this.fileSizeSpinner.setEnabled(false); this.fileSizeSpinner.setValue(0); @@ -737,22 +777,36 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.fileSizeSpinner.setEnabled(true); this.equalitySymbolComboBox.setEnabled(true); } - }//GEN-LAST:event_fileCheckActionPerformed + this.setOkButton(); + }//GEN-LAST:event_fileSizeCheckActionPerformed + + private void filesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesCheckActionPerformed + this.setComponentsForSearchType(); + this.setOkButton(); + }//GEN-LAST:event_filesCheckActionPerformed + + private void directoriesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directoriesCheckActionPerformed + this.setComponentsForSearchType(); + this.setOkButton(); + }//GEN-LAST:event_directoriesCheckActionPerformed + + private void mimeTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeTypeComboBoxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_mimeTypeComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JRadioButton dirsRadioButton; + private javax.swing.JCheckBox directoriesCheck; private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; - private javax.swing.JCheckBox fileCheck; + private javax.swing.JCheckBox fileSizeCheck; private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; - private javax.swing.JRadioButton filesAndDirsRadioButton; - private javax.swing.JRadioButton filesRadioButton; + private javax.swing.JCheckBox filesCheck; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel5; private javax.swing.JCheckBox mimeCheck; - private javax.swing.JComboBox mimeTypeComboBox; + private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.ButtonGroup nameButtonGroup; private javax.swing.JCheckBox nameCheck; private javax.swing.JCheckBox nameRegexCheckbox; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 3a09c7c846..1c099595bd 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -293,7 +293,6 @@ - diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index c6bacc0bb1..f727ae11f4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -30,6 +30,7 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.logging.Level; import javax.swing.DefaultListModel; +import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -43,22 +44,24 @@ import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MimeTypes; import org.sleuthkit.autopsy.coreutils.Logger; - /** * A panel that allows a user to make interesting item definitions. */ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { + @NbBundle.Messages({ - "InterestingItemDefsPanel.bytes=Bytes", - "InterestingItemDefsPanel.kiloBytes=Kilobytes", - "InterestingItemDefsPanel.megaBytes=Megabytes", - "InterestingItemDefsPanel.gigaBytes=Gigabytes" - }) + "InterestingItemDefsPanel.bytes=Bytes", + "InterestingItemDefsPanel.kiloBytes=Kilobytes", + "InterestingItemDefsPanel.megaBytes=Megabytes", + "InterestingItemDefsPanel.gigaBytes=Gigabytes" + }) private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); private final DefaultListModel setsListModel = new DefaultListModel<>(); private final DefaultListModel rulesListModel = new DefaultListModel<>(); private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName()); + private JButton okButton = new JButton("OK"); + private JButton cancelButton = new JButton("Cancel"); // The following is a map of interesting files set names to interesting // files set definitions. It is a snapshot of the files set definitions @@ -80,7 +83,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.rulesList.setModel(rulesListModel); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); } - + private void customInit() { Set fileTypesCollated = new HashSet<>(); for (MediaType mediaType : mediaTypes) { @@ -290,8 +293,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * respond to user interactions with the dialog. * * @param selectedSet The currently selected files set, may be null to - * indicate a new interesting files set definition is to - * be created. + * indicate a new interesting files set definition is to be created. */ private void doFileSetsDialog(FilesSet selectedSet) { // Create a files set defintion panle. @@ -338,7 +340,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * dialog box and respond to user interactions with the dialog. * * @param selectedRule The currently selected rule, may be null to indicate - * a new rule definition is to be created. + * a new rule definition is to be created. */ private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) { // Create a files set rule panel. @@ -350,13 +352,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Creating a new rule definition. panel = new FilesSetRulePanel(); } - + panel.setButtons(okButton, cancelButton); // Do a dialog box with the files set panel until the user either enters // a valid definition or cancels. Note that the panel gives the user // feedback when isValidDefinition() is called. int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); + option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition()); if (option == JOptionPane.OK_OPTION) { @@ -392,13 +394,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * owned by this panel. If there is a definition with the same name, it will * be replaced, so this is an add/edit operation. * - * @param oldSet A set to replace, null if the new set is not a - * replacement. - * @param name The name of the files set. - * @param description The description of the files set. + * @param oldSet A set to replace, null if the new set is not a replacement. + * @param name The name of the files set. + * @param description The description of the files set. * @param ignoresKnownFiles Whether or not the files set ignores known - * files. - * @param rules The set membership rules for the set. + * files. + * @param rules The set membership rules for the set. */ void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules) { if (oldSet != null) { @@ -489,7 +490,6 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newRuleButton.text")); // NOI18N - newRuleButton.setEnabled(false); newRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newRuleButtonActionPerformed(evt); From dbdfedae016c8b6e5ea758e651bed27a7d4ee1a4 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Mon, 22 Feb 2016 10:11:46 -0500 Subject: [PATCH 05/32] Working back to using radio buttons --- Core/nbproject/project.xml | 9 ++ .../interestingitems/Bundle.properties | 5 +- .../interestingitems/FilesSetRulePanel.form | 60 +++++++----- .../interestingitems/FilesSetRulePanel.java | 96 +++++++++---------- 4 files changed, 93 insertions(+), 77 deletions(-) diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index a2ddc46460..9e144a3a62 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -6,6 +6,15 @@ org.sleuthkit.autopsy.core + + org.jdesktop.beansbinding + + + + 1 + 1.24.1.121 + + org.netbeans.api.progress diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 979d52c648..85403fb1d2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -61,6 +61,7 @@ InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.mimeCheck.text=MIME Type: -FilesSetRulePanel.filesCheck.text=Files -FilesSetRulePanel.directoriesCheck.text=Directories FilesSetRulePanel.fileSizeCheck.text=File Size: +FilesSetRulePanel.filesRadio.text=Files +FilesSetRulePanel.dirsRadio.text=Directories +FilesSetRulePanel.filesAndDirsRadio.text=Files and Directories diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index 4c2f046fbb..f3aee5608b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -33,18 +33,18 @@ - - - - - - - - - - + + + + + + + + + + @@ -107,10 +107,11 @@ - - + + + - + @@ -131,7 +132,7 @@ - + @@ -339,26 +340,35 @@ - + - - + - - - + + + - + - + - - - + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 3843a27c14..fdbd458319 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -88,7 +88,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * Populates the UI components with default values. */ private void populateComponentsWithDefaultValues() { - this.filesCheck.setSelected(true); + this.filesRadio.setSelected(true); this.fullNameRadioButton.setSelected(true); this.equalitySymbolComboBox.setSelectedIndex(2); this.fileSizeComboBox.setSelectedIndex(1); @@ -136,8 +136,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private void setOkButton() { if (this.okButton != null) { - if (!(this.filesCheck.isSelected() || this.directoriesCheck.isSelected()) - || !(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() + if (!(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() || this.nameCheck.isSelected() || this.pathCheck.isSelected())) { this.okButton.setEnabled(false); } @@ -193,14 +192,13 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); switch (typeCondition.getMetaType()) { case FILES: - this.filesCheck.setSelected(true); + this.filesRadio.setSelected(true); break; case DIRECTORIES: - this.directoriesCheck.setSelected(true); + this.dirsRadio.setSelected(true); break; case FILES_AND_DIRECTORIES: - this.filesCheck.setSelected(true); - this.directoriesCheck.setSelected(true); + this.filesAndDirsRadio.setSelected(true); break; } } @@ -391,9 +389,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @return A type condition. */ FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() { - if (this.filesCheck.isSelected() && !this.directoriesCheck.isSelected()) { + if (this.filesRadio.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - } else if (this.directoriesCheck.isSelected() && !this.filesCheck.isSelected()) { + } else if (this.dirsRadio.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); } else { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); @@ -463,7 +461,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * state of the UI components in the type button group. */ private void setComponentsForSearchType() { - if (this.directoriesCheck.isSelected()) { + if (this.dirsRadio.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); this.mimeTypeComboBox.setEnabled(false); @@ -492,6 +490,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { + bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); nameButtonGroup = new javax.swing.ButtonGroup(); typeButtonGroup = new javax.swing.ButtonGroup(); @@ -514,8 +513,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { pathCheck = new javax.swing.JCheckBox(); mimeCheck = new javax.swing.JCheckBox(); fileSizeCheck = new javax.swing.JCheckBox(); - filesCheck = new javax.swing.JCheckBox(); - directoriesCheck = new javax.swing.JCheckBox(); + filesRadio = new javax.swing.JRadioButton(); + dirsRadio = new javax.swing.JRadioButton(); + filesAndDirsRadio = new javax.swing.JRadioButton(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N @@ -600,20 +600,20 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - filesCheck.setSelected(true); - org.openide.awt.Mnemonics.setLocalizedText(filesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesCheck.text")); // NOI18N - filesCheck.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - filesCheckActionPerformed(evt); - } - }); + org.openide.awt.Mnemonics.setLocalizedText(filesRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadio.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(directoriesCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.directoriesCheck.text")); // NOI18N - directoriesCheck.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - directoriesCheckActionPerformed(evt); - } - }); + org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, typeButtonGroup, org.jdesktop.beansbinding.ObjectProperty.create(), filesRadio, org.jdesktop.beansbinding.BeanProperty.create("selected")); + bindingGroup.addBinding(binding); + + org.openide.awt.Mnemonics.setLocalizedText(dirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadio.text")); // NOI18N + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, typeButtonGroup, org.jdesktop.beansbinding.ObjectProperty.create(), dirsRadio, org.jdesktop.beansbinding.BeanProperty.create("selected")); + bindingGroup.addBinding(binding); + + org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadio.text")); // NOI18N + + binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, typeButtonGroup, org.jdesktop.beansbinding.ObjectProperty.create(), filesAndDirsRadio, org.jdesktop.beansbinding.BeanProperty.create("selected")); + bindingGroup.addBinding(binding); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -629,15 +629,16 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1) - .addGap(64, 64, 64) - .addComponent(filesCheck) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(directoriesCheck)) - .addComponent(jLabel5)) - .addGap(0, 0, Short.MAX_VALUE)))) + .addComponent(jLabel5) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(65, 65, 65) + .addComponent(filesRadio) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(dirsRadio) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(filesAndDirsRadio)))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(nameCheck) @@ -685,9 +686,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(filesCheck) - .addComponent(directoriesCheck)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(filesRadio) + .addComponent(dirsRadio) + .addComponent(filesAndDirsRadio)) + .addGap(5, 5, 5) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(nameCheck)) @@ -704,7 +706,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(pathRegexCheckBox) .addComponent(pathSeparatorInfoLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mimeCheck)) @@ -720,6 +722,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); + + bindingGroup.bind(); }// //GEN-END:initComponents private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed @@ -780,28 +784,19 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.setOkButton(); }//GEN-LAST:event_fileSizeCheckActionPerformed - private void filesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesCheckActionPerformed - this.setComponentsForSearchType(); - this.setOkButton(); - }//GEN-LAST:event_filesCheckActionPerformed - - private void directoriesCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directoriesCheckActionPerformed - this.setComponentsForSearchType(); - this.setOkButton(); - }//GEN-LAST:event_directoriesCheckActionPerformed - private void mimeTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeTypeComboBoxActionPerformed // TODO add your handling code here: }//GEN-LAST:event_mimeTypeComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JCheckBox directoriesCheck; + private javax.swing.JRadioButton dirsRadio; private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; private javax.swing.JCheckBox fileSizeCheck; private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; - private javax.swing.JCheckBox filesCheck; + private javax.swing.JRadioButton filesAndDirsRadio; + private javax.swing.JRadioButton filesRadio; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel5; @@ -818,5 +813,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private javax.swing.JLabel ruleNameLabel; private javax.swing.JTextField ruleNameTextField; private javax.swing.ButtonGroup typeButtonGroup; + private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration//GEN-END:variables } From f824131d6517ae3acdb66bd37beb0787e4dd598f Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Mon, 22 Feb 2016 11:36:38 -0500 Subject: [PATCH 06/32] Finished moving back to radio buttons --- .../interestingitems/FilesSetRulePanel.form | 40 ++++++++++--------- .../interestingitems/FilesSetRulePanel.java | 37 +++++++---------- .../InterestingItemDefsPanel.form | 11 +++++ .../InterestingItemDefsPanel.java | 5 +++ 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index f3aee5608b..75f9965d32 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -33,18 +33,20 @@ - + + + + + + + + + + + + - - - - - - - - - @@ -342,33 +344,33 @@ + + + - - - + + + - - - + + + - - - diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index fdbd458319..ae3acd545d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -490,7 +490,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { - bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); nameButtonGroup = new javax.swing.ButtonGroup(); typeButtonGroup = new javax.swing.ButtonGroup(); @@ -600,21 +599,15 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); + typeButtonGroup.add(filesRadio); org.openide.awt.Mnemonics.setLocalizedText(filesRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadio.text")); // NOI18N - org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, typeButtonGroup, org.jdesktop.beansbinding.ObjectProperty.create(), filesRadio, org.jdesktop.beansbinding.BeanProperty.create("selected")); - bindingGroup.addBinding(binding); - + typeButtonGroup.add(dirsRadio); org.openide.awt.Mnemonics.setLocalizedText(dirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadio.text")); // NOI18N - binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, typeButtonGroup, org.jdesktop.beansbinding.ObjectProperty.create(), dirsRadio, org.jdesktop.beansbinding.BeanProperty.create("selected")); - bindingGroup.addBinding(binding); - + typeButtonGroup.add(filesAndDirsRadio); org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadio.text")); // NOI18N - binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, typeButtonGroup, org.jdesktop.beansbinding.ObjectProperty.create(), filesAndDirsRadio, org.jdesktop.beansbinding.BeanProperty.create("selected")); - bindingGroup.addBinding(binding); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -629,16 +622,17 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addComponent(jLabel5) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1) - .addGap(65, 65, 65) - .addComponent(filesRadio) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(dirsRadio) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filesAndDirsRadio)))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addGap(65, 65, 65) + .addComponent(filesRadio) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(dirsRadio) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(filesAndDirsRadio))) + .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(nameCheck) @@ -722,8 +716,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); - - bindingGroup.bind(); }// //GEN-END:initComponents private void ruleNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ruleNameTextFieldActionPerformed @@ -813,6 +805,5 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private javax.swing.JLabel ruleNameLabel; private javax.swing.JTextField ruleNameTextField; private javax.swing.ButtonGroup typeButtonGroup; - private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration//GEN-END:variables } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 1c099595bd..26762d98c5 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -4,6 +4,8 @@ + + @@ -300,6 +302,9 @@ + + + @@ -585,6 +590,9 @@ + + + @@ -666,6 +674,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index f727ae11f4..508c581913 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -436,6 +436,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private void initComponents() { fileNameButtonGroup = new javax.swing.ButtonGroup(); + typeButtonGroup = new javax.swing.ButtonGroup(); jScrollPane1 = new javax.swing.JScrollPane(); jPanel1 = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); @@ -496,6 +497,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp } }); + typeButtonGroup.add(filesRadioButton); filesRadioButton.setFont(filesRadioButton.getFont().deriveFont(filesRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); filesRadioButton.setSelected(true); org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.filesRadioButton.text")); // NOI18N @@ -593,6 +595,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.setsListLabel.text")); // NOI18N + typeButtonGroup.add(bothRadioButton); bothRadioButton.setFont(bothRadioButton.getFont().deriveFont(bothRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(bothRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.bothRadioButton.text")); // NOI18N bothRadioButton.setEnabled(false); @@ -629,6 +632,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel2.text")); // NOI18N + typeButtonGroup.add(dirsRadioButton); dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.dirsRadioButton.text")); // NOI18N dirsRadioButton.setEnabled(false); @@ -957,6 +961,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JList setsList; private javax.swing.JLabel setsListLabel; private javax.swing.JScrollPane setsListScrollPane; + private javax.swing.ButtonGroup typeButtonGroup; // End of variables declaration//GEN-END:variables } From 0fba2152daba209d6e299ca98b40ddcd59d61047 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Mon, 22 Feb 2016 15:43:09 -0500 Subject: [PATCH 07/32] Finished condition adding. --- .../modules/interestingitems/FilesSet.java | 115 ++++++++--- .../interestingitems/FilesSetRulePanel.form | 9 + .../interestingitems/FilesSetRulePanel.java | 113 ++++++++--- .../InterestingItemDefsManager.java | 178 +++++++----------- .../InterestingItemDefsPanel.java | 32 +++- 5 files changed, 279 insertions(+), 168 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 0e8fff948b..2bcdc56de9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -257,7 +257,23 @@ final class FilesSet implements Serializable { public String toString() { // This override is designed to provide a display name for use with // javax.swing.DefaultListModel. - return this.ruleName + " (" + fileNameCondition.getTextToMatch() + ")"; + if(fileNameCondition != null) { + return this.ruleName + " (" + fileNameCondition.getTextToMatch() + ")"; + } + else if (this.pathCondition != null) { + return this.ruleName + " (" + pathCondition.getTextToMatch() + ")"; + } + else if (this.mimeTypeCondition != null) { + return this.ruleName + " (" + mimeTypeCondition.getMimeType() + ")"; + } + else if (this.fileSizeCondition != null) { + return this.ruleName + " (" + fileSizeCondition.getComparator().getSymbol() + " " + fileSizeCondition.getSizeValue() + + " " + fileSizeCondition.getUnit().getName() + ")"; + } + else { + return this.ruleName + " ()"; + } + } /** @@ -274,6 +290,13 @@ final class FilesSet implements Serializable { return mimeTypeCondition; } + /** + * @return the fileSizeCondition + */ + public FileSizeCondition getFileSizeCondition() { + return fileSizeCondition; + } + /** * An interface for the file attribute conditions of which interesting * files set membership rules are composed. @@ -331,13 +354,40 @@ final class FilesSet implements Serializable { private static final long serialVersionUID = 1L; + /** + * @return the comparator + */ + public COMPARATOR getComparator() { + return comparator; + } + + /** + * @return the unit + */ + public SIZE_UNIT getUnit() { + return unit; + } + + /** + * @return the sizeValue + */ + public int getSizeValue() { + return sizeValue; + } + static enum COMPARATOR { - LESS_THAN, - LESS_THAN_EQUAL, - EQUAL, - GREATER_THAN, - GREATER_THAN_EQUAL; + LESS_THAN("<"), + LESS_THAN_EQUAL("≤"), + EQUAL("="), + GREATER_THAN(">"), + GREATER_THAN_EQUAL("≥"); + + private String symbol; + + COMPARATOR(String symbol) { + this.symbol = symbol; + } public static COMPARATOR fromSymbol(String symbol) { if (symbol.equals("<=") || symbol.equals("≤")) { @@ -354,18 +404,27 @@ final class FilesSet implements Serializable { throw new IllegalArgumentException("Invalid symbol"); } } + + /** + * @return the symbol + */ + public String getSymbol() { + return symbol; + } } static enum SIZE_UNIT { - BYTE(1), - KILOBYTE(1024), - MEGABYTE(1024 * 1024), - GIGABYTE(1024 * 1024 * 1024); + BYTE(1, "Bytes"), + KILOBYTE(1024, "Kilobytes"), + MEGABYTE(1024 * 1024, "Megabytes"), + GIGABYTE(1024 * 1024 * 1024, "Gigabytes"); private long size; + private String name; - private SIZE_UNIT(long size) { + private SIZE_UNIT(long size, String name) { this.size = size; + this.name = name; } public long getSize() { @@ -373,24 +432,26 @@ final class FilesSet implements Serializable { } public static SIZE_UNIT fromName(String name) { - if (name.equals("Bytes")) { - return BYTE; - } else if (name.equals("Kilobytes")) { - return KILOBYTE; - } else if (name.equals("Megabytes")) { - return MEGABYTE; - } else if (name.equals("Gigabytes")) { - return GIGABYTE; - } else { - throw new IllegalArgumentException("Invalid symbol"); + for (SIZE_UNIT unit : SIZE_UNIT.values()) { + if (unit.getName().equals(name)) { + return unit; + } } + throw new IllegalArgumentException("Invalid name for size unit."); + } + + /** + * @return the name + */ + public String getName() { + return name; } } private COMPARATOR comparator; private SIZE_UNIT unit; private int sizeValue; - FileSizeCondition(COMPARATOR comparator, SIZE_UNIT uint, int sizeValue) { + FileSizeCondition(COMPARATOR comparator, SIZE_UNIT unit, int sizeValue) { this.comparator = comparator; this.unit = unit; this.sizeValue = sizeValue; @@ -399,8 +460,8 @@ final class FilesSet implements Serializable { @Override public boolean passes(AbstractFile file) { long fileSize = file.getSize(); - long conditionSize = this.unit.getSize() * this.sizeValue; - switch (this.comparator) { + long conditionSize = this.getUnit().getSize() * this.getSizeValue(); + switch (this.getComparator()) { case GREATER_THAN: return fileSize > conditionSize; case GREATER_THAN_EQUAL: @@ -508,7 +569,6 @@ final class FilesSet implements Serializable { */ private static abstract class AbstractTextCondition implements TextCondition { - private static final long serialVersionUID = 1L; private final TextMatcher textMatcher; /** @@ -702,7 +762,7 @@ final class FilesSet implements Serializable { * An interface for objects that do textual matches, used to compose a * text condition. */ - private static interface TextMatcher { + private static interface TextMatcher extends Serializable { /** * Get the text the matcher examines. @@ -736,6 +796,7 @@ final class FilesSet implements Serializable { */ private static class CaseInsensitiveStringComparisionMatcher implements TextMatcher { + private static final long serialVersionUID = 1L; private final String textToMatch; /** @@ -779,6 +840,7 @@ final class FilesSet implements Serializable { */ private static class CaseInsensitivePartialStringComparisionMatcher implements TextMatcher { + private static final long serialVersionUID = 1L; private final String textToMatch; private final Pattern pattern; @@ -823,6 +885,7 @@ final class FilesSet implements Serializable { */ private static class RegexMatcher implements TextMatcher { + private static final long serialVersionUID = 1L; private final Pattern regex; /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index 75f9965d32..ee526067d5 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -351,6 +351,9 @@ + + + @@ -361,6 +364,9 @@ + + + @@ -371,6 +377,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index ae3acd545d..481a3debaf 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -50,7 +50,12 @@ final class FilesSetRulePanel extends javax.swing.JPanel { "FilesSetRulePanel.bytes=Bytes", "FilesSetRulePanel.kiloBytes=Kilobytes", "FilesSetRulePanel.megaBytes=Megabytes", - "FilesSetRulePanel.gigaBytes=Gigabytes" + "FilesSetRulePanel.gigaBytes=Gigabytes", + "FilesSetRulePanel.NoConditionError=Must have at least one condition to make a rule.", + "FilesSetRulePanel.NoMimeTypeError=Please select a valid MIME type.", + "FilesSetRulePanel.NoNameError=Name cannot be empty", + "FilesSetRulePanel.NoPathError=Path cannot be empty", + "FilesSetRulePanel.ZeroFileSizeError=File size condition value must not be 0." }) private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); @@ -139,8 +144,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { if (!(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() || this.nameCheck.isSelected() || this.pathCheck.isSelected())) { this.okButton.setEnabled(false); - } - else { + } else { this.okButton.setEnabled(true); } } @@ -242,40 +246,55 @@ final class FilesSetRulePanel extends javax.swing.JPanel { */ boolean isValidRuleDefinition() { - // The rule must have name condition text. - if (this.nameTextField.getText().isEmpty()) { + if (!(this.mimeCheck.isSelected() || this.fileSizeCheck.isSelected() || this.pathCheck.isSelected() || this.nameCheck.isSelected())) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( - NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.emptyNameCondition"), + Bundle.FilesSetRulePanel_NoConditionError(), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(notifyDesc); return false; } - // The name condition must either be a regular expression that compiles or - // a string without illegal file name chars. - if (this.nameRegexCheckbox.isSelected()) { - try { - Pattern.compile(this.nameTextField.getText()); - } catch (PatternSyntaxException ex) { + if (this.nameCheck.isSelected()) { + // The name condition must either be a regular expression that compiles or + // a string without illegal file name chars. + if (this.nameTextField.getText().isEmpty()) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( - NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidNameRegex", ex.getLocalizedMessage()), + Bundle.FilesSetRulePanel_NoNameError(), NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(notifyDesc); return false; } - } else { - if (!FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) { - NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( - NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInName"), - NotifyDescriptor.WARNING_MESSAGE); - DialogDisplayer.getDefault().notify(notifyDesc); - return false; + if (this.nameRegexCheckbox.isSelected()) { + try { + Pattern.compile(this.nameTextField.getText()); + } catch (PatternSyntaxException ex) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidNameRegex", ex.getLocalizedMessage()), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } + } else { + if (this.nameTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.nameTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_NAME_CHARS)) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInName"), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } } } // The path condition, if specified, must either be a regular expression - // that compiles or a string without illegal file path chars. - if (!this.pathTextField.getText().isEmpty()) { + // that compiles or a string without illegal file path chars. + if (this.pathCheck.isSelected()) { + if (this.pathTextField.getText().isEmpty()) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + Bundle.FilesSetRulePanel_NoPathError(), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } if (this.pathRegexCheckBox.isSelected()) { try { Pattern.compile(this.pathTextField.getText()); @@ -287,7 +306,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { return false; } } else { - if (!FilesSetRulePanel.containsOnlyLegalChars(this.pathTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_PATH_CHARS)) { + if (this.pathTextField.getText().isEmpty() || !FilesSetRulePanel.containsOnlyLegalChars(this.pathTextField.getText(), FilesSetRulePanel.ILLEGAL_FILE_PATH_CHARS)) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( NbBundle.getMessage(FilesSetPanel.class, "FilesSetRulePanel.messages.invalidCharInPath"), NotifyDescriptor.WARNING_MESSAGE); @@ -296,6 +315,24 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } } } + if (this.mimeCheck.isSelected()) { + if (this.mimeTypeComboBox.getSelectedIndex() == 0) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + Bundle.FilesSetRulePanel_NoMimeTypeError(), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } + } + if (this.fileSizeCheck.isSelected()) { + if ((Integer) this.fileSizeSpinner.getValue() == 0) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + Bundle.FilesSetRulePanel_ZeroFileSizeError(), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } + } return true; } @@ -461,7 +498,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * state of the UI components in the type button group. */ private void setComponentsForSearchType() { - if (this.dirsRadio.isSelected()) { + if (!this.filesRadio.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); this.mimeTypeComboBox.setEnabled(false); @@ -601,12 +638,27 @@ final class FilesSetRulePanel extends javax.swing.JPanel { typeButtonGroup.add(filesRadio); org.openide.awt.Mnemonics.setLocalizedText(filesRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadio.text")); // NOI18N + filesRadio.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + filesRadioActionPerformed(evt); + } + }); typeButtonGroup.add(dirsRadio); org.openide.awt.Mnemonics.setLocalizedText(dirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadio.text")); // NOI18N + dirsRadio.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + dirsRadioActionPerformed(evt); + } + }); typeButtonGroup.add(filesAndDirsRadio); org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadio.text")); // NOI18N + filesAndDirsRadio.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + filesAndDirsRadioActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -780,6 +832,19 @@ final class FilesSetRulePanel extends javax.swing.JPanel { // TODO add your handling code here: }//GEN-LAST:event_mimeTypeComboBoxActionPerformed + private void filesRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioActionPerformed + + this.setComponentsForSearchType(); + }//GEN-LAST:event_filesRadioActionPerformed + + private void dirsRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioActionPerformed + this.setComponentsForSearchType(); + }//GEN-LAST:event_dirsRadioActionPerformed + + private void filesAndDirsRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioActionPerformed + this.setComponentsForSearchType(); + }//GEN-LAST:event_filesAndDirsRadioActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton dirsRadio; private javax.swing.JComboBox equalitySymbolComboBox; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index a3fdc11926..6d967d545d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -19,6 +19,9 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -29,9 +32,13 @@ import java.util.Observable; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import javax.persistence.PersistenceException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.openide.util.Exceptions; +import org.openide.util.io.NbObjectInputStream; +import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil; @@ -50,6 +57,8 @@ final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); private static final String INTERESTING_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS + private static final String INTERESING_FILES_SET_DEFS_SERIALIZATION_NAME = "interestingFileSets.settings"; + private static final String INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESING_FILES_SET_DEFS_SERIALIZATION_NAME; private static final String DEFAULT_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_FILE_NAME; private static InterestingItemDefsManager instance; @@ -86,7 +95,7 @@ final class InterestingItemDefsManager extends Observable { * Gets a copy of the current interesting files set definitions. * * @return A map of interesting files set names to interesting file sets, - * possibly empty. + * possibly empty. */ synchronized Map getInterestingFilesSets() { return FilesSetXML.readDefinitionsFile(DEFAULT_FILE_SET_DEFS_PATH); @@ -97,10 +106,10 @@ final class InterestingItemDefsManager extends Observable { * previous definitions. * * @param filesSets A mapping of interesting files set names to files sets, - * used to enforce unique files set names. + * used to enforce unique files set names. */ synchronized void setInterestingFilesSets(Map filesSets) { - FilesSetXML.writeDefinitionsFile(DEFAULT_FILE_SET_DEFS_PATH, filesSets); + FilesSetXML.writeDefinitionsFile(INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH, filesSets); this.setChanged(); this.notifyObservers(); } @@ -167,7 +176,7 @@ final class InterestingItemDefsManager extends Observable { // Check if the file exists. File defsFile = new File(filePath); if (!defsFile.exists()) { - return filesSets; + return readSerializedDefinitions(); } // Check if the file can be read. @@ -195,16 +204,25 @@ final class InterestingItemDefsManager extends Observable { for (int i = 0; i < setElems.getLength(); ++i) { readFilesSet((Element) setElems.item(i), filesSets, filePath); } - return filesSets; } + private static Map readSerializedDefinitions() { + String filePath = INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH; + try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath.toString()))) { + Map filesSetMap = (Map) in.readObject(); + return filesSetMap; + } catch (IOException | ClassNotFoundException ex) { + throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); + } + } + /** * Reads in an interesting files set. * - * @param setElem An interesting files set XML element + * @param setElem An interesting files set XML element * @param filesSets A collection to which the set is to be added. - * @param filePath The source file, used for error reporting. + * @param filePath The source file, used for error reporting. */ private static void readFilesSet(Element setElem, Map filesSets, String filePath) { // The file set must have a unique name. @@ -279,11 +297,11 @@ final class InterestingItemDefsManager extends Observable { * XML element. * * @param filePath The path of the definitions file. - * @param setName The name of the files set. - * @param elem The file name rule XML element. + * @param setName The name of the files set. + * @param elem The file name rule XML element. * * @return A file name rule, or null if there is an error (the error is - * logged). + * logged). */ private static FilesSet.Rule readFileNameRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -292,12 +310,12 @@ final class InterestingItemDefsManager extends Observable { // regex, or it may be from a TSK Framework rule definition with a // "*" globbing char, or it may be simple text. String content = elem.getTextContent(); - FilesSet.Rule.FullNameCondition namecondition; + FilesSet.Rule.FullNameCondition nameCondition; String regex = elem.getAttribute(FilesSetXML.REGEX_ATTR); if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { // NON-NLS Pattern pattern = compileRegex(content); if (pattern != null) { - namecondition = new FilesSet.Rule.FullNameCondition(pattern); + nameCondition = new FilesSet.Rule.FullNameCondition(pattern); } else { logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.NAME_RULE_TAG + " regex, ignoring malformed '{0}' rule definition", ruleName); // NON-NLS return null; @@ -309,29 +327,29 @@ final class InterestingItemDefsManager extends Observable { return null; } } - namecondition = new FilesSet.Rule.FullNameCondition(content); + nameCondition = new FilesSet.Rule.FullNameCondition(content); } // Read in the type condition. - FilesSet.Rule.MetaTypeCondition metaTypecondition = FilesSetXML.readMetaTypecondition(elem); - if (metaTypecondition == null) { + FilesSet.Rule.MetaTypeCondition metaTypeCondition = FilesSetXML.readMetaTypeCondition(elem); + if (metaTypeCondition == null) { // Malformed attribute. return null; } // Read in the optional path condition. Null is o.k., but if the attribute // is there, be sure it is not malformed. - FilesSet.Rule.ParentPathCondition pathcondition = null; + FilesSet.Rule.ParentPathCondition pathCondition = null; if (!elem.getAttribute(FilesSetXML.PATH_FILTER_ATTR).isEmpty() || !elem.getAttribute(FilesSetXML.PATH_REGEX_ATTR).isEmpty()) { - pathcondition = FilesSetXML.readPathcondition(elem); - if (pathcondition == null) { + pathCondition = FilesSetXML.readPathCondition(elem); + if (pathCondition == null) { // Malformed attribute. return null; } } - return new FilesSet.Rule(ruleName, namecondition, metaTypecondition, pathcondition, null, null); + return new FilesSet.Rule(ruleName, nameCondition, metaTypeCondition, pathCondition, null, null); } /** @@ -341,7 +359,7 @@ final class InterestingItemDefsManager extends Observable { * @param elem The file name extension rule XML element. * * @return A file name extension rule, or null if there is an error (the - * error is logged). + * error is logged). */ private static FilesSet.Rule readFileExtensionRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -350,12 +368,12 @@ final class InterestingItemDefsManager extends Observable { // be a regex, or it may be from a TSK Framework rule definition // with a "*" globbing char. String content = elem.getTextContent(); - FilesSet.Rule.ExtensionCondition extcondition; + FilesSet.Rule.ExtensionCondition extCondition; String regex = elem.getAttribute(FilesSetXML.REGEX_ATTR); if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { // NON-NLS Pattern pattern = compileRegex(content); if (pattern != null) { - extcondition = new FilesSet.Rule.ExtensionCondition(pattern); + extCondition = new FilesSet.Rule.ExtensionCondition(pattern); } else { logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.EXTENSION_RULE_TAG + " regex, ignoring malformed {0} rule definition", ruleName); // NON-NLS return null; @@ -367,35 +385,35 @@ final class InterestingItemDefsManager extends Observable { return null; } } - extcondition = new FilesSet.Rule.ExtensionCondition(content); + extCondition = new FilesSet.Rule.ExtensionCondition(content); } // The rule must have a meta-type condition, unless a TSK Framework // definitions file is being read. - FilesSet.Rule.MetaTypeCondition metaTypecondition = null; + FilesSet.Rule.MetaTypeCondition metaTypeCondition = null; if (!elem.getAttribute(FilesSetXML.TYPE_FILTER_ATTR).isEmpty()) { - metaTypecondition = FilesSetXML.readMetaTypecondition(elem); - if (metaTypecondition == null) { + metaTypeCondition = FilesSetXML.readMetaTypeCondition(elem); + if (metaTypeCondition == null) { // Malformed attribute. return null; } } else { - metaTypecondition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + metaTypeCondition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } // The rule may have a path condition. Null is o.k., but if the attribute // is there, it must not be malformed. - FilesSet.Rule.ParentPathCondition pathcondition = null; + FilesSet.Rule.ParentPathCondition pathCondition = null; if (!elem.getAttribute(FilesSetXML.PATH_FILTER_ATTR).isEmpty() || !elem.getAttribute(FilesSetXML.PATH_REGEX_ATTR).isEmpty()) { - pathcondition = FilesSetXML.readPathcondition(elem); - if (pathcondition == null) { + pathCondition = FilesSetXML.readPathCondition(elem); + if (pathCondition == null) { // Malformed attribute. return null; } } - return new FilesSet.Rule(ruleName, extcondition, metaTypecondition, pathcondition, null, null); + return new FilesSet.Rule(ruleName, extCondition, metaTypeCondition, pathCondition, null, null); } /** @@ -428,14 +446,15 @@ final class InterestingItemDefsManager extends Observable { } /** - * Construct a meta-type condition for an interesting files set membership - * rule from data in an XML element. + * Construct a meta-type condition for an interesting files set + * membership rule from data in an XML element. * * @param ruleElement The XML element. * - * @return The meta-type condition, or null if there is an error (logged). + * @return The meta-type condition, or null if there is an error + * (logged). */ - private static FilesSet.Rule.MetaTypeCondition readMetaTypecondition(Element ruleElement) { + private static FilesSet.Rule.MetaTypeCondition readMetaTypeCondition(Element ruleElement) { FilesSet.Rule.MetaTypeCondition condition = null; String conditionAttribute = ruleElement.getAttribute(FilesSetXML.TYPE_FILTER_ATTR); if (!conditionAttribute.isEmpty()) { @@ -462,14 +481,14 @@ final class InterestingItemDefsManager extends Observable { } /** - * Construct a path condition for an interesting files set membership rule - * from data in an XML element. + * Construct a path condition for an interesting files set membership + * rule from data in an XML element. * * @param ruleElement The XML element. * * @return The path condition, or null if there is an error (logged). */ - private static FilesSet.Rule.ParentPathCondition readPathcondition(Element ruleElement) { + private static FilesSet.Rule.ParentPathCondition readPathCondition(Element ruleElement) { FilesSet.Rule.ParentPathCondition condition = null; String path = ruleElement.getAttribute(FilesSetXML.PATH_FILTER_ATTR); String pathRegex = ruleElement.getAttribute(FilesSetXML.PATH_REGEX_ATTR); @@ -499,84 +518,17 @@ final class InterestingItemDefsManager extends Observable { // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) { - DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); - try { - // Create the new XML document. - DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - Document doc = docBuilder.newDocument(); - Element rootElement = doc.createElement(FilesSetXML.FILE_SETS_ROOT_TAG); - doc.appendChild(rootElement); - - // Add the interesting files sets to the document. - for (FilesSet set : interestingFilesSets.values()) { - // Add the files set element and its attributes. - Element setElement = doc.createElement(FilesSetXML.FILE_SET_TAG); - setElement.setAttribute(FilesSetXML.NAME_ATTR, set.getName()); - setElement.setAttribute(FilesSetXML.DESC_ATTR, set.getDescription()); - setElement.setAttribute(FilesSetXML.IGNORE_KNOWN_FILES_ATTR, Boolean.toString(set.ignoresKnownFiles())); - - // Add the child elements for the set membership rules. - for (FilesSet.Rule rule : set.getRules().values()) { - // Add a rule element with the appropriate name condition - // type tag. - FilesSet.Rule.FileNameCondition namecondition = rule.getFileNameCondition(); - Element ruleElement; - if (namecondition instanceof FilesSet.Rule.FullNameCondition) { - ruleElement = doc.createElement(FilesSetXML.NAME_RULE_TAG); - } else { - ruleElement = doc.createElement(FilesSetXML.EXTENSION_RULE_TAG); - } - - // Add the rule name attribute. - ruleElement.setAttribute(FilesSetXML.NAME_ATTR, rule.getName()); - - // Add the name condition regex attribute - ruleElement.setAttribute(FilesSetXML.REGEX_ATTR, Boolean.toString(namecondition.isRegex())); - - // Add the type condition attribute. - FilesSet.Rule.MetaTypeCondition typecondition = rule.getMetaTypeCondition(); - switch (typecondition.getMetaType()) { - case FILES: - ruleElement.setAttribute(FilesSetXML.TYPE_FILTER_ATTR, FilesSetXML.TYPE_FILTER_VALUE_FILES); - break; - case DIRECTORIES: - ruleElement.setAttribute(FilesSetXML.TYPE_FILTER_ATTR, FilesSetXML.TYPE_FILTER_VALUE_DIRS); - break; - default: - ruleElement.setAttribute(FilesSetXML.TYPE_FILTER_ATTR, FilesSetXML.TYPE_FILTER_VALUE_FILES_AND_DIRS); - break; - } - - // Add the optional path condition. - FilesSet.Rule.ParentPathCondition pathcondition = rule.getPathCondition(); - if (pathcondition != null) { - if (pathcondition.isRegex()) { - ruleElement.setAttribute(FilesSetXML.PATH_REGEX_ATTR, pathcondition.getTextToMatch()); - } else { - ruleElement.setAttribute(FilesSetXML.PATH_FILTER_ATTR, pathcondition.getTextToMatch()); - } - } - - // Add the name condition text as the rule element content. - ruleElement.setTextContent(namecondition.getTextToMatch()); - - setElement.appendChild(ruleElement); - } - - rootElement.appendChild(setElement); + try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { + out.writeObject(interestingFilesSets); + File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); + if(xmlFile.exists()) { + xmlFile.delete(); } - - // Overwrite the previous definitions file. Note that the utility - // method logs an error on failure. - return XMLUtil.saveDoc(FilesSetXML.class, filePath, XML_ENCODING, doc); - - } catch (ParserConfigurationException ex) { - logger.log(Level.SEVERE, "Error writing interesting files definition file to " + filePath, ex); // NON-NLS - return false; + return true; + } catch (IOException ex) { + throw new PersistenceException(String.format("Failed to write settings to %s", filePath), ex); } - } - } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 508c581913..0455574ca2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -250,13 +250,22 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition(); FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition(); + FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition(); // Populate the components that display the properties of the // selected rule. - InterestingItemDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch()); - InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition); - InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition); - InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex()); + if (nameCondition != null) { + InterestingItemDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch()); + InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition); + InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition); + InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex()); + } + else { + InterestingItemDefsPanel.this.fileNameTextField.setText(""); + InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(true); + InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(false); + InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(false); + } switch (typeCondition.getMetaType()) { case FILES: InterestingItemDefsPanel.this.filesRadioButton.setSelected(true); @@ -275,7 +284,20 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp InterestingItemDefsPanel.this.rulePathConditionTextField.setText(""); InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false); } - InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); + if (mimeTypeCondition != null) { + InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); + } else { + InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedIndex(0); + } + if (fileSizeCondition != null) { + InterestingItemDefsPanel.this.fileSizeUnitComboBox.setSelectedItem(fileSizeCondition.getUnit().getName()); + InterestingItemDefsPanel.this.equalitySignComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol()); + InterestingItemDefsPanel.this.jSpinner1.setValue(fileSizeCondition.getSizeValue()); + } else { + InterestingItemDefsPanel.this.fileSizeUnitComboBox.setSelectedIndex(1); + InterestingItemDefsPanel.this.equalitySignComboBox.setSelectedIndex(2); + InterestingItemDefsPanel.this.jSpinner1.setValue(0); + } // Enable the new, edit and delete rule buttons. InterestingItemDefsPanel.this.newRuleButton.setEnabled(true); From 9e72dbd54b6a530d6baa7b4c2e22fc3db6242f03 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Mon, 22 Feb 2016 16:13:23 -0500 Subject: [PATCH 08/32] Updated javadocs --- .../modules/interestingitems/FilesSet.java | 34 +++++++++++++------ .../interestingitems/FilesSetRulePanel.java | 10 ++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 2bcdc56de9..64898da060 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -257,23 +257,19 @@ final class FilesSet implements Serializable { public String toString() { // This override is designed to provide a display name for use with // javax.swing.DefaultListModel. - if(fileNameCondition != null) { + if (fileNameCondition != null) { return this.ruleName + " (" + fileNameCondition.getTextToMatch() + ")"; - } - else if (this.pathCondition != null) { + } else if (this.pathCondition != null) { return this.ruleName + " (" + pathCondition.getTextToMatch() + ")"; - } - else if (this.mimeTypeCondition != null) { + } else if (this.mimeTypeCondition != null) { return this.ruleName + " (" + mimeTypeCondition.getMimeType() + ")"; - } - else if (this.fileSizeCondition != null) { + } else if (this.fileSizeCondition != null) { return this.ruleName + " (" + fileSizeCondition.getComparator().getSymbol() + " " + fileSizeCondition.getSizeValue() + " " + fileSizeCondition.getUnit().getName() + ")"; - } - else { + } else { return this.ruleName + " ()"; } - + } /** @@ -350,11 +346,17 @@ final class FilesSet implements Serializable { } + /** + * A class for checking whether a file's size is within the + * specifications given (i.e. < N Bytes). + */ static final class FileSizeCondition implements FileAttributeCondition { private static final long serialVersionUID = 1L; /** + * Gets the comparator of this condition + * * @return the comparator */ public COMPARATOR getComparator() { @@ -362,6 +364,8 @@ final class FilesSet implements Serializable { } /** + * Gets the unit for the size of this condition + * * @return the unit */ public SIZE_UNIT getUnit() { @@ -369,12 +373,17 @@ final class FilesSet implements Serializable { } /** - * @return the sizeValue + * Gets the size value of this condition + * + * @return the size value */ public int getSizeValue() { return sizeValue; } + /** + * Represents a comparison item for file size + */ static enum COMPARATOR { LESS_THAN("<"), @@ -413,6 +422,9 @@ final class FilesSet implements Serializable { } } + /** + * Represents the units of size + */ static enum SIZE_UNIT { BYTE(1, "Bytes"), diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 481a3debaf..db3b52cc72 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -139,6 +139,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.ruleNameTextField.setText(rule.getName()); } + /** + * Sets whether or not the OK button should be enabled based upon other UI + * elements + */ private void setOkButton() { if (this.okButton != null) { if (!(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() @@ -150,6 +154,12 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } } + /** + * Gets the JOptionPane that is used to contain this panel if there is one + * + * @param parent + * @return + */ private JOptionPane getOptionPane(JComponent parent) { JOptionPane pane = null; if (!(parent instanceof JOptionPane)) { From eb64a92eb60cb463d55d161b3dde45e5d3135a99 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 25 Feb 2016 12:38:04 -0500 Subject: [PATCH 09/32] Formatting fixes --- .../modules/interestingitems/FilesSet.java | 24 +++++++++---------- .../interestingitems/FilesSetRulePanel.java | 11 +++++---- .../InterestingItemDefsManager.java | 20 ++++++++-------- .../InterestingItemDefsPanel.java | 19 ++++++++------- 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 64898da060..779147be6f 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -47,12 +47,12 @@ final class FilesSet implements Serializable { /** * Constructs an interesting files set. * - * @param name The name of the set. - * @param description A description of the set, may be null. + * @param name The name of the set. + * @param description A description of the set, may be null. * @param ignoreKnownFiles Whether or not to exclude known files from the - * set. - * @param rules The rules that define the set. May be null, but a set with - * no rules is the empty set. + * set. + * @param rules The rules that define the set. May be null, but a + * set with no rules is the empty set. */ FilesSet(String name, String description, boolean ignoreKnownFiles, Map rules) { if ((name == null) || (name.isEmpty())) { @@ -112,7 +112,7 @@ final class FilesSet implements Serializable { * @param file A file to test for set membership. * * @return The name of the first set membership rule satisfied by the file, - * will be null if the file does not belong to the set. + * will be null if the file does not belong to the set. */ String fileIsMemberOf(AbstractFile file) { if ((this.ignoreKnownFiles) && (file.getKnown() == TskData.FileKnown.KNOWN)) { @@ -152,10 +152,10 @@ final class FilesSet implements Serializable { /** * Construct an interesting files set membership rule. * - * @param ruleName The name of the rule. + * @param ruleName The name of the rule. * @param fileNameCondition A file name condition. * @param metaTypeCondition A file meta-type condition. - * @param pathCondition A file path condition, may be null. + * @param pathCondition A file path condition, may be null. */ Rule(String ruleName, FileNameCondition fileNameCondition, MetaTypeCondition metaTypeCondition, ParentPathCondition pathCondition, MimeTypeCondition mimeTypeCondition, FileSizeCondition fileSizeCondition) { // since ruleName is optional, ruleUUID can be used to uniquely identify a rule. @@ -560,7 +560,7 @@ final class FilesSet implements Serializable { * regular expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); @@ -620,7 +620,7 @@ final class FilesSet implements Serializable { * regular expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ @Override public boolean isRegex() { @@ -754,7 +754,7 @@ final class FilesSet implements Serializable { * Construct a file name extension regular expression condition. * * @param extension The file name extension regular expression to be - * matched. + * matched. */ ExtensionCondition(Pattern extension) { super(extension.pattern(), false); @@ -788,7 +788,7 @@ final class FilesSet implements Serializable { * expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index db3b52cc72..075dc50576 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -158,6 +158,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * Gets the JOptionPane that is used to contain this panel if there is one * * @param parent + * * @return */ private JOptionPane getOptionPane(JComponent parent) { @@ -173,7 +174,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Sets the buttons for ending the panel * - * @param ok The ok button + * @param ok The ok button * @param cancel The cancel button */ public void setButtons(JButton ok, JButton cancel) { @@ -363,7 +364,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @return A name condition. * * @throws IllegalStateException if the specified name condition is not - * valid. + * valid. */ FilesSet.Rule.FileNameCondition getFileNameCondition() throws IllegalStateException { FilesSet.Rule.FileNameCondition condition = null; @@ -452,7 +453,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @return A path condition or null if no path condition was specified. * * @throws IllegalStateException if the specified path condition is not - * valid. + * valid. */ FilesSet.Rule.ParentPathCondition getPathCondition() throws IllegalStateException { FilesSet.Rule.ParentPathCondition condition = null; @@ -488,11 +489,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Checks an input string for the use of illegal characters. * - * @param toBeChecked The input string. + * @param toBeChecked The input string. * @param illegalChars The characters deemed to be illegal. * * @return True if the string does not contain illegal characters, false - * otherwise. + * otherwise. */ private static boolean containsOnlyLegalChars(String toBeChecked, List illegalChars) { for (String illegalChar : illegalChars) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 6d967d545d..f6178b3f3a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -95,7 +95,7 @@ final class InterestingItemDefsManager extends Observable { * Gets a copy of the current interesting files set definitions. * * @return A map of interesting files set names to interesting file sets, - * possibly empty. + * possibly empty. */ synchronized Map getInterestingFilesSets() { return FilesSetXML.readDefinitionsFile(DEFAULT_FILE_SET_DEFS_PATH); @@ -106,7 +106,7 @@ final class InterestingItemDefsManager extends Observable { * previous definitions. * * @param filesSets A mapping of interesting files set names to files sets, - * used to enforce unique files set names. + * used to enforce unique files set names. */ synchronized void setInterestingFilesSets(Map filesSets) { FilesSetXML.writeDefinitionsFile(INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH, filesSets); @@ -220,9 +220,9 @@ final class InterestingItemDefsManager extends Observable { /** * Reads in an interesting files set. * - * @param setElem An interesting files set XML element + * @param setElem An interesting files set XML element * @param filesSets A collection to which the set is to be added. - * @param filePath The source file, used for error reporting. + * @param filePath The source file, used for error reporting. */ private static void readFilesSet(Element setElem, Map filesSets, String filePath) { // The file set must have a unique name. @@ -297,11 +297,11 @@ final class InterestingItemDefsManager extends Observable { * XML element. * * @param filePath The path of the definitions file. - * @param setName The name of the files set. - * @param elem The file name rule XML element. + * @param setName The name of the files set. + * @param elem The file name rule XML element. * * @return A file name rule, or null if there is an error (the error is - * logged). + * logged). */ private static FilesSet.Rule readFileNameRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -359,7 +359,7 @@ final class InterestingItemDefsManager extends Observable { * @param elem The file name extension rule XML element. * * @return A file name extension rule, or null if there is an error (the - * error is logged). + * error is logged). */ private static FilesSet.Rule readFileExtensionRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -452,7 +452,7 @@ final class InterestingItemDefsManager extends Observable { * @param ruleElement The XML element. * * @return The meta-type condition, or null if there is an error - * (logged). + * (logged). */ private static FilesSet.Rule.MetaTypeCondition readMetaTypeCondition(Element ruleElement) { FilesSet.Rule.MetaTypeCondition condition = null; @@ -521,7 +521,7 @@ final class InterestingItemDefsManager extends Observable { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { out.writeObject(interestingFilesSets); File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); - if(xmlFile.exists()) { + if (xmlFile.exists()) { xmlFile.delete(); } return true; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 0455574ca2..655784592d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -259,8 +259,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition); InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition); InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex()); - } - else { + } else { InterestingItemDefsPanel.this.fileNameTextField.setText(""); InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(true); InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(false); @@ -315,7 +314,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * respond to user interactions with the dialog. * * @param selectedSet The currently selected files set, may be null to - * indicate a new interesting files set definition is to be created. + * indicate a new interesting files set definition is to + * be created. */ private void doFileSetsDialog(FilesSet selectedSet) { // Create a files set defintion panle. @@ -362,7 +362,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * dialog box and respond to user interactions with the dialog. * * @param selectedRule The currently selected rule, may be null to indicate - * a new rule definition is to be created. + * a new rule definition is to be created. */ private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) { // Create a files set rule panel. @@ -416,12 +416,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * owned by this panel. If there is a definition with the same name, it will * be replaced, so this is an add/edit operation. * - * @param oldSet A set to replace, null if the new set is not a replacement. - * @param name The name of the files set. - * @param description The description of the files set. + * @param oldSet A set to replace, null if the new set is not a + * replacement. + * @param name The name of the files set. + * @param description The description of the files set. * @param ignoresKnownFiles Whether or not the files set ignores known - * files. - * @param rules The set membership rules for the set. + * files. + * @param rules The set membership rules for the set. */ void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules) { if (oldSet != null) { From 25e63e198b271fcacd37e72d331f09cff87b53aa Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Fri, 26 Feb 2016 10:56:56 -0500 Subject: [PATCH 10/32] Eliminated warnings --- .../interestingitems/FilesSetRulePanel.form | 8 +++-- .../interestingitems/FilesSetRulePanel.java | 10 +++--- .../InterestingItemDefsManager.java | 20 ++++++++---- .../InterestingItemDefsPanel.form | 10 ++++-- .../InterestingItemDefsPanel.java | 12 +++---- .../InterestingItemsFilesSetSettings.java | 31 +++++++++++++++++++ 6 files changed, 68 insertions(+), 23 deletions(-) create mode 100755 Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index ee526067d5..82bdad5213 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -257,7 +257,7 @@ - + @@ -272,23 +272,25 @@ - + + - + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 075dc50576..8779f7eb16 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -602,7 +602,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel5.text")); // NOI18N mimeTypeComboBox.setEditable(true); - mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); mimeTypeComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -610,10 +610,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySymbolComboBox.setEnabled(false); - fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); + fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); fileSizeComboBox.setEnabled(false); fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); @@ -858,10 +858,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton dirsRadio; - private javax.swing.JComboBox equalitySymbolComboBox; + private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; private javax.swing.JCheckBox fileSizeCheck; - private javax.swing.JComboBox fileSizeComboBox; + private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; private javax.swing.JRadioButton filesAndDirsRadio; private javax.swing.JRadioButton filesRadio; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index f6178b3f3a..621ea791e9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -209,11 +209,19 @@ final class InterestingItemDefsManager extends Observable { private static Map readSerializedDefinitions() { String filePath = INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH; - try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath.toString()))) { - Map filesSetMap = (Map) in.readObject(); - return filesSetMap; - } catch (IOException | ClassNotFoundException ex) { - throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); + File fileSetFile = new File(filePath); + if (fileSetFile.exists()) { + try { + try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath))) { + InterestingItemsFilesSetSettings filesSetsSettings = (InterestingItemsFilesSetSettings) in.readObject(); + return filesSetsSettings.getFilesSets(); + } + } catch (IOException | ClassNotFoundException ex) { + throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); + } + } + else { + return new HashMap(); } } @@ -519,7 +527,7 @@ final class InterestingItemDefsManager extends Observable { // definitions that ship with Autopsy and one for user definitions. static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { - out.writeObject(interestingFilesSets); + out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); if (xmlFile.exists()) { xmlFile.delete(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 26762d98c5..e55060f6a1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -775,10 +775,13 @@ - + + + + @@ -790,7 +793,7 @@ - + @@ -807,12 +810,13 @@ - + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 655784592d..83301b6239 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -496,7 +496,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel7 = new javax.swing.JLabel(); - mimeTypeComboBox = new javax.swing.JComboBox(); + mimeTypeComboBox = new javax.swing.JComboBox(); jLabel8 = new javax.swing.JLabel(); equalitySignComboBox = new javax.swing.JComboBox(); jSpinner1 = new javax.swing.JSpinner(); @@ -690,17 +690,17 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel7.text")); // NOI18N mimeTypeComboBox.setEditable(true); - mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); + mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel8.text")); // NOI18N - equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); + equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySignComboBox.setEnabled(false); jSpinner1.setEnabled(false); - fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); + fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); fileSizeUnitComboBox.setEnabled(false); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); @@ -954,7 +954,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JRadioButton fileNameRadioButton; private javax.swing.JCheckBox fileNameRegexCheckbox; private javax.swing.JTextField fileNameTextField; - private javax.swing.JComboBox fileSizeUnitComboBox; + private javax.swing.JComboBox fileSizeUnitComboBox; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JCheckBox ignoreKnownFilesCheckbox; private javax.swing.JLabel jLabel1; @@ -970,7 +970,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JScrollPane jScrollPane2; private javax.swing.JSpinner jSpinner1; private javax.swing.JTextArea jTextArea1; - private javax.swing.JComboBox mimeTypeComboBox; + private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JButton newRuleButton; private javax.swing.JButton newSetButton; private javax.swing.JCheckBox rulePathConditionRegexCheckBox; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java new file mode 100755 index 0000000000..ab8381ed9b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -0,0 +1,31 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.modules.interestingitems; + +import java.io.Serializable; +import java.util.Map; + +/** + * + * @author oliver + */ +class InterestingItemsFilesSetSettings implements Serializable { + private static final long serialVersionUID = 1L; + private Map filesSets; + InterestingItemsFilesSetSettings(Map filesSets) { + this.filesSets = filesSets; + } + + /** + * @return the filesSets + */ + Map getFilesSets() { + return filesSets; + } + + + +} From bf994cb0f51e44e87800b69f60bd0f87e59380c4 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Mon, 7 Mar 2016 13:29:24 -0500 Subject: [PATCH 11/32] Updated as per pull request notes --- .../modules/interestingitems/FilesSet.java | 47 +++++++++---------- .../InterestingItemDefsManager.java | 21 ++++----- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 779147be6f..6c95ccbe2b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -152,7 +152,7 @@ final class FilesSet implements Serializable { /** * Construct an interesting files set membership rule. * - * @param ruleName The name of the rule. + * @param ruleName The name of the rule. Can be empty string. * @param fileNameCondition A file name condition. * @param metaTypeCondition A file meta-type condition. * @param pathCondition A file path condition, may be null. @@ -163,7 +163,7 @@ final class FilesSet implements Serializable { if (metaTypeCondition == null) { throw new IllegalArgumentException("Interesting files set rule meta-type condition cannot be null"); } - if (ruleName == null && fileNameCondition == null && mimeTypeCondition == null) { + if (pathCondition == null && fileNameCondition == null && mimeTypeCondition == null && fileSizeCondition == null) { throw new IllegalArgumentException("Must have at least one condition on rule."); } @@ -174,14 +174,18 @@ final class FilesSet implements Serializable { * fastest, so do it first */ this.metaTypeCondition = metaTypeCondition; - if (this.metaTypeCondition != null) { - this.conditions.add(this.metaTypeCondition); + this.conditions.add(this.metaTypeCondition); + + this.fileSizeCondition = fileSizeCondition; + if (this.fileSizeCondition != null) { + this.conditions.add(this.fileSizeCondition); } this.fileNameCondition = fileNameCondition; if (this.fileNameCondition != null) { this.conditions.add(fileNameCondition); } + this.mimeTypeCondition = mimeTypeCondition; if (this.mimeTypeCondition != null) { this.conditions.add(mimeTypeCondition); @@ -191,11 +195,6 @@ final class FilesSet implements Serializable { if (this.pathCondition != null) { this.conditions.add(this.pathCondition); } - - this.fileSizeCondition = fileSizeCondition; - if (this.fileSizeCondition != null) { - this.conditions.add(this.fileSizeCondition); - } } /** @@ -210,7 +209,7 @@ final class FilesSet implements Serializable { /** * Get the file name condition for the rule. * - * @return A file name condition. + * @return A file name condition. Can be null. */ FileNameCondition getFileNameCondition() { return this.fileNameCondition; @@ -219,7 +218,7 @@ final class FilesSet implements Serializable { /** * Get the meta-type condition for the rule. * - * @return A meta-type condition. + * @return A meta-type condition. Can be null. */ MetaTypeCondition getMetaTypeCondition() { return this.metaTypeCondition; @@ -228,7 +227,7 @@ final class FilesSet implements Serializable { /** * Get the path condition for the rule. * - * @return A path condition, may be null. + * @return A path condition, may be null. Can be null. */ ParentPathCondition getPathCondition() { return this.pathCondition; @@ -280,16 +279,16 @@ final class FilesSet implements Serializable { } /** - * @return the mimeTypeCondition + * @return the mime type condition. Can be null. */ - public MimeTypeCondition getMimeTypeCondition() { + MimeTypeCondition getMimeTypeCondition() { return mimeTypeCondition; } /** - * @return the fileSizeCondition + * @return the file size condition. Can be null. */ - public FileSizeCondition getFileSizeCondition() { + FileSizeCondition getFileSizeCondition() { return fileSizeCondition; } @@ -316,7 +315,7 @@ final class FilesSet implements Serializable { static final class MimeTypeCondition implements FileAttributeCondition { private static final long serialVersionUID = 1L; - private String mimeType; + private final String mimeType; /** * Constructs a MimeTypeCondition @@ -340,7 +339,7 @@ final class FilesSet implements Serializable { * * @return the mime type */ - public String getMimeType() { + String getMimeType() { return this.mimeType; } @@ -359,7 +358,7 @@ final class FilesSet implements Serializable { * * @return the comparator */ - public COMPARATOR getComparator() { + COMPARATOR getComparator() { return comparator; } @@ -368,7 +367,7 @@ final class FilesSet implements Serializable { * * @return the unit */ - public SIZE_UNIT getUnit() { + SIZE_UNIT getUnit() { return unit; } @@ -377,7 +376,7 @@ final class FilesSet implements Serializable { * * @return the size value */ - public int getSizeValue() { + int getSizeValue() { return sizeValue; } @@ -459,9 +458,9 @@ final class FilesSet implements Serializable { return name; } } - private COMPARATOR comparator; - private SIZE_UNIT unit; - private int sizeValue; + private final COMPARATOR comparator; + private final SIZE_UNIT unit; + private final int sizeValue; FileSizeCondition(COMPARATOR comparator, SIZE_UNIT unit, int sizeValue) { this.comparator = comparator; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 621ea791e9..6f5afbce86 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -57,8 +57,8 @@ final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); private static final String INTERESTING_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS - private static final String INTERESING_FILES_SET_DEFS_SERIALIZATION_NAME = "interestingFileSets.settings"; - private static final String INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESING_FILES_SET_DEFS_SERIALIZATION_NAME; + private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; + private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME; private static final String DEFAULT_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_FILE_NAME; private static InterestingItemDefsManager instance; @@ -109,7 +109,7 @@ final class InterestingItemDefsManager extends Observable { * used to enforce unique files set names. */ synchronized void setInterestingFilesSets(Map filesSets) { - FilesSetXML.writeDefinitionsFile(INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH, filesSets); + FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH, filesSets); this.setChanged(); this.notifyObservers(); } @@ -208,7 +208,7 @@ final class InterestingItemDefsManager extends Observable { } private static Map readSerializedDefinitions() { - String filePath = INTERESING_FILES_SET_DEFS_SERIALIZATION_PATH; + String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; File fileSetFile = new File(filePath); if (fileSetFile.exists()) { try { @@ -219,8 +219,7 @@ final class InterestingItemDefsManager extends Observable { } catch (IOException | ClassNotFoundException ex) { throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); } - } - else { + } else { return new HashMap(); } } @@ -528,14 +527,14 @@ final class InterestingItemDefsManager extends Observable { static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); - File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); - if (xmlFile.exists()) { - xmlFile.delete(); - } - return true; } catch (IOException ex) { throw new PersistenceException(String.format("Failed to write settings to %s", filePath), ex); } + File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); + if (xmlFile.exists()) { + xmlFile.delete(); + } + return true; } } From 2bb8ce29fb828ab6664ebad5fd1a68b25467054d Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Wed, 9 Mar 2016 16:18:35 -0500 Subject: [PATCH 12/32] Made changes as per pr notes --- Core/nbproject/project.xml | 9 -- .../interestingitems/Bundle.properties | 6 +- ...FilesIdentifierIngestJobSettingsPanel.java | 16 +- .../FilesIdentifierIngestModule.java | 11 +- .../modules/interestingitems/FilesSet.java | 65 ++++---- .../interestingitems/FilesSetRulePanel.form | 36 ++--- .../interestingitems/FilesSetRulePanel.java | 149 +++++++++--------- .../InterestingItemDefsManager.java | 56 +++---- .../InterestingItemDefsPanel.java | 22 ++- .../InterestingItemsIngestModuleFactory.java | 10 +- 10 files changed, 202 insertions(+), 178 deletions(-) diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index 9e144a3a62..a2ddc46460 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -6,15 +6,6 @@ org.sleuthkit.autopsy.core - - org.jdesktop.beansbinding - - - - 1 - 1.24.1.121 - - org.netbeans.api.progress diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 85403fb1d2..3a1ced09a3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -62,6 +62,6 @@ FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.mimeCheck.text=MIME Type: FilesSetRulePanel.fileSizeCheck.text=File Size: -FilesSetRulePanel.filesRadio.text=Files -FilesSetRulePanel.dirsRadio.text=Directories -FilesSetRulePanel.filesAndDirsRadio.text=Files and Directories +FilesSetRulePanel.filesRadioButton.text=Files +FilesSetRulePanel.dirsRadioButton.text=Directories +FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index a9a17c984e..6af0110956 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -26,6 +26,8 @@ import java.util.TreeMap; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumn; +import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; @@ -75,7 +77,11 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * Observer.update(). */ List filesSetRows = new ArrayList<>(); - this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + try { + this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + MessageNotifyUtil.Message.error("Test Error"); + } for (FilesSet set : this.filesSetSnapshot.values()) { filesSetRows.add(new FilesSetRow(set, settings.interestingFilesSetIsEnabled(set.getName()))); } @@ -130,7 +136,13 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS // Refresh the view of the interesting files set definitions. List rowModels = new ArrayList<>(); - TreeMap newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + TreeMap newFilesSetSnapshot; + try { + newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + MessageNotifyUtil.Message.error("Test error"); + return; + } for (FilesSet set : newFilesSetSnapshot.values()) { if (this.filesSetSnapshot.keySet().contains(set.getName())) { // Preserve the current enabled/diabled state of the set. diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index ae93cbbc74..dfa7763ff7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.services.Blackboard; @@ -77,10 +78,14 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // synchronized definitions manager method eliminates the need // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); - for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets().values()) { - if (settings.interestingFilesSetIsEnabled(set.getName())) { - filesSets.add(set); + try { + for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets().values()) { + if (settings.interestingFilesSetIsEnabled(set.getName())) { + filesSets.add(set); + } } + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + throw new IngestModuleException("Test"); } FilesIdentifierIngestModule.interestingFileSetsByJob.put(context.getJobId(), filesSets); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 6c95ccbe2b..de807b0672 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -153,9 +153,11 @@ final class FilesSet implements Serializable { * Construct an interesting files set membership rule. * * @param ruleName The name of the rule. Can be empty string. - * @param fileNameCondition A file name condition. + * @param fileNameCondition A file name condition, may be null. * @param metaTypeCondition A file meta-type condition. * @param pathCondition A file path condition, may be null. + * @param mimeTypeCondition A file mime type condition, may be null. + * @param fileSizeCondition A file size condition, may be null. */ Rule(String ruleName, FileNameCondition fileNameCondition, MetaTypeCondition metaTypeCondition, ParentPathCondition pathCondition, MimeTypeCondition mimeTypeCondition, FileSizeCondition fileSizeCondition) { // since ruleName is optional, ruleUUID can be used to uniquely identify a rule. @@ -227,7 +229,7 @@ final class FilesSet implements Serializable { /** * Get the path condition for the rule. * - * @return A path condition, may be null. Can be null. + * @return A path condition, may be null. */ ParentPathCondition getPathCondition() { return this.pathCondition; @@ -299,8 +301,7 @@ final class FilesSet implements Serializable { static interface FileAttributeCondition extends Serializable { /** - * Tests whether or not a file satisfies the conditions of a - * condition. + * Tests whether or not a file satisfies the condition. * * @param file The file to test. * @@ -353,33 +354,7 @@ final class FilesSet implements Serializable { private static final long serialVersionUID = 1L; - /** - * Gets the comparator of this condition - * - * @return the comparator - */ - COMPARATOR getComparator() { - return comparator; - } - - /** - * Gets the unit for the size of this condition - * - * @return the unit - */ - SIZE_UNIT getUnit() { - return unit; - } - - /** - * Gets the size value of this condition - * - * @return the size value - */ - int getSizeValue() { - return sizeValue; - } - + /** * Represents a comparison item for file size */ @@ -467,6 +442,34 @@ final class FilesSet implements Serializable { this.unit = unit; this.sizeValue = sizeValue; } + + /** + * Gets the comparator of this condition + * + * @return the comparator + */ + COMPARATOR getComparator() { + return comparator; + } + + /** + * Gets the unit for the size of this condition + * + * @return the unit + */ + SIZE_UNIT getUnit() { + return unit; + } + + /** + * Gets the size value of this condition + * + * @return the size value + */ + int getSizeValue() { + return sizeValue; + } + @Override public boolean passes(AbstractFile file) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index 82bdad5213..72b506199a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -38,11 +38,11 @@ - + - + - + @@ -109,9 +109,9 @@ - - - + + + @@ -199,6 +199,9 @@ + + + @@ -261,9 +264,6 @@ - - - @@ -344,43 +344,43 @@ - + - + - + - + - + - + - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 8779f7eb16..efbc2197c8 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -69,10 +69,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Constructs a files set rule panel in create rule mode. */ - FilesSetRulePanel() { + FilesSetRulePanel(JButton okButton, JButton cancelButton) { initComponents(); + populateMimeTypesComboBox(); populateComponentsWithDefaultValues(); - customInit(); + this.setButtons(okButton, cancelButton); } /** @@ -80,26 +81,29 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @param rule The files set rule to be edited. */ - FilesSetRulePanel(FilesSet.Rule rule) { + FilesSetRulePanel(FilesSet.Rule rule, JButton okButton, JButton cancelButton) { initComponents(); + populateMimeTypesComboBox(); populateRuleNameComponent(rule); populateTypeConditionComponents(rule); populateNameConditionComponents(rule); populatePathConditionComponents(rule); - customInit(); + populateMimeConditionComponents(rule); + this.setButtons(okButton, cancelButton); } /** * Populates the UI components with default values. */ private void populateComponentsWithDefaultValues() { - this.filesRadio.setSelected(true); + this.filesRadioButton.setSelected(true); this.fullNameRadioButton.setSelected(true); - this.equalitySymbolComboBox.setSelectedIndex(2); - this.fileSizeComboBox.setSelectedIndex(1); + this.equalitySymbolComboBox.setSelectedItem(FilesSet.Rule.FileSizeCondition.COMPARATOR.GREATER_THAN_EQUAL.getSymbol()); + this.fileSizeComboBox.setSelectedItem(FilesSet.Rule.FileSizeCondition.SIZE_UNIT.KILOBYTE.getName()); + this.mimeTypeComboBox.setSelectedIndex(0); } - private void customInit() { + private void populateMimeTypesComboBox() { Set fileTypesCollated = new HashSet<>(); for (MediaType mediaType : mediaTypes) { fileTypesCollated.add(mediaType.toString()); @@ -139,18 +143,21 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.ruleNameTextField.setText(rule.getName()); } + private void populateMimeConditionComponents(FilesSet.Rule rule) { + FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition(); + if (mimeTypeCondition != null) { + this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); + } + } + /** * Sets whether or not the OK button should be enabled based upon other UI * elements */ private void setOkButton() { if (this.okButton != null) { - if (!(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() - || this.nameCheck.isSelected() || this.pathCheck.isSelected())) { - this.okButton.setEnabled(false); - } else { - this.okButton.setEnabled(true); - } + this.okButton.setEnabled(this.fileSizeCheck.isSelected() || this.mimeCheck.isSelected() + || this.nameCheck.isSelected() || this.pathCheck.isSelected()); } } @@ -177,7 +184,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @param ok The ok button * @param cancel The cancel button */ - public void setButtons(JButton ok, JButton cancel) { + private void setButtons(JButton ok, JButton cancel) { this.okButton = ok; this.cancelButton = cancel; okButton.addActionListener(new ActionListener() { @@ -207,13 +214,13 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSet.Rule.MetaTypeCondition typeCondition = rule.getMetaTypeCondition(); switch (typeCondition.getMetaType()) { case FILES: - this.filesRadio.setSelected(true); + this.filesRadioButton.setSelected(true); break; case DIRECTORIES: - this.dirsRadio.setSelected(true); + this.dirsRadioButton.setSelected(true); break; case FILES_AND_DIRECTORIES: - this.filesAndDirsRadio.setSelected(true); + this.filesAndDirsRadioButton.setSelected(true); break; } } @@ -418,14 +425,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel { FilesSet.Rule.FileSizeCondition getFileSizeCondition() { FilesSet.Rule.FileSizeCondition condition = null; if ((Integer) this.fileSizeSpinner.getValue() != 0) { - try { - FilesSet.Rule.FileSizeCondition.COMPARATOR comparator = FilesSet.Rule.FileSizeCondition.COMPARATOR.fromSymbol((String) this.equalitySymbolComboBox.getSelectedItem()); - FilesSet.Rule.FileSizeCondition.SIZE_UNIT unit = FilesSet.Rule.FileSizeCondition.SIZE_UNIT.fromName((String) this.fileSizeComboBox.getSelectedItem()); - int fileSizeValue = (Integer) this.fileSizeSpinner.getValue(); - condition = new FilesSet.Rule.FileSizeCondition(comparator, unit, fileSizeValue); - } catch (IllegalArgumentException ex) { - //Swallowing up exception because if invalid data is given, this should return null - } + FilesSet.Rule.FileSizeCondition.COMPARATOR comparator = FilesSet.Rule.FileSizeCondition.COMPARATOR.fromSymbol((String) this.equalitySymbolComboBox.getSelectedItem()); + FilesSet.Rule.FileSizeCondition.SIZE_UNIT unit = FilesSet.Rule.FileSizeCondition.SIZE_UNIT.fromName((String) this.fileSizeComboBox.getSelectedItem()); + int fileSizeValue = (Integer) this.fileSizeSpinner.getValue(); + condition = new FilesSet.Rule.FileSizeCondition(comparator, unit, fileSizeValue); } return condition; } @@ -437,9 +440,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * @return A type condition. */ FilesSet.Rule.MetaTypeCondition getMetaTypeCondition() { - if (this.filesRadio.isSelected()) { + if (this.filesRadioButton.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - } else if (this.dirsRadio.isSelected()) { + } else if (this.dirsRadioButton.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); } else { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); @@ -509,7 +512,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * state of the UI components in the type button group. */ private void setComponentsForSearchType() { - if (!this.filesRadio.isSelected()) { + if (!this.filesRadioButton.isSelected()) { this.fullNameRadioButton.setSelected(true); this.extensionRadioButton.setEnabled(false); this.mimeTypeComboBox.setEnabled(false); @@ -560,9 +563,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { pathCheck = new javax.swing.JCheckBox(); mimeCheck = new javax.swing.JCheckBox(); fileSizeCheck = new javax.swing.JCheckBox(); - filesRadio = new javax.swing.JRadioButton(); - dirsRadio = new javax.swing.JRadioButton(); - filesAndDirsRadio = new javax.swing.JRadioButton(); + filesRadioButton = new javax.swing.JRadioButton(); + dirsRadioButton = new javax.swing.JRadioButton(); + filesAndDirsRadioButton = new javax.swing.JRadioButton(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N @@ -581,6 +584,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { nameButtonGroup.add(fullNameRadioButton); org.openide.awt.Mnemonics.setLocalizedText(fullNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fullNameRadioButton.text")); // NOI18N fullNameRadioButton.setEnabled(false); + fullNameRadioButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fullNameRadioButtonActionPerformed(evt); + } + }); nameButtonGroup.add(extensionRadioButton); org.openide.awt.Mnemonics.setLocalizedText(extensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.extensionRadioButton.text")); // NOI18N @@ -604,11 +612,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); - mimeTypeComboBox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mimeTypeComboBoxActionPerformed(evt); - } - }); equalitySymbolComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySymbolComboBox.setEnabled(false); @@ -647,27 +650,27 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - typeButtonGroup.add(filesRadio); - org.openide.awt.Mnemonics.setLocalizedText(filesRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadio.text")); // NOI18N - filesRadio.addActionListener(new java.awt.event.ActionListener() { + typeButtonGroup.add(filesRadioButton); + org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesRadioButton.text")); // NOI18N + filesRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - filesRadioActionPerformed(evt); + filesRadioButtonActionPerformed(evt); } }); - typeButtonGroup.add(dirsRadio); - org.openide.awt.Mnemonics.setLocalizedText(dirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadio.text")); // NOI18N - dirsRadio.addActionListener(new java.awt.event.ActionListener() { + typeButtonGroup.add(dirsRadioButton); + org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.dirsRadioButton.text")); // NOI18N + dirsRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - dirsRadioActionPerformed(evt); + dirsRadioButtonActionPerformed(evt); } }); - typeButtonGroup.add(filesAndDirsRadio); - org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadio, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadio.text")); // NOI18N - filesAndDirsRadio.addActionListener(new java.awt.event.ActionListener() { + typeButtonGroup.add(filesAndDirsRadioButton); + org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadioButton.text")); // NOI18N + filesAndDirsRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - filesAndDirsRadioActionPerformed(evt); + filesAndDirsRadioButtonActionPerformed(evt); } }); @@ -690,11 +693,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(65, 65, 65) - .addComponent(filesRadio) + .addComponent(filesRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(dirsRadio) + .addComponent(dirsRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filesAndDirsRadio))) + .addComponent(filesAndDirsRadioButton))) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addContainerGap() @@ -743,9 +746,9 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(filesRadio) - .addComponent(dirsRadio) - .addComponent(filesAndDirsRadio)) + .addComponent(filesRadioButton) + .addComponent(dirsRadioButton) + .addComponent(filesAndDirsRadioButton)) .addGap(5, 5, 5) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -839,32 +842,32 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.setOkButton(); }//GEN-LAST:event_fileSizeCheckActionPerformed - private void mimeTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mimeTypeComboBoxActionPerformed + private void filesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioButtonActionPerformed + + this.setComponentsForSearchType(); + }//GEN-LAST:event_filesRadioButtonActionPerformed + + private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed + this.setComponentsForSearchType(); + }//GEN-LAST:event_dirsRadioButtonActionPerformed + + private void filesAndDirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioButtonActionPerformed + this.setComponentsForSearchType(); + }//GEN-LAST:event_filesAndDirsRadioButtonActionPerformed + + private void fullNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fullNameRadioButtonActionPerformed // TODO add your handling code here: - }//GEN-LAST:event_mimeTypeComboBoxActionPerformed - - private void filesRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesRadioActionPerformed - - this.setComponentsForSearchType(); - }//GEN-LAST:event_filesRadioActionPerformed - - private void dirsRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioActionPerformed - this.setComponentsForSearchType(); - }//GEN-LAST:event_dirsRadioActionPerformed - - private void filesAndDirsRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioActionPerformed - this.setComponentsForSearchType(); - }//GEN-LAST:event_filesAndDirsRadioActionPerformed + }//GEN-LAST:event_fullNameRadioButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JRadioButton dirsRadio; + private javax.swing.JRadioButton dirsRadioButton; private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; private javax.swing.JCheckBox fileSizeCheck; private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; - private javax.swing.JRadioButton filesAndDirsRadio; - private javax.swing.JRadioButton filesRadio; + private javax.swing.JRadioButton filesAndDirsRadioButton; + private javax.swing.JRadioButton filesRadioButton; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel5; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 6f5afbce86..db558a9f13 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -32,11 +32,6 @@ import java.util.Observable; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import javax.persistence.PersistenceException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.openide.util.Exceptions; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; @@ -97,7 +92,7 @@ final class InterestingItemDefsManager extends Observable { * @return A map of interesting files set names to interesting file sets, * possibly empty. */ - synchronized Map getInterestingFilesSets() { + synchronized Map getInterestingFilesSets() throws InterestingItemDefsManagerException { return FilesSetXML.readDefinitionsFile(DEFAULT_FILE_SET_DEFS_PATH); } @@ -108,7 +103,7 @@ final class InterestingItemDefsManager extends Observable { * @param filesSets A mapping of interesting files set names to files sets, * used to enforce unique files set names. */ - synchronized void setInterestingFilesSets(Map filesSets) { + synchronized void setInterestingFilesSets(Map filesSets) throws InterestingItemDefsManagerException { FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH, filesSets); this.setChanged(); this.notifyObservers(); @@ -139,21 +134,6 @@ final class InterestingItemDefsManager extends Observable { private static final String TYPE_FILTER_VALUE_FILES = "file"; //NON-NLS private static final String TYPE_FILTER_VALUE_DIRS = "dir"; //NON-NLS - // The following tags and attributes are currently specific to the - // Autopsy implementation of interesting files set definitions. Autopsy - // definitions that use these will not be able to be used by TSK - // Framework. However, Autopsy can accept TSK Framework definitions: - // - // 1. Rules do not have names in the TSK Framework schema, but rules do - // have names in the Autopsy schema. Names will be synthesized as needed - // to allow Autopsy to use TSK Framework interesting files set - // definitions. - // 2. The TSK Framework has an interesting files module that supports - // simple globbing with "*" characters. Name rules and path conditions with - // "*" characters will be converted to regexes to allow Autopsy to use - // TSK Framework interesting files set definitions. - // 3. Type conditions are required by Autopsy, but not by TSK Frmaework. - // Missing type conditions will defualt to "files" conditions. private static final String REGEX_ATTR = "regex"; //NON-NLS private static final String PATH_REGEX_ATTR = "pathRegex"; //NON-NLS private static final String TYPE_FILTER_VALUE_FILES_AND_DIRS = "files_and_dirs"; //NON-NLS @@ -170,10 +150,10 @@ final class InterestingItemDefsManager extends Observable { // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static Map readDefinitionsFile(String filePath) { + static Map readDefinitionsFile(String filePath) throws InterestingItemDefsManagerException { Map filesSets = new HashMap<>(); - // Check if the file exists. + // Check if the legacy xml file exists. File defsFile = new File(filePath); if (!defsFile.exists()) { return readSerializedDefinitions(); @@ -207,8 +187,9 @@ final class InterestingItemDefsManager extends Observable { return filesSets; } - private static Map readSerializedDefinitions() { - String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; + private static Map readSerializedDefinitions() throws InterestingItemDefsManagerException { + throw new InterestingItemDefsManagerException("Test"); + /*String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; File fileSetFile = new File(filePath); if (fileSetFile.exists()) { try { @@ -217,11 +198,11 @@ final class InterestingItemDefsManager extends Observable { return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { - throw new PersistenceException(String.format("Failed to read settings from %s", filePath), ex); + throw new InterestingItemDefsManagerException(String.format("Failed to read settings from %s", filePath), ex); } } else { return new HashMap(); - } + }*/ } /** @@ -524,11 +505,11 @@ final class InterestingItemDefsManager extends Observable { // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) { + static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) throws InterestingItemDefsManagerException { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); } catch (IOException ex) { - throw new PersistenceException(String.format("Failed to write settings to %s", filePath), ex); + throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", filePath), ex); } File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); if (xmlFile.exists()) { @@ -537,5 +518,20 @@ final class InterestingItemDefsManager extends Observable { return true; } } + + static class InterestingItemDefsManagerException extends Exception { + InterestingItemDefsManagerException() { + + } + InterestingItemDefsManagerException(String message) { + super(message); + } + InterestingItemDefsManagerException(String message, Throwable cause) { + super(message, cause); + } + InterestingItemDefsManagerException(Throwable cause) { + super(cause); + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 83301b6239..f45056e489 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel; import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.apache.tika.mime.MediaType; import org.apache.tika.mime.MimeTypes; +import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.Logger; /** @@ -121,7 +122,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp */ @Override public void saveSettings() { - InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets); + try { + InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + MessageNotifyUtil.Message.error("Test Error"); + } } /** @@ -139,9 +144,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp public void load() { this.resetComponents(); - // Get a working copy of the interesting files set definitions and sort - // by set name. - this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + try { + // Get a working copy of the interesting files set definitions and sort + // by set name. + this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + MessageNotifyUtil.Message.error("Test error"); + } // Populate the list model for the interesting files sets list // component. @@ -369,12 +378,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp FilesSetRulePanel panel; if (selectedRule != null) { // Editing an existing rule definition. - panel = new FilesSetRulePanel(selectedRule); + panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton); } else { // Creating a new rule definition. - panel = new FilesSetRulePanel(); + panel = new FilesSetRulePanel(okButton, cancelButton); } - panel.setButtons(okButton, cancelButton); // Do a dialog box with the files set panel until the user either enters // a valid definition or cancels. Note that the panel gives the user // feedback when isValidDefinition() is called. diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 549e75c963..410e366bd2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -20,8 +20,10 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.util.ArrayList; import java.util.List; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; +import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.Version; import org.sleuthkit.autopsy.ingest.FileIngestModule; import org.sleuthkit.autopsy.ingest.IngestModuleFactory; @@ -76,8 +78,12 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // definitions independent of the rules that make up the defintions. // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); - for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets().keySet()) { - enabledFilesSetNames.add(name); + try { + for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets().keySet()) { + enabledFilesSetNames.add(name); + } + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + MessageNotifyUtil.Message.error("Test Error"); } return new FilesIdentifierIngestJobSettings(enabledFilesSetNames); } From cda5123b8c61b733d15ca82b2ee60e0a6593ad26 Mon Sep 17 00:00:00 2001 From: ruchambapat Date: Thu, 10 Mar 2016 12:17:06 +0100 Subject: [PATCH 13/32] Revert "Update and rewrite README.txt file into a markdown file" This reverts commit 57b36550559cc03f4011b2e7cd3e1c0f4b0669c4. --- README.md => README.txt | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) rename README.md => README.txt (80%) diff --git a/README.md b/README.txt similarity index 80% rename from README.md rename to README.txt index 324661c8fa..1bdce6e2b5 100644 --- a/README.md +++ b/README.txt @@ -1,32 +1,24 @@ -# Autopsy 4.0 -http://www.sleuthkit.org/ + Autopsy 3.0 + http://www.sleuthkit.org/ -March 3, 2016 + March 13, 2013 - -##OVERVIEW +OVERVIEW Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools. -Autopsy 4 (and 3) are a complete rewrite from Autopsy 2, and none of this document is relevant to Autopsy 2. +Autopsy 3 is a complete rewrite from Autopsy 2 and it is now Java-based. Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the current version is fully functional and fully tested only on Windows. -You can run Autopsy 4 on Linux and OS X, but it must be built from source code. +We have run it on XP, Vista, and Windows 7 with no problems. -Autopsy 3 and 4 source code are distributed under a Apache 2 license. The package contains libraries that may have different licenses. +Autopsy 3.0 is released under the Apache 2.0 license. -##INSTALLATION +INSTALLATION All Autopsy dependencies are bundled with the installer provided. -For Autopsy 3, there is no need for manual installation of additional dependencies if the installer is used. -The current version of Autopsy 4 is distributed on sleuthkit.org only as a Windows installer. It can run on Linux and OS X, but requires some manual setup. To install Autopsy, perform the following steps: - -* Run the Autopsy msi file -* If Windows prompts with User Account Control, click Yes -* Click through the dialog boxes until you click a button that says Finish -* Autopsy should now be fully installed - +There is no need for manual installation of additional dependencies if the installer is used. If you want the Japanese localized version, you must have the Japanese language pack (http://support.microsoft.com/kb/972813) installed and the default locale set to JA. (http://windows.microsoft.com/en-us/windows/change-system-locale#1TC=windows-7). @@ -35,7 +27,7 @@ Refer to the next section for additional info on third-party software requiremen Refer to the KNOWN_ISSUES.txt file for known bugs that could cause investigation problems. -##SUPPORT +SUPPORT There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that came with the installer. @@ -43,11 +35,12 @@ Send any bug reports or feature requests to the sleuthkit-users e-mail list. http://www.sleuthkit.org/support.php -##LICENSE +LICENSE The Autopsy code is released under the Apache License, Version 2. See LICENSE-2.0.txt for details. -##EMBEDDED SOFTWARE + +EMBEDDED SOFTWARE This section lists the software components and libraries that are used inside of Autopsy. These tools are bundled with the installer, unless specified otherwise. @@ -123,7 +116,7 @@ ImgScalr 4.2 for image resizing in image viewers - License: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#license -##EMBEDED RESOURCES +EMBEDED RESOURCES This section lists other resources, such as icons, that are used by Autopsy. @@ -140,4 +133,4 @@ WebHostingHub Glyphs - License: http://creativecommons.org/licenses/by/3.0/ Splashy Icons (free as in free) -- Web page: http://splashyfish.com/icons/ +- Web page: http://splashyfish.com/icons/ \ No newline at end of file From e88432afe7b5b2940c71bd33129683e6ed5cdd62 Mon Sep 17 00:00:00 2001 From: Chillli Date: Thu, 10 Mar 2016 12:59:10 +0100 Subject: [PATCH 14/32] Revert "Revert "Update and rewrite README.txt file into a markdown file"" This reverts commit cda5123b8c61b733d15ca82b2ee60e0a6593ad26. --- README.txt => README.md | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) rename README.txt => README.md (80%) diff --git a/README.txt b/README.md similarity index 80% rename from README.txt rename to README.md index 1bdce6e2b5..324661c8fa 100644 --- a/README.txt +++ b/README.md @@ -1,24 +1,32 @@ - Autopsy 3.0 - http://www.sleuthkit.org/ +# Autopsy 4.0 +http://www.sleuthkit.org/ - March 13, 2013 +March 3, 2016 -OVERVIEW + +##OVERVIEW Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools. -Autopsy 3 is a complete rewrite from Autopsy 2 and it is now Java-based. +Autopsy 4 (and 3) are a complete rewrite from Autopsy 2, and none of this document is relevant to Autopsy 2. Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the current version is fully functional and fully tested only on Windows. -We have run it on XP, Vista, and Windows 7 with no problems. +You can run Autopsy 4 on Linux and OS X, but it must be built from source code. -Autopsy 3.0 is released under the Apache 2.0 license. +Autopsy 3 and 4 source code are distributed under a Apache 2 license. The package contains libraries that may have different licenses. -INSTALLATION +##INSTALLATION All Autopsy dependencies are bundled with the installer provided. -There is no need for manual installation of additional dependencies if the installer is used. +For Autopsy 3, there is no need for manual installation of additional dependencies if the installer is used. +The current version of Autopsy 4 is distributed on sleuthkit.org only as a Windows installer. It can run on Linux and OS X, but requires some manual setup. To install Autopsy, perform the following steps: + +* Run the Autopsy msi file +* If Windows prompts with User Account Control, click Yes +* Click through the dialog boxes until you click a button that says Finish +* Autopsy should now be fully installed + If you want the Japanese localized version, you must have the Japanese language pack (http://support.microsoft.com/kb/972813) installed and the default locale set to JA. (http://windows.microsoft.com/en-us/windows/change-system-locale#1TC=windows-7). @@ -27,7 +35,7 @@ Refer to the next section for additional info on third-party software requiremen Refer to the KNOWN_ISSUES.txt file for known bugs that could cause investigation problems. -SUPPORT +##SUPPORT There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that came with the installer. @@ -35,12 +43,11 @@ Send any bug reports or feature requests to the sleuthkit-users e-mail list. http://www.sleuthkit.org/support.php -LICENSE +##LICENSE The Autopsy code is released under the Apache License, Version 2. See LICENSE-2.0.txt for details. - -EMBEDDED SOFTWARE +##EMBEDDED SOFTWARE This section lists the software components and libraries that are used inside of Autopsy. These tools are bundled with the installer, unless specified otherwise. @@ -116,7 +123,7 @@ ImgScalr 4.2 for image resizing in image viewers - License: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#license -EMBEDED RESOURCES +##EMBEDED RESOURCES This section lists other resources, such as icons, that are used by Autopsy. @@ -133,4 +140,4 @@ WebHostingHub Glyphs - License: http://creativecommons.org/licenses/by/3.0/ Splashy Icons (free as in free) -- Web page: http://splashyfish.com/icons/ \ No newline at end of file +- Web page: http://splashyfish.com/icons/ From fa9bf14dba00f3cc144de736a212ce326513628b Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 10 Mar 2016 10:20:36 -0500 Subject: [PATCH 15/32] Updated as per pr request, added error messages --- .../interestingitems/Bundle_ja.properties | 2 +- ...FilesIdentifierIngestJobSettingsPanel.java | 10 +++++++-- .../FilesIdentifierIngestModule.java | 2 +- .../InterestingItemDefsManager.java | 21 +++++++++++-------- .../InterestingItemDefsPanel.java | 11 ++++++---- .../InterestingItemsFilesSetSettings.java | 19 ++++++++++++++--- .../InterestingItemsIngestModuleFactory.java | 7 ++++++- 7 files changed, 51 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 1cc779b485..487925a7b4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -8,7 +8,7 @@ FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3 FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 FilesSetRulePanel.jLabel1.text=\u30bf\u30a4\u30d7*\uff1a -FilesSetRulePanel.messages.emptyNameFilter=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +FilesSetRulePanel.messages.emptyNameCondition=\u3053\u306e\u30eb\u30fc\u30eb\u306f\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 FilesSetRulePanel.messages.invalidCharInName=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001/\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u540d\u524d\u306b\u542b\u3081\u307e\u305b\u3093\u3002 FilesSetRulePanel.messages.invalidCharInPath=\u6b63\u898f\u8868\u73fe\u4ee5\u5916\u306f\\\u3001\:\u3001*\u3001?\u3001"\u3001<\u3001>\u3092\u30d1\u30b9\u306b\u542b\u3081\u307e\u305b\u3093\u3002 FilesSetRulePanel.messages.invalidNameRegex=\u6b63\u898f\u8868\u73fe\u306f\u6709\u52b9\u306a\u540d\u524d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff1a\n\n{0} diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index 6af0110956..018824b7ad 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -27,6 +27,7 @@ import javax.swing.JTable; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumn; import org.openide.util.Exceptions; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; @@ -35,6 +36,10 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; * Ingest job settings panel for interesting files identifier ingest modules. */ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobSettingsPanel implements Observer { + @Messages({ + "FilesIdentifierIngestJobSettingsPanel.updateError=Could not update interesting files sets.", + "FilesIdentifierIngestJobSettingsPanel.getError=Could not get interesting files sets." + }) private final FilesSetsTableModel tableModel; @@ -80,7 +85,8 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS try { this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - MessageNotifyUtil.Message.error("Test Error"); + MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); + this.filesSetSnapshot = new TreeMap<>(); } for (FilesSet set : this.filesSetSnapshot.values()) { filesSetRows.add(new FilesSetRow(set, settings.interestingFilesSetIsEnabled(set.getName()))); @@ -140,7 +146,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS try { newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - MessageNotifyUtil.Message.error("Test error"); + MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; } for (FilesSet set : newFilesSetSnapshot.values()) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index dfa7763ff7..f6c49a7586 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -85,7 +85,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { } } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - throw new IngestModuleException("Test"); + throw new IngestModuleException("Could not start up interesting files module."); } FilesIdentifierIngestModule.interestingFileSetsByJob.put(context.getJobId(), filesSets); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index db558a9f13..d2971b3107 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -51,10 +51,10 @@ final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); - private static final String INTERESTING_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS + private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME; - private static final String DEFAULT_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_FILE_NAME; + private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + LEGACY_FILES_SET_DEFS_FILE_NAME; private static InterestingItemDefsManager instance; /** @@ -93,7 +93,7 @@ final class InterestingItemDefsManager extends Observable { * possibly empty. */ synchronized Map getInterestingFilesSets() throws InterestingItemDefsManagerException { - return FilesSetXML.readDefinitionsFile(DEFAULT_FILE_SET_DEFS_PATH); + return FilesSetXML.readDefinitionsFile(LEGACY_FILE_SET_DEFS_PATH); } /** @@ -188,8 +188,7 @@ final class InterestingItemDefsManager extends Observable { } private static Map readSerializedDefinitions() throws InterestingItemDefsManagerException { - throw new InterestingItemDefsManagerException("Test"); - /*String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; + String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; File fileSetFile = new File(filePath); if (fileSetFile.exists()) { try { @@ -202,7 +201,7 @@ final class InterestingItemDefsManager extends Observable { } } else { return new HashMap(); - }*/ + } } /** @@ -511,24 +510,28 @@ final class InterestingItemDefsManager extends Observable { } catch (IOException ex) { throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", filePath), ex); } - File xmlFile = new File(DEFAULT_FILE_SET_DEFS_PATH); + File xmlFile = new File(LEGACY_FILE_SET_DEFS_PATH); if (xmlFile.exists()) { xmlFile.delete(); } return true; } } - + static class InterestingItemDefsManagerException extends Exception { + InterestingItemDefsManagerException() { - + } + InterestingItemDefsManagerException(String message) { super(message); } + InterestingItemDefsManagerException(String message, Throwable cause) { super(message, cause); } + InterestingItemDefsManagerException(Throwable cause) { super(cause); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index f45056e489..a65ea8edf8 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2011-2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,7 +54,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp "InterestingItemDefsPanel.bytes=Bytes", "InterestingItemDefsPanel.kiloBytes=Kilobytes", "InterestingItemDefsPanel.megaBytes=Megabytes", - "InterestingItemDefsPanel.gigaBytes=Gigabytes" + "InterestingItemDefsPanel.gigaBytes=Gigabytes", + "InterestingItemsDefsPanel.loadError=Could not load interesting files sets.", + "InterestingItemsDefsPanel.saveError=Could not save interesting files sets." }) private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); @@ -125,7 +127,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp try { InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - MessageNotifyUtil.Message.error("Test Error"); + MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError()); } } @@ -149,7 +151,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // by set name. this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - MessageNotifyUtil.Message.error("Test error"); + MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError()); + this.filesSets = new TreeMap<>(); } // Populate the list model for the interesting files sets list diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java index ab8381ed9b..14771992eb 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2011-2016 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. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.modules.interestingitems; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 410e366bd2..7b820ed780 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.Version; @@ -39,6 +40,10 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; @ServiceProvider(service = IngestModuleFactory.class) final public class InterestingItemsIngestModuleFactory extends IngestModuleFactoryAdapter { + @Messages({ + "InterestingItemsIngestModuleFactory.defaultSettingsError=Could not get default interesting files settings." + }) + @Override public String getModuleDisplayName() { return getModuleName(); @@ -83,7 +88,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto enabledFilesSetNames.add(name); } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - MessageNotifyUtil.Message.error("Test Error"); + MessageNotifyUtil.Message.error(Bundle.InterestingItemsIngestModuleFactory_defaultSettingsError()); } return new FilesIdentifierIngestJobSettings(enabledFilesSetNames); } From 8a5f2b4933cb3fbfe82b4c55e68493fa5821163c Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 10 Mar 2016 11:46:09 -0500 Subject: [PATCH 16/32] Updated error messages --- .../FilesIdentifierIngestJobSettingsPanel.java | 4 ++-- .../interestingitems/FilesIdentifierIngestModule.java | 6 +++++- .../modules/interestingitems/InterestingItemDefsPanel.java | 4 ++-- .../InterestingItemsIngestModuleFactory.java | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index 018824b7ad..261b23a3da 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -37,8 +37,8 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; */ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobSettingsPanel implements Observer { @Messages({ - "FilesIdentifierIngestJobSettingsPanel.updateError=Could not update interesting files sets.", - "FilesIdentifierIngestJobSettingsPanel.getError=Could not get interesting files sets." + "FilesIdentifierIngestJobSettingsPanel.updateError=Error updating interesting files sets settings file.", + "FilesIdentifierIngestJobSettingsPanel.getError=Error getting interesting files sets from settings file." }) private final FilesSetsTableModel tableModel; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index f6c49a7586..f0c9bb67fc 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.openide.util.Exceptions; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.services.Blackboard; import org.sleuthkit.autopsy.coreutils.Logger; @@ -45,6 +46,9 @@ import org.sleuthkit.datamodel.TskCoreException; * files that match interesting files set definitions. */ final class FilesIdentifierIngestModule implements FileIngestModule { + @Messages({ + "FilesIdentifierIngestModule.getFilesError=Error getting interesting files sets from file." + }) private static final Object sharedResourcesLock = new Object(); private static final Logger logger = Logger.getLogger(FilesIdentifierIngestModule.class.getName()); @@ -85,7 +89,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { } } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - throw new IngestModuleException("Could not start up interesting files module."); + throw new IngestModuleException(Bundle.FilesIdentifierIngestModule_getFilesError()); } FilesIdentifierIngestModule.interestingFileSetsByJob.put(context.getJobId(), filesSets); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index a65ea8edf8..fbd7a72263 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -55,8 +55,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp "InterestingItemDefsPanel.kiloBytes=Kilobytes", "InterestingItemDefsPanel.megaBytes=Megabytes", "InterestingItemDefsPanel.gigaBytes=Gigabytes", - "InterestingItemsDefsPanel.loadError=Could not load interesting files sets.", - "InterestingItemsDefsPanel.saveError=Could not save interesting files sets." + "InterestingItemsDefsPanel.loadError=Error loading interesting files sets from file.", + "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file." }) private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 7b820ed780..1779c8b3c2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -41,7 +41,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; final public class InterestingItemsIngestModuleFactory extends IngestModuleFactoryAdapter { @Messages({ - "InterestingItemsIngestModuleFactory.defaultSettingsError=Could not get default interesting files settings." + "InterestingItemsIngestModuleFactory.defaultSettingsError=Error getting default interesting files settings from file." }) @Override From 2481e95fae695e103512c5f3a2920a709fadea97 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 10 Mar 2016 12:53:30 -0500 Subject: [PATCH 17/32] Update FilesIdentifierIngestModule.java --- .../modules/interestingitems/FilesIdentifierIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index f0c9bb67fc..03fb011e48 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -89,7 +89,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { } } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - throw new IngestModuleException(Bundle.FilesIdentifierIngestModule_getFilesError()); + throw new IngestModuleException(Bundle.FilesIdentifierIngestModule_getFilesError(), ex); } FilesIdentifierIngestModule.interestingFileSetsByJob.put(context.getJobId(), filesSets); } From 5f0e81b425e45d701bb74c07dad3aeffbdf872b1 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 10 Mar 2016 14:09:07 -0500 Subject: [PATCH 18/32] Updated ui for editing a rule --- .../interestingitems/FilesSetRulePanel.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index efbc2197c8..fb52eb0354 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -89,6 +89,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { populateNameConditionComponents(rule); populatePathConditionComponents(rule); populateMimeConditionComponents(rule); + populateSizeConditionComponents(rule); this.setButtons(okButton, cancelButton); } @@ -146,9 +147,21 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private void populateMimeConditionComponents(FilesSet.Rule rule) { FilesSet.Rule.MimeTypeCondition mimeTypeCondition = rule.getMimeTypeCondition(); if (mimeTypeCondition != null) { + this.mimeCheck.setSelected(true); + this.mimeCheckActionPerformed(null); this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); } } + private void populateSizeConditionComponents(FilesSet.Rule rule) { + FilesSet.Rule.FileSizeCondition fileSizeCondition = rule.getFileSizeCondition(); + if (fileSizeCondition != null) { + this.fileSizeCheck.setSelected(true); + this.fileSizeCheckActionPerformed(null); + this.fileSizeSpinner.setValue(fileSizeCondition.getSizeValue()); + this.fileSizeComboBox.setSelectedItem(fileSizeCondition.getUnit().getName()); + this.equalitySymbolComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol()); + } + } /** * Sets whether or not the OK button should be enabled based upon other UI @@ -232,12 +245,16 @@ final class FilesSetRulePanel extends javax.swing.JPanel { */ private void populateNameConditionComponents(FilesSet.Rule rule) { FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition(); - this.nameTextField.setText(nameCondition.getTextToMatch()); - this.nameRegexCheckbox.setSelected(nameCondition.isRegex()); - if (nameCondition instanceof FilesSet.Rule.FullNameCondition) { - this.fullNameRadioButton.setSelected(true); - } else { - this.extensionRadioButton.setSelected(true); + if (nameCondition != null) { + this.nameCheck.setSelected(true); + this.nameCheckActionPerformed(null); + this.nameTextField.setText(nameCondition.getTextToMatch()); + this.nameRegexCheckbox.setSelected(nameCondition.isRegex()); + if (nameCondition instanceof FilesSet.Rule.FullNameCondition) { + this.fullNameRadioButton.setSelected(true); + } else { + this.extensionRadioButton.setSelected(true); + } } } @@ -250,6 +267,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private void populatePathConditionComponents(FilesSet.Rule rule) { FilesSet.Rule.ParentPathCondition pathCondition = rule.getPathCondition(); if (pathCondition != null) { + this.pathCheck.setSelected(true); + this.pathCheckActionPerformed(null); this.pathTextField.setText(pathCondition.getTextToMatch()); this.pathRegexCheckBox.setSelected(pathCondition.isRegex()); } From ac53f6bf53d7439b3f10d907edda3e663c74dba2 Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 10 Mar 2016 14:25:19 -0500 Subject: [PATCH 19/32] Deleted user artifact test ingest module --- .../modules/UserArtifacts/Bundle.properties | 2 - .../UserArtifacts/Bundle_ja.properties | 2 - .../UserArtifactIngestModule.java | 150 ------------------ .../UserArtifactIngestModuleFactory.java | 63 -------- 4 files changed, 217 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle.properties delete mode 100644 Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle_ja.properties delete mode 100755 Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModule.java delete mode 100755 Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModuleFactory.java diff --git a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle.properties deleted file mode 100755 index fb927c8e40..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle.properties +++ /dev/null @@ -1,2 +0,0 @@ -UserArtifactIngestModuleFactory.moduleName=Custom Artifact Adder -UserArtifactIngestModuleFactory.moduleDescription=Adds custom artifact types \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle_ja.properties deleted file mode 100644 index 990fd0aa8c..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/Bundle_ja.properties +++ /dev/null @@ -1,2 +0,0 @@ -UserArtifactIngestModuleFactory.moduleName=\u30AB\u30B9\u30BF\u30E0\u30A2\u30FC\u30C6\u30A3\u30D5\u30A1\u30AF\u30C8\u8FFD\u52A0\u30C4\u30FC\u30EB -UserArtifactIngestModuleFactory.moduleDescription=\u30AB\u30B9\u30BF\u30E0\u306E\u30A2\u30FC\u30C6\u30A3\u30D5\u30A1\u30AF\u30C8\u30BF\u30A4\u30D7\u3092\u8FFD\u52A0 \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModule.java deleted file mode 100755 index 7b10bdbea9..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModule.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2016 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.modules.UserArtifacts; - -import com.sun.media.jfxmedia.logging.Logger; -import java.util.List; -import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.casemodule.services.Blackboard.BlackboardException; -import org.sleuthkit.autopsy.casemodule.services.FileManager; -import org.sleuthkit.autopsy.ingest.DataSourceIngestModule; -import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress; -import org.sleuthkit.autopsy.ingest.IngestJobContext; -import org.sleuthkit.autopsy.ingest.IngestMessage; -import org.sleuthkit.autopsy.ingest.IngestServices; -import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE; -import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Test module that creates new artifact and attribute types. - */ -public class UserArtifactIngestModule implements DataSourceIngestModule { - - private BlackboardArtifact.Type type1, type2; - - @Override - public ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar) { - progressBar.switchToDeterminate(2); - try { - FileManager manager = Case.getCurrentCase().getServices().getFileManager(); - List file1 = manager.findFiles("Sunset.jpg"); //NON-NLS - List file2 = manager.findFiles("Winter.jpg"); //NON-NLS - List currArtifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); - BlackboardArtifact art1 = currArtifacts.size() == 0 ? null : currArtifacts.get(0); - BlackboardArtifact art2; - if (art1 == null) { - if (!file1.isEmpty()) { - art1 = file1.get(0).newArtifact(type1.getTypeID()); - } else { - art1 = dataSource.newArtifact(type1.getTypeID()); - } - } - if (!file2.isEmpty()) { - art2 = file2.get(0).newArtifact(type2.getTypeID()); - } else { - art2 = dataSource.newArtifact(type2.getTypeID()); - } - BlackboardAttribute.Type attributeType = Case.getCurrentCase().getSleuthkitCase().getAttributeType("Test8"); - if (attributeType == null) { - attributeType = Case.getCurrentCase().getServices().getBlackboard().addAttributeType("Test8", TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.LONG, "Header6"); - } - BlackboardAttribute.Type attributeType2 = Case.getCurrentCase().getSleuthkitCase().getAttributeType("Test9"); - if (attributeType2 == null) { - attributeType2 = Case.getCurrentCase().getServices().getBlackboard().addAttributeType("Test9", TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME, "Header7"); - - } - BlackboardAttribute.Type attributeType3 = Case.getCurrentCase().getSleuthkitCase().getAttributeType("Test0"); - if (attributeType3 == null) { - attributeType3 = Case.getCurrentCase().getServices().getBlackboard().addAttributeType("Test0", TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING, "Header8"); - - } - BlackboardAttribute.Type attributeType4 = Case.getCurrentCase().getSleuthkitCase().getAttributeType("TestA"); - if (attributeType4 == null) { - attributeType4 = Case.getCurrentCase().getServices().getBlackboard().addAttributeType("TestA", TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER, "Header9"); - - } - BlackboardAttribute.Type attributeType5 = Case.getCurrentCase().getSleuthkitCase().getAttributeType("TestB"); - if (attributeType5 == null) { - attributeType5 = Case.getCurrentCase().getServices().getBlackboard().addAttributeType("TestB", TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE, "Header0"); - - } - BlackboardAttribute.Type attributeType6 = Case.getCurrentCase().getSleuthkitCase().getAttributeType("TestC"); - if (attributeType6 == null) { - attributeType6 = Case.getCurrentCase().getServices().getBlackboard().addAttributeType("TestC", TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.BYTE, "HeaderA"); - - } - art1.addAttribute(new BlackboardAttribute(attributeType, - UserArtifactIngestModuleFactory.getModuleName(), 12345678L)); - art1.addAttribute(new BlackboardAttribute(attributeType2, - UserArtifactIngestModuleFactory.getModuleName(), 1457105587962L)); - art1.addAttribute(new BlackboardAttribute(attributeType3, - UserArtifactIngestModuleFactory.getModuleName(), "STRING VALUE TEST")); - art1.addAttribute(new BlackboardAttribute(attributeType4, - UserArtifactIngestModuleFactory.getModuleName(), 1234)); - art1.addAttribute(new BlackboardAttribute(attributeType5, - UserArtifactIngestModuleFactory.getModuleName(), 1234.5678D)); - byte[] bytes = new byte[2]; - bytes[0] = 12; - bytes[1] = 100; - art1.addAttribute(new BlackboardAttribute(attributeType6, - UserArtifactIngestModuleFactory.getModuleName(), bytes)); - art2.addAttribute(new BlackboardAttribute(attributeType2, - UserArtifactIngestModuleFactory.getModuleName(), 1457105587962L)); - art2.addAttribute(new BlackboardAttribute(attributeType, - UserArtifactIngestModuleFactory.getModuleName(), 12345678L)); - art2.addAttribute(new BlackboardAttribute(attributeType3, - UserArtifactIngestModuleFactory.getModuleName(), "STRING VALUE TEST")); - art2.addAttribute(new BlackboardAttribute(attributeType4, - UserArtifactIngestModuleFactory.getModuleName(), 1234)); - art2.addAttribute(new BlackboardAttribute(attributeType5, - UserArtifactIngestModuleFactory.getModuleName(), 1234.5678D)); - art2.addAttribute(new BlackboardAttribute(attributeType6, - UserArtifactIngestModuleFactory.getModuleName(), bytes)); - IngestServices.getInstance().postMessage(IngestMessage.createDataMessage( - "name", // NON-NLS - UserArtifactIngestModuleFactory.getModuleName(), - "Test Results", //NON-NLS - "Test", //NON-NLS - art1)); - return ProcessResult.OK; - } catch (TskCoreException | BlackboardException ex) { - return ProcessResult.ERROR; - } - } - - @Override - public void startUp(IngestJobContext context) throws IngestModuleException { - try { - type1 = Case.getCurrentCase().getSleuthkitCase().getArtifactType("FINAL TEST a"); - type2 = Case.getCurrentCase().getSleuthkitCase().getArtifactType("FINAL TEST b"); - if (type1 == null) { - type1 = Case.getCurrentCase().getServices().getBlackboard().addArtifactType("FINAL TEST a", "FINAL TEST a"); //NON-NLS - } - if (type2 == null) { - type2 = Case.getCurrentCase().getServices().getBlackboard().addArtifactType("FINAL TEST b", "FINAL TEST b"); //NON-NLS - } - } catch (BlackboardException | TskCoreException ex) { - Logger.logMsg(Logger.ERROR, "Startup failed"); //NON-NLS - } - } -} diff --git a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModuleFactory.java deleted file mode 100755 index 82ff77b269..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/UserArtifacts/UserArtifactIngestModuleFactory.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2016 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.modules.UserArtifacts; - -import org.openide.util.NbBundle; -import org.openide.util.lookup.ServiceProvider; -import org.python.apache.xmlcommons.Version; -import org.sleuthkit.autopsy.ingest.DataSourceIngestModule; -import org.sleuthkit.autopsy.ingest.IngestModuleFactory; -import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter; -import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; - -/** - * Factory for test module that creates new artifact and attribute types. - */ -@ServiceProvider(service = IngestModuleFactory.class) -public class UserArtifactIngestModuleFactory extends IngestModuleFactoryAdapter { - - static String getModuleName() { - return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleName"); - } - - @Override - public String getModuleDisplayName() { - return getModuleName(); - } - - @Override - public String getModuleDescription() { - return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleDescription"); - } - - @Override - public String getModuleVersionNumber() { - return Version.getVersion(); - } - - @Override - public DataSourceIngestModule createDataSourceIngestModule(IngestModuleIngestJobSettings ingestOptions) { - return new UserArtifactIngestModule(); - } - - @Override - public boolean isDataSourceIngestModuleFactory() { - return true; - } -} From 22165dc66380fd5fafee1fe2d8c6bcdd9675454c Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Thu, 10 Mar 2016 14:50:16 -0500 Subject: [PATCH 20/32] Updated serialization protocol --- .../interestingitems/InterestingItemDefsManager.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index d2971b3107..e337582e34 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -151,12 +151,15 @@ final class InterestingItemDefsManager extends Observable { // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. static Map readDefinitionsFile(String filePath) throws InterestingItemDefsManagerException { - Map filesSets = new HashMap<>(); + Map filesSets = readSerializedDefinitions(); + if (!filesSets.isEmpty()) { + return filesSets; + } // Check if the legacy xml file exists. File defsFile = new File(filePath); if (!defsFile.exists()) { - return readSerializedDefinitions(); + return filesSets; } // Check if the file can be read. @@ -510,10 +513,6 @@ final class InterestingItemDefsManager extends Observable { } catch (IOException ex) { throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", filePath), ex); } - File xmlFile = new File(LEGACY_FILE_SET_DEFS_PATH); - if (xmlFile.exists()) { - xmlFile.delete(); - } return true; } } From caffda5ee3de3536290c0b6d1324e33875cfb826 Mon Sep 17 00:00:00 2001 From: Chillli Date: Fri, 11 Mar 2016 12:41:30 +0100 Subject: [PATCH 21/32] Revert "Update and rewrite README.txt file into a markdown file" This reverts commit 57b36550559cc03f4011b2e7cd3e1c0f4b0669c4. --- README.md => README.txt | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) rename README.md => README.txt (80%) diff --git a/README.md b/README.txt similarity index 80% rename from README.md rename to README.txt index 324661c8fa..1bdce6e2b5 100644 --- a/README.md +++ b/README.txt @@ -1,32 +1,24 @@ -# Autopsy 4.0 -http://www.sleuthkit.org/ + Autopsy 3.0 + http://www.sleuthkit.org/ -March 3, 2016 + March 13, 2013 - -##OVERVIEW +OVERVIEW Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools. -Autopsy 4 (and 3) are a complete rewrite from Autopsy 2, and none of this document is relevant to Autopsy 2. +Autopsy 3 is a complete rewrite from Autopsy 2 and it is now Java-based. Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the current version is fully functional and fully tested only on Windows. -You can run Autopsy 4 on Linux and OS X, but it must be built from source code. +We have run it on XP, Vista, and Windows 7 with no problems. -Autopsy 3 and 4 source code are distributed under a Apache 2 license. The package contains libraries that may have different licenses. +Autopsy 3.0 is released under the Apache 2.0 license. -##INSTALLATION +INSTALLATION All Autopsy dependencies are bundled with the installer provided. -For Autopsy 3, there is no need for manual installation of additional dependencies if the installer is used. -The current version of Autopsy 4 is distributed on sleuthkit.org only as a Windows installer. It can run on Linux and OS X, but requires some manual setup. To install Autopsy, perform the following steps: - -* Run the Autopsy msi file -* If Windows prompts with User Account Control, click Yes -* Click through the dialog boxes until you click a button that says Finish -* Autopsy should now be fully installed - +There is no need for manual installation of additional dependencies if the installer is used. If you want the Japanese localized version, you must have the Japanese language pack (http://support.microsoft.com/kb/972813) installed and the default locale set to JA. (http://windows.microsoft.com/en-us/windows/change-system-locale#1TC=windows-7). @@ -35,7 +27,7 @@ Refer to the next section for additional info on third-party software requiremen Refer to the KNOWN_ISSUES.txt file for known bugs that could cause investigation problems. -##SUPPORT +SUPPORT There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that came with the installer. @@ -43,11 +35,12 @@ Send any bug reports or feature requests to the sleuthkit-users e-mail list. http://www.sleuthkit.org/support.php -##LICENSE +LICENSE The Autopsy code is released under the Apache License, Version 2. See LICENSE-2.0.txt for details. -##EMBEDDED SOFTWARE + +EMBEDDED SOFTWARE This section lists the software components and libraries that are used inside of Autopsy. These tools are bundled with the installer, unless specified otherwise. @@ -123,7 +116,7 @@ ImgScalr 4.2 for image resizing in image viewers - License: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#license -##EMBEDED RESOURCES +EMBEDED RESOURCES This section lists other resources, such as icons, that are used by Autopsy. @@ -140,4 +133,4 @@ WebHostingHub Glyphs - License: http://creativecommons.org/licenses/by/3.0/ Splashy Icons (free as in free) -- Web page: http://splashyfish.com/icons/ +- Web page: http://splashyfish.com/icons/ \ No newline at end of file From 9bd21c0e5b2be0c3778bc8af50a954f52b55c30d Mon Sep 17 00:00:00 2001 From: Chillli Date: Fri, 11 Mar 2016 13:35:51 +0100 Subject: [PATCH 22/32] Spelling mistakes in txt files are fixed --- BUILDING.txt | 2 +- NEWS.txt | 18 +++++++++--------- thirdparty/jdiff/v-custom/doc/CHANGES.txt | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/BUILDING.txt b/BUILDING.txt index deba833a0f..6a53ff870a 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -56,7 +56,7 @@ the needed places (i.e. '/usr/local'). 3) For 32-bit targets, get GStreamer Setup. GStreamer is used to view video files. -You can either download it and install it or manually by unziping the +You can either download it and install it or manually by unzipping the version that is included in the 'thirdparty/gstreamer' folder. You will need the 'bin' and 'lib/gstreamer-1.0' folders to be in your Windows PATH environment variable. diff --git a/NEWS.txt b/NEWS.txt index cf692b5ed3..53c2d3fb0c 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -10,7 +10,7 @@ Improvements: - New Embedded File Extractor module that incorporates ZIP file module and extracts images from Office documents - Views area counts updates when ZIP files and such are found - Updates to python scripting for new version of Python, scripts are reloaded each time ingest is run, and errors are better shown. -- Updated right click actions to be consistent accross all file types +- Updated right click actions to be consistent across all file types - Changed logic of Interesting Files module to look for substrings of parent path. - Lots of minor fixes and enhancements @@ -18,7 +18,7 @@ Improvements: ---------------- VERSION 3.1.2 -------------- Improvements: - New PhotoRec carving ingest module -- Regripper output is avaiable as a report instead of TOOL_OUTPUT artifact +- Regripper output is available as a report instead of TOOL_OUTPUT artifact - Updated version of RegRipper - New STIX/Cybox report module (manually run after image has been analyzed) - File type module supports user defined file types and can alert when they are found @@ -71,12 +71,12 @@ Improvements: - Times can be displayed in local time or GMT - New "EnCase-style" report that lists files and metadata in tab delimited file - Changed report wizard to make one report at a time -- report improvements (only regnerate if data exists) +- report improvements (only regenerate if data exists) - more error messages if recent activity module fails - more error checking in recent activity module and don't bail as quickly - Cleanup of recent activity module - better handle if ingest module throws exception during init() -- do not run ingest if any module faile to init() +- do not run ingest if any module failed to init() - Added FILE_DONE event to ingest manager - Added search engine parsers for linkedin, twitter, and facebook - HTML text is better formatted @@ -484,7 +484,7 @@ Autopsy Windows 03/05/05: Update: Added SSN and credit card seach patterns from Jerry Shenk. -03/05/05: Update: Added temporal data when a note is creaed. +03/05/05: Update: Added temporal data when a note is created. 03/11/05: Update: Changed to new TSK names for srch_strings and img_stat @@ -531,7 +531,7 @@ directory box, the recover bit is set so the full contents are shown. 03/29/04: Update: Changed text for the data integrity option when adding a new image. -04/20/04: Bug Fix: Fixed error that occured when data browsing with +04/20/04: Bug Fix: Fixed error that occurred when data browsing with a raw or swap image. The TSK usage for these file system types was inconsistent and it was fixed in version 1.69. (BUG: 925382). (Reported by Harald Katzer) @@ -670,7 +670,7 @@ number of bytes. than once. (Paul Bakker) 06/01/03: Bug Fix: Some keyword searches with $ in it were failing 06/01/03: Update: Keyword searches are now saved to a file and can be - found in the keyword seach main menu + found in the keyword search main menu 06/01/03: Update: Changed the format a little of the keyword search menu 06/01/03: Update: Added grep cheat sheet @@ -713,7 +713,7 @@ number of bytes. 03/20/03: Update: passwd and group files are now imported in timelines by selecting the image - no more inode values 03/20/03: Update: Cleaned up HTML code in timeline section -03/21/03: Update: Added '-z' flag to usage of 'file' so that comressed +03/21/03: Update: Added '-z' flag to usage of 'file' so that compressed files are opened. 03/21/03: Bug Fix: Some special values needed to be escaped in the grep keyword search (for non regular expressions) (\.]^$"-). @@ -770,7 +770,7 @@ Interface Changes: --------------------------- Version 1.61 --------------------------------- -08/28/02: Update: White space is allowed at the begining of the morgue file +08/28/02: Update: White space is allowed at the beginning of the morgue file 08/28/02: Bug Fix: No error is generated if md5.txt does not exist from main menu 08/28/02: Update: Improved error messages diff --git a/thirdparty/jdiff/v-custom/doc/CHANGES.txt b/thirdparty/jdiff/v-custom/doc/CHANGES.txt index 9cff1bfdcd..a348f20369 100644 --- a/thirdparty/jdiff/v-custom/doc/CHANGES.txt +++ b/thirdparty/jdiff/v-custom/doc/CHANGES.txt @@ -25,7 +25,7 @@ task to specify the language version, e.g. for dealing with asserts. #875516 Some HTML elements in user comments were being processed incorrectly. Thanks to Jojo Dijamco for pointing this bug out. -#875470 @link tags were not exanded in user comments. +#875470 @link tags were not expanded in user comments. #877437 Other issues with @link in user comments. Many thanks to Brian Duff for these bugs and their fixes. From e68cda1be6c22a40e13fc2e0f374c64749f794cb Mon Sep 17 00:00:00 2001 From: Oliver Spohngellert Date: Fri, 11 Mar 2016 10:14:10 -0500 Subject: [PATCH 23/32] Added documentation --- .../interestingitems/InterestingItemDefsManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index e337582e34..20d6c1e5c7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -190,6 +190,14 @@ final class InterestingItemDefsManager extends Observable { return filesSets; } + /** + * Reads the definitions from the serialization file + * + * @return the map representing settings saved to serialization file, + * empty set if the file does not exist. + * + * @throws InterestingItemDefsManagerException if file could not be read + */ private static Map readSerializedDefinitions() throws InterestingItemDefsManagerException { String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; File fileSetFile = new File(filePath); From 25bd98d8e9c5fe4627ac488d2ea46777ebcd6cdd Mon Sep 17 00:00:00 2001 From: Eugene Livis Date: Fri, 11 Mar 2016 15:02:35 -0500 Subject: [PATCH 24/32] log internal Java and Apache errors as WARNING in Embedded File Extractor --- .../embeddedfileextractor/Bundle.properties | 1 + .../embeddedfileextractor/ImageExtractor.java | 136 +++++++++++++++--- 2 files changed, 116 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties index 06b5b5a44f..e2e029d495 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/Bundle.properties @@ -35,6 +35,7 @@ EmbeddedFileExtractorIngestModule.ImageExtractor.pptContainer.init.err=Ppt conta EmbeddedFileExtractorIngestModule.ImageExtractor.pptxContainer.init.err=Pptx container could not be initialized while reading: {0} EmbeddedFileExtractorIngestModule.ImageExtractor.xlsContainer.init.err=Xls container could not be initialized while reading: {0} EmbeddedFileExtractorIngestModule.ImageExtractor.xlsxContainer.init.err=Xlsx container could not be initialized while reading: {0} +EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err=Embedded File Extractor is unable to read content of {0} EmbeddedFileExtractorIngestModule.ImageExtractor.extractImage.addToDB.exception.msg=Unable to add the derived files to the database. EmbeddedFileExtractorIngestModule.ImageExtractor.getOutputFolderPath.exception.msg=Could not get path for image extraction from Abstract File\: {0} EmbeddedFileExtractorIngestModule.ImageExtractor.getOutputFolderPath.exception.msg=Could not get path for image extraction from Abstract File: {0} diff --git a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/ImageExtractor.java b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/ImageExtractor.java index c916aa7f55..cb601c62a7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/ImageExtractor.java +++ b/Core/src/org/sleuthkit/autopsy/modules/embeddedfileextractor/ImageExtractor.java @@ -25,7 +25,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; -import org.apache.poi.OldFileFormatException; import org.apache.poi.hslf.model.Picture; import org.apache.poi.hslf.usermodel.PictureData; import org.apache.poi.hslf.usermodel.SlideShow; @@ -210,13 +209,23 @@ class ImageExtractor { HWPFDocument doc = null; try { doc = new HWPFDocument(new ReadContentInputStream(af)); - } catch (Throwable ex) { + } catch (Throwable ignore) { // instantiating POI containers throw RuntimeExceptions logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.docContainer.init.err", af.getName())); //NON-NLS return null; } - PicturesTable pictureTable = doc.getPicturesTable(); - List listOfAllPictures = pictureTable.getAllPictures(); + + PicturesTable pictureTable = null; + List listOfAllPictures = null; + try { + pictureTable = doc.getPicturesTable(); + listOfAllPictures = pictureTable.getAllPictures(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + String outputFolderPath; if (listOfAllPictures.isEmpty()) { return null; @@ -227,9 +236,17 @@ class ImageExtractor { return null; } listOfExtractedImages = new ArrayList<>(); + byte[] data = null; for (org.apache.poi.hwpf.usermodel.Picture picture : listOfAllPictures) { String fileName = picture.suggestFullFileName(); - writeExtractedImage(Paths.get(outputFolderPath, fileName).toString(), picture.getContent()); + try { + data = picture.getContent(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + writeExtractedImage(Paths.get(outputFolderPath, fileName).toString(), data); // TODO Extract more info from the Picture viz ctime, crtime, atime, mtime listOfExtractedImages.add(new ExtractedImage(fileName, getFileRelativePath(fileName), picture.getSize(), af)); } @@ -250,12 +267,19 @@ class ImageExtractor { XWPFDocument docx = null; try { docx = new XWPFDocument(new ReadContentInputStream(af)); - } catch (Throwable ex) { + } catch (Throwable ignore) { // instantiating POI containers throw RuntimeExceptions logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.docxContainer.init.err", af.getName())); //NON-NLS return null; } - List listOfAllPictures = docx.getAllPictures(); + List listOfAllPictures = null; + try { + listOfAllPictures = docx.getAllPictures(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } // if no images are extracted from the PPT, return null, else initialize // the output folder for image extraction. @@ -270,9 +294,17 @@ class ImageExtractor { return null; } listOfExtractedImages = new ArrayList<>(); + byte[] data = null; for (XWPFPictureData xwpfPicture : listOfAllPictures) { String fileName = xwpfPicture.getFileName(); - writeExtractedImage(Paths.get(outputFolderPath, fileName).toString(), xwpfPicture.getData()); + try { + data = xwpfPicture.getData(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + writeExtractedImage(Paths.get(outputFolderPath, fileName).toString(), data); listOfExtractedImages.add(new ExtractedImage(fileName, getFileRelativePath(fileName), xwpfPicture.getData().length, af)); } return listOfExtractedImages; @@ -291,14 +323,21 @@ class ImageExtractor { SlideShow ppt = null; try { ppt = new SlideShow(new ReadContentInputStream(af)); - } catch (Throwable ex) { + } catch (Throwable ignore) { // instantiating POI containers throw RuntimeExceptions logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.pptContainer.init.err", af.getName())); //NON-NLS return null; } //extract all pictures contained in the presentation - PictureData[] listOfAllPictures = ppt.getPictureData(); + PictureData[] listOfAllPictures = null; + try { + listOfAllPictures = ppt.getPictureData(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } // if no images are extracted from the PPT, return null, else initialize // the output folder for image extraction. @@ -317,6 +356,7 @@ class ImageExtractor { // extraction path - outputFolder/image_number.ext int i = 0; listOfExtractedImages = new ArrayList<>(); + byte[] data = null; for (PictureData pictureData : listOfAllPictures) { // Get image extension, generate image name, write image to the module @@ -343,7 +383,14 @@ class ImageExtractor { continue; } String imageName = UNKNOWN_NAME_PREFIX + i + ext; //NON-NLS - writeExtractedImage(Paths.get(outputFolderPath, imageName).toString(), pictureData.getData()); + try { + data = pictureData.getData(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + writeExtractedImage(Paths.get(outputFolderPath, imageName).toString(), data); listOfExtractedImages.add(new ExtractedImage(imageName, getFileRelativePath(imageName), pictureData.getData().length, af)); i++; } @@ -363,12 +410,19 @@ class ImageExtractor { XMLSlideShow pptx; try { pptx = new XMLSlideShow(new ReadContentInputStream(af)); - } catch (Throwable ex) { + } catch (Throwable ignore) { // instantiating POI containers throw RuntimeExceptions logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.pptxContainer.init.err", af.getName())); //NON-NLS return null; } - List listOfAllPictures = pptx.getAllPictures(); + List listOfAllPictures = null; + try { + listOfAllPictures = pptx.getAllPictures(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } // if no images are extracted from the PPT, return null, else initialize // the output folder for image extraction. @@ -384,12 +438,20 @@ class ImageExtractor { } listOfExtractedImages = new ArrayList<>(); + byte[] data = null; for (XSLFPictureData xslsPicture : listOfAllPictures) { // get image file name, write it to the module outputFolder, and add // it to the listOfExtractedImageAbstractFiles. String fileName = xslsPicture.getFileName(); - writeExtractedImage(Paths.get(outputFolderPath, fileName).toString(), xslsPicture.getData()); + try { + data = xslsPicture.getData(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + writeExtractedImage(Paths.get(outputFolderPath, fileName).toString(), data); listOfExtractedImages.add(new ExtractedImage(fileName, getFileRelativePath(fileName), xslsPicture.getData().length, af)); } @@ -412,13 +474,21 @@ class ImageExtractor { Workbook xls; try { xls = new HSSFWorkbook(new ReadContentInputStream(af)); - } catch (Throwable ex) { + } catch (Throwable ignore) { // instantiating POI containers throw RuntimeExceptions - logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.xlsContainer.init.err", af.getName()) + af.getName()); //NON-NLS + logger.log(Level.WARNING, "{0}{1}", new Object[]{NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.xlsContainer.init.err", af.getName()), af.getName()}); //NON-NLS return null; } - List listOfAllPictures = xls.getAllPictures(); + List listOfAllPictures = null; + try { + listOfAllPictures = xls.getAllPictures(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + // if no images are extracted from the PPT, return null, else initialize // the output folder for image extraction. String outputFolderPath; @@ -434,9 +504,17 @@ class ImageExtractor { int i = 0; listOfExtractedImages = new ArrayList<>(); + byte[] data = null; for (org.apache.poi.ss.usermodel.PictureData pictureData : listOfAllPictures) { String imageName = UNKNOWN_NAME_PREFIX + i + "." + pictureData.suggestFileExtension(); //NON-NLS - writeExtractedImage(Paths.get(outputFolderPath, imageName).toString(), pictureData.getData()); + try { + data = pictureData.getData(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + writeExtractedImage(Paths.get(outputFolderPath, imageName).toString(), data); listOfExtractedImages.add(new ExtractedImage(imageName, getFileRelativePath(imageName), pictureData.getData().length, af)); i++; } @@ -457,13 +535,21 @@ class ImageExtractor { Workbook xlsx; try { xlsx = new XSSFWorkbook(new ReadContentInputStream(af)); - } catch (Throwable ex) { + } catch (Throwable ignore) { // instantiating POI containers throw RuntimeExceptions logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.xlsxContainer.init.err", af.getName())); //NON-NLS return null; } - List listOfAllPictures = xlsx.getAllPictures(); + List listOfAllPictures = null; + try { + listOfAllPictures = xlsx.getAllPictures(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + // if no images are extracted from the PPT, return null, else initialize // the output folder for image extraction. String outputFolderPath; @@ -479,9 +565,17 @@ class ImageExtractor { int i = 0; listOfExtractedImages = new ArrayList<>(); + byte[] data = null; for (org.apache.poi.ss.usermodel.PictureData pictureData : listOfAllPictures) { String imageName = UNKNOWN_NAME_PREFIX + i + "." + pictureData.suggestFileExtension(); - writeExtractedImage(Paths.get(outputFolderPath, imageName).toString(), pictureData.getData()); + try { + data = pictureData.getData(); + } catch (Exception ignore) { + // log internal Java and Apache errors as WARNING + logger.log(Level.WARNING, NbBundle.getMessage(this.getClass(), "EmbeddedFileExtractorIngestModule.ImageExtractor.processing.err", af.getName())); //NON-NLS + return null; + } + writeExtractedImage(Paths.get(outputFolderPath, imageName).toString(), data); listOfExtractedImages.add(new ExtractedImage(imageName, getFileRelativePath(imageName), pictureData.getData().length, af)); i++; } From 5711bff04523d3209ec6b4b35be04241210ce6e3 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Sat, 12 Mar 2016 16:40:31 -0500 Subject: [PATCH 25/32] Stop creating file type attributes on gen info artifacts --- .../modules/filetypeid/FileTypeDetector.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java index fdcf90eae5..3ea4e6dbdf 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 2014-2016 Basis Technology Corp. + * Copyright 2011-2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -139,26 +139,13 @@ public class FileTypeDetector { * @throws TskCoreException if detection is required and there is a problem * writing the result to the case database. */ - @SuppressWarnings("deprecation") public String getFileType(AbstractFile file) throws TskCoreException { String mimeType = file.getMIMEType(); if (null != mimeType) { return mimeType; } - mimeType = detect(file); Case.getCurrentCase().getSleuthkitCase().setFileMIMEType(file, mimeType); - - /* - * Add the file type attribute to the general info artifact. Note that - * no property change is fired for this blackboard posting because - * general info artifacts are different from other artifacts, e.g., they - * are not displayed in the results tree. - */ - BlackboardArtifact getInfoArt = file.getGenInfoArtifact(); - BlackboardAttribute batt = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG, FileTypeIdModuleFactory.getModuleName(), mimeType); - getInfoArt.addAttribute(batt); - return mimeType; } From e41cebbe9d6f7881fe55ceacdc292908ea14b146 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Sat, 12 Mar 2016 16:42:16 -0500 Subject: [PATCH 26/32] Make tskdbdiff.py handle data_source_info table UUIDs as device ids --- test/script/tskdbdiff.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/script/tskdbdiff.py b/test/script/tskdbdiff.py index 5fcbb8ff2a..c70263fd39 100755 --- a/test/script/tskdbdiff.py +++ b/test/script/tskdbdiff.py @@ -355,6 +355,7 @@ def normalize_db_entry(line, table): object_index = line.find('INSERT INTO "tsk_objects"') report_index = line.find('INSERT INTO "reports"') layout_index = line.find('INSERT INTO "tsk_file_layout"') + data_source_info_index = line.find('INSERT INTO "data_source_info"') parens = line[line.find('(') + 1 : line.find(')')] fields_list = parens.replace(" ", "").split(',') @@ -395,6 +396,10 @@ def normalize_db_entry(line, table): fields_list[2] = "0" newLine = ('INSERT INTO "reports" VALUES(' + ','.join(fields_list) + ');') return newLine + elif (data_source_info_index != -1): + fields_list[1] = "{device id}" + newLine = ('INSERT INTO "data_source_info" VALUES(' + ','.join(fields_list) + ');') + return newLine else: return line From d4a076d1e5c0274244b17a5b77a470a20b132435 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 15 Mar 2016 08:55:25 -0400 Subject: [PATCH 27/32] Revert "Stop creating file type attributes on gen info artifacts" This reverts commit 5711bff04523d3209ec6b4b35be04241210ce6e3. --- .../modules/filetypeid/FileTypeDetector.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java index 3ea4e6dbdf..fdcf90eae5 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-2016 Basis Technology Corp. + * Copyright 2014-2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -139,13 +139,26 @@ public class FileTypeDetector { * @throws TskCoreException if detection is required and there is a problem * writing the result to the case database. */ + @SuppressWarnings("deprecation") public String getFileType(AbstractFile file) throws TskCoreException { String mimeType = file.getMIMEType(); if (null != mimeType) { return mimeType; } + mimeType = detect(file); Case.getCurrentCase().getSleuthkitCase().setFileMIMEType(file, mimeType); + + /* + * Add the file type attribute to the general info artifact. Note that + * no property change is fired for this blackboard posting because + * general info artifacts are different from other artifacts, e.g., they + * are not displayed in the results tree. + */ + BlackboardArtifact getInfoArt = file.getGenInfoArtifact(); + BlackboardAttribute batt = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG, FileTypeIdModuleFactory.getModuleName(), mimeType); + getInfoArt.addAttribute(batt); + return mimeType; } From f449a4a054cd9022e41d0fe67f108651c3a1bc81 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 15 Mar 2016 09:27:29 -0400 Subject: [PATCH 28/32] Update README --- README.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.txt b/README.txt index 1bdce6e2b5..0d07b4507f 100644 --- a/README.txt +++ b/README.txt @@ -1,46 +1,46 @@ - Autopsy 3.0 - http://www.sleuthkit.org/ +Autopsy 4 +http://www.sleuthkit.org/ - March 13, 2013 +March 15, 2016 -OVERVIEW +##OVERVIEW Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools. -Autopsy 3 is a complete rewrite from Autopsy 2 and it is now Java-based. +Autopsy 3 was a complete rewrite from Autopsy 2 to make it Java-based. +Autopsy 4 improves on Autopsy 3 by supporting collaboration on a single case by multiple users. Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the current version is fully functional and fully tested only on Windows. We have run it on XP, Vista, and Windows 7 with no problems. -Autopsy 3.0 is released under the Apache 2.0 license. +Autopsy 4 is released under the Apache 2.0 license. +Some libraries Autopsy uses may have different, but similar open source licenses. -INSTALLATION +##INSTALLATION -All Autopsy dependencies are bundled with the installer provided. -There is no need for manual installation of additional dependencies if the installer is used. +For a Windows installation, all Autopsy dependencies are bundled with the installer provided. +There is no need for manual installation of additional dependencies if the Windows installer is used. If you want the Japanese localized version, you must have the Japanese language pack (http://support.microsoft.com/kb/972813) installed and the default locale set to JA. (http://windows.microsoft.com/en-us/windows/change-system-locale#1TC=windows-7). -Refer to the next section for additional info on third-party software requirements to run Autopsy without installer. - Refer to the KNOWN_ISSUES.txt file for known bugs that could cause investigation problems. -SUPPORT +##SUPPORT -There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that came with the installer. +There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that comes with the installer. Send any bug reports or feature requests to the sleuthkit-users e-mail list. http://www.sleuthkit.org/support.php -LICENSE +##LICENSE The Autopsy code is released under the Apache License, Version 2. See LICENSE-2.0.txt for details. -EMBEDDED SOFTWARE +##EMBEDDED SOFTWARE This section lists the software components and libraries that are used inside of Autopsy. These tools are bundled with the installer, unless specified otherwise. @@ -116,7 +116,7 @@ ImgScalr 4.2 for image resizing in image viewers - License: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#license -EMBEDED RESOURCES +##EMBEDDED RESOURCES This section lists other resources, such as icons, that are used by Autopsy. From b7a3fee64d4ca61229e21107419beaf93fa4f4c0 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 15 Mar 2016 09:28:08 -0400 Subject: [PATCH 29/32] Convert README from plain text to markdown --- README.txt | 136 ----------------------------------------------------- 1 file changed, 136 deletions(-) delete mode 100644 README.txt diff --git a/README.txt b/README.txt deleted file mode 100644 index 0d07b4507f..0000000000 --- a/README.txt +++ /dev/null @@ -1,136 +0,0 @@ -Autopsy 4 -http://www.sleuthkit.org/ - -March 15, 2016 - - -##OVERVIEW - -Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools. -Autopsy 3 was a complete rewrite from Autopsy 2 to make it Java-based. -Autopsy 4 improves on Autopsy 3 by supporting collaboration on a single case by multiple users. - -Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the current version is fully functional and fully tested only on Windows. -We have run it on XP, Vista, and Windows 7 with no problems. - -Autopsy 4 is released under the Apache 2.0 license. -Some libraries Autopsy uses may have different, but similar open source licenses. - - -##INSTALLATION - -For a Windows installation, all Autopsy dependencies are bundled with the installer provided. -There is no need for manual installation of additional dependencies if the Windows installer is used. - -If you want the Japanese localized version, you must have the Japanese language pack (http://support.microsoft.com/kb/972813) installed and the default locale set to JA. (http://windows.microsoft.com/en-us/windows/change-system-locale#1TC=windows-7). - -Refer to the KNOWN_ISSUES.txt file for known bugs that could cause investigation problems. - - -##SUPPORT - -There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that comes with the installer. - -Send any bug reports or feature requests to the sleuthkit-users e-mail list. - http://www.sleuthkit.org/support.php - - -##LICENSE - -The Autopsy code is released under the Apache License, Version 2. See LICENSE-2.0.txt for details. - - -##EMBEDDED SOFTWARE - -This section lists the software components and libraries that are used inside of -Autopsy. These tools are bundled with the installer, unless specified otherwise. - -JRE (Java Runtime Environment) 1.8 -- Web page: http://www.oracle.com/technetwork/java/index.html -- License: http://www.oracle.com/technetwork/java/javase/terms/license/index.html - -Netbeans 7.3 RCP platform and .jar files bundled with the platform -- Web page: http://netbeans.org/features/platform/ -- License: -http://services.netbeans.org/downloads/licence/nb-7.0-final-2011-04-20-license.txt - -Sleuth Kit for analyzing disk images. -- Web page: http://www.sleuthkit.org/sleuthkit/ -- License: http://sleuthkit.org/sleuthkit/licenses.php - -Libewf for opening E01 files -- Web page: http://sourceforge.net/projects/libewf/ -- License: http://www.gnu.org/licenses/lgpl.html - -zlib for opening E01 files -- Web page: http://zlib.net/ -- License: http://zlib.net/zlib_license.html - -Solr (including Lucene and TIKA) for keyword search -- Web page: http://projects.apache.org/projects/solr.html -- License: http://www.apache.org/licenses/LICENSE-2.0 - -GStreamer for viewing video files -- Web page: http://gstreamer.freedesktop.org/ -- License: http://www.gnu.org/licenses/lgpl.html - -GStreamer-java for viewing video files -- Web page: http://code.google.com/p/gstreamer-java/ -- License: http://www.gnu.org/licenses/lgpl.html - -Regripper for pulling recently activity -(Including custom plugins) -- Web page: http://regripper.wordpress.com/ -- License: http://www.gnu.org/licenses/gpl.html - -Pasco2 for pulling Internet Explorer activity -- Web page: http://sourceforge.net/projects/pasco2/ -- License: http://www.gnu.org/licenses/gpl.html - -Jericho for extracting content from HTML files -- Web page: http://jerichohtml.sourceforge.net/ -- License: http://www.gnu.org/copyleft/lesser.html - -Advanced installer 9 (Freeware) -(not embedded in Autopsy, but used to generate Autopsy installer.) -- Web page: http://www.advancedinstaller.com/ - -Metadata Extractor 2.6.2 for extracting Exif metadata -- Web page: http://www.drewnoakes.com/code/exif/ -- License: http://www.apache.org/licenses/LICENSE-2.0 - -Reflections 0.9.8 for ingest module loading -- Web page: http://code.google.com/p/reflections -- License: http://en.wikipedia.org/wiki/WTFPL - -Sigar for process monitoring -- Web page: http://support.hyperic.com/display/SIGAR/Home -- License: http://support.hyperic.com/display/SIGAR/Home#Home-license - -7Zip and 7Zip java bindings for 7Zip extractor module -- Web page: http://sevenzipjbind.sourceforge.net/ -- License: http://sourceforge.net/directory/license:lgpl/ - -ImgScalr 4.2 for image resizing in image viewers -- Web page: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ -- License: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#license - - -##EMBEDDED RESOURCES - -This section lists other resources, such as icons, that are used by Autopsy. - -FAMFAMFAM Silk Icons v1.3 -- Web page: http://www.famfamfam.com/lab/icons/silk/ -- License: http://creativecommons.org/licenses/by/3.0/ - -Fugue Icons v3.5.6 -- Web page: http://p.yusukekamiyamane.com/ -- License: http://creativecommons.org/licenses/by/3.0/ - -WebHostingHub Glyphs -- Web page: http://www.webhostinghub.com/glyphs/ -- License: http://creativecommons.org/licenses/by/3.0/ - -Splashy Icons (free as in free) -- Web page: http://splashyfish.com/icons/ \ No newline at end of file From 61bbe12b7bc916294fb0a190c2ae7f7fa19485ba Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 15 Mar 2016 09:32:37 -0400 Subject: [PATCH 30/32] Add omitted README.md file --- README.md | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..0d07b4507f --- /dev/null +++ b/README.md @@ -0,0 +1,136 @@ +Autopsy 4 +http://www.sleuthkit.org/ + +March 15, 2016 + + +##OVERVIEW + +Autopsy is a graphical interface to The Sleuth Kit and other open source digital forensics tools. +Autopsy 3 was a complete rewrite from Autopsy 2 to make it Java-based. +Autopsy 4 improves on Autopsy 3 by supporting collaboration on a single case by multiple users. + +Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the current version is fully functional and fully tested only on Windows. +We have run it on XP, Vista, and Windows 7 with no problems. + +Autopsy 4 is released under the Apache 2.0 license. +Some libraries Autopsy uses may have different, but similar open source licenses. + + +##INSTALLATION + +For a Windows installation, all Autopsy dependencies are bundled with the installer provided. +There is no need for manual installation of additional dependencies if the Windows installer is used. + +If you want the Japanese localized version, you must have the Japanese language pack (http://support.microsoft.com/kb/972813) installed and the default locale set to JA. (http://windows.microsoft.com/en-us/windows/change-system-locale#1TC=windows-7). + +Refer to the KNOWN_ISSUES.txt file for known bugs that could cause investigation problems. + + +##SUPPORT + +There is a built-in help system in Autopsy once you get it started. There is also a QuickStart Guide that comes with the installer. + +Send any bug reports or feature requests to the sleuthkit-users e-mail list. + http://www.sleuthkit.org/support.php + + +##LICENSE + +The Autopsy code is released under the Apache License, Version 2. See LICENSE-2.0.txt for details. + + +##EMBEDDED SOFTWARE + +This section lists the software components and libraries that are used inside of +Autopsy. These tools are bundled with the installer, unless specified otherwise. + +JRE (Java Runtime Environment) 1.8 +- Web page: http://www.oracle.com/technetwork/java/index.html +- License: http://www.oracle.com/technetwork/java/javase/terms/license/index.html + +Netbeans 7.3 RCP platform and .jar files bundled with the platform +- Web page: http://netbeans.org/features/platform/ +- License: +http://services.netbeans.org/downloads/licence/nb-7.0-final-2011-04-20-license.txt + +Sleuth Kit for analyzing disk images. +- Web page: http://www.sleuthkit.org/sleuthkit/ +- License: http://sleuthkit.org/sleuthkit/licenses.php + +Libewf for opening E01 files +- Web page: http://sourceforge.net/projects/libewf/ +- License: http://www.gnu.org/licenses/lgpl.html + +zlib for opening E01 files +- Web page: http://zlib.net/ +- License: http://zlib.net/zlib_license.html + +Solr (including Lucene and TIKA) for keyword search +- Web page: http://projects.apache.org/projects/solr.html +- License: http://www.apache.org/licenses/LICENSE-2.0 + +GStreamer for viewing video files +- Web page: http://gstreamer.freedesktop.org/ +- License: http://www.gnu.org/licenses/lgpl.html + +GStreamer-java for viewing video files +- Web page: http://code.google.com/p/gstreamer-java/ +- License: http://www.gnu.org/licenses/lgpl.html + +Regripper for pulling recently activity +(Including custom plugins) +- Web page: http://regripper.wordpress.com/ +- License: http://www.gnu.org/licenses/gpl.html + +Pasco2 for pulling Internet Explorer activity +- Web page: http://sourceforge.net/projects/pasco2/ +- License: http://www.gnu.org/licenses/gpl.html + +Jericho for extracting content from HTML files +- Web page: http://jerichohtml.sourceforge.net/ +- License: http://www.gnu.org/copyleft/lesser.html + +Advanced installer 9 (Freeware) +(not embedded in Autopsy, but used to generate Autopsy installer.) +- Web page: http://www.advancedinstaller.com/ + +Metadata Extractor 2.6.2 for extracting Exif metadata +- Web page: http://www.drewnoakes.com/code/exif/ +- License: http://www.apache.org/licenses/LICENSE-2.0 + +Reflections 0.9.8 for ingest module loading +- Web page: http://code.google.com/p/reflections +- License: http://en.wikipedia.org/wiki/WTFPL + +Sigar for process monitoring +- Web page: http://support.hyperic.com/display/SIGAR/Home +- License: http://support.hyperic.com/display/SIGAR/Home#Home-license + +7Zip and 7Zip java bindings for 7Zip extractor module +- Web page: http://sevenzipjbind.sourceforge.net/ +- License: http://sourceforge.net/directory/license:lgpl/ + +ImgScalr 4.2 for image resizing in image viewers +- Web page: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ +- License: http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/#license + + +##EMBEDDED RESOURCES + +This section lists other resources, such as icons, that are used by Autopsy. + +FAMFAMFAM Silk Icons v1.3 +- Web page: http://www.famfamfam.com/lab/icons/silk/ +- License: http://creativecommons.org/licenses/by/3.0/ + +Fugue Icons v3.5.6 +- Web page: http://p.yusukekamiyamane.com/ +- License: http://creativecommons.org/licenses/by/3.0/ + +WebHostingHub Glyphs +- Web page: http://www.webhostinghub.com/glyphs/ +- License: http://creativecommons.org/licenses/by/3.0/ + +Splashy Icons (free as in free) +- Web page: http://splashyfish.com/icons/ \ No newline at end of file From 2d68f792a0a7e5948b41288fb286b9ecc0566158 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 15 Mar 2016 09:34:18 -0400 Subject: [PATCH 31/32] Update README for formatting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0d07b4507f..ee157087cc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ Autopsy 4 + http://www.sleuthkit.org/ March 15, 2016 From c9d95d85bc1ac507b52562fd2c07f2b16d34ad79 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 15 Mar 2016 09:40:16 -0400 Subject: [PATCH 32/32] README updates --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ee157087cc..fc0a280a40 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Although Autopsy is designed to be cross-platform (Windows, Linux, MacOSX), the We have run it on XP, Vista, and Windows 7 with no problems. Autopsy 4 is released under the Apache 2.0 license. -Some libraries Autopsy uses may have different, but similar open source licenses. +Some libraries Autopsy uses may have different, but similar, open source licenses. ##INSTALLATION @@ -43,24 +43,24 @@ The Autopsy code is released under the Apache License, Version 2. See LICENSE-2 ##EMBEDDED SOFTWARE -This section lists the software components and libraries that are used inside of -Autopsy. These tools are bundled with the installer, unless specified otherwise. +This section lists the software components and libraries that are used by of +Autopsy. These tools are bundled with the Windows installer, unless specified otherwise. JRE (Java Runtime Environment) 1.8 - Web page: http://www.oracle.com/technetwork/java/index.html - License: http://www.oracle.com/technetwork/java/javase/terms/license/index.html -Netbeans 7.3 RCP platform and .jar files bundled with the platform +Netbeans 8.0.2 RCP platform and .jar files bundled with the platform - Web page: http://netbeans.org/features/platform/ - License: -http://services.netbeans.org/downloads/licence/nb-7.0-final-2011-04-20-license.txt +https://netbeans.org/downloads/jdk-bundle/8.0.2/nb802-LICENSE.txt Sleuth Kit for analyzing disk images. - Web page: http://www.sleuthkit.org/sleuthkit/ - License: http://sleuthkit.org/sleuthkit/licenses.php Libewf for opening E01 files -- Web page: http://sourceforge.net/projects/libewf/ +- Web page: https://github.com/libyal/libewf - License: http://www.gnu.org/licenses/lgpl.html zlib for opening E01 files