Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
HashLookupModuleSettings.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org *
6 
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.modules.hashdatabase;
20 
21 import java.util.ArrayList;
22 import java.util.HashSet;
23 import java.util.List;
25 
29 final class HashLookupModuleSettings implements IngestModuleIngestJobSettings {
30 
31  private static final long serialVersionUID = 1L;
32  private HashSet<String> namesOfEnabledKnownHashSets;
33  private HashSet<String> namesOfDisabledKnownHashSets; // Added in version 1.1
34  private HashSet<String> namesOfEnabledKnownBadHashSets;
35  private HashSet<String> namesOfDisabledKnownBadHashSets; // Added in version 1.1
36  private boolean shouldCalculateHashes = true;
37 
46  HashLookupModuleSettings(boolean shouldCalculateHashes,
47  List<String> namesOfEnabledKnownHashSets,
48  List<String> namesOfEnabledKnownBadHashSets) {
49  this(shouldCalculateHashes, namesOfEnabledKnownHashSets, namesOfEnabledKnownBadHashSets, new ArrayList<>(), new ArrayList<>());
50  }
51 
63  HashLookupModuleSettings(boolean shouldCalculateHashes,
64  List<String> namesOfEnabledKnownHashSets,
65  List<String> namesOfEnabledKnownBadHashSets,
66  List<String> namesOfDisabledKnownHashSets,
67  List<String> namesOfDisabledKnownBadHashSets) {
68  this.shouldCalculateHashes = shouldCalculateHashes;
69  this.namesOfEnabledKnownHashSets = new HashSet<>(namesOfEnabledKnownHashSets);
70  this.namesOfEnabledKnownBadHashSets = new HashSet<>(namesOfEnabledKnownBadHashSets);
71  this.namesOfDisabledKnownHashSets = new HashSet<>(namesOfDisabledKnownHashSets);
72  this.namesOfDisabledKnownBadHashSets = new HashSet<>(namesOfDisabledKnownBadHashSets);
73  }
74 
78  @Override
79  public long getVersionNumber() {
80  this.upgradeFromOlderVersions();
81  return HashLookupModuleSettings.serialVersionUID;
82  }
83 
90  boolean shouldCalculateHashes() {
91  this.upgradeFromOlderVersions();
92  return this.shouldCalculateHashes;
93  }
94 
102  boolean isHashSetEnabled(String hashSetName) {
103  this.upgradeFromOlderVersions();
104  return !(this.namesOfDisabledKnownHashSets.contains(hashSetName) || this.namesOfDisabledKnownBadHashSets.contains(hashSetName));
105  }
106 
112  List<String> getNamesOfEnabledKnownHashSets() {
113  this.upgradeFromOlderVersions();
114  return new ArrayList<>(this.namesOfEnabledKnownHashSets);
115  }
116 
122  List<String> getNamesOfDisabledKnownHashSets() {
123  this.upgradeFromOlderVersions();
124  return new ArrayList<>(namesOfDisabledKnownHashSets);
125  }
126 
132  List<String> getNamesOfEnabledKnownBadHashSets() {
133  this.upgradeFromOlderVersions();
134  return new ArrayList<>(this.namesOfEnabledKnownBadHashSets);
135  }
136 
142  List<String> getNamesOfDisabledKnownBadHashSets() {
143  this.upgradeFromOlderVersions();
144  return new ArrayList<>(this.namesOfDisabledKnownBadHashSets);
145  }
146 
151  private void upgradeFromOlderVersions() {
152  if (null == this.namesOfDisabledKnownHashSets) {
153  this.namesOfDisabledKnownHashSets = new HashSet<>();
154  }
155  if (null == this.namesOfDisabledKnownBadHashSets) {
156  this.namesOfDisabledKnownBadHashSets = new HashSet<>();
157  }
158  }
159 
160 }

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.