Autopsy  4.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 
47  HashLookupModuleSettings(boolean shouldCalculateHashes,
48  List<String> namesOfEnabledKnownHashSets,
49  List<String> namesOfEnabledKnownBadHashSets) {
50  this(shouldCalculateHashes, namesOfEnabledKnownHashSets, namesOfEnabledKnownBadHashSets, new ArrayList<>(), new ArrayList<>());
51  }
52 
66  HashLookupModuleSettings(boolean shouldCalculateHashes,
67  List<String> namesOfEnabledKnownHashSets,
68  List<String> namesOfEnabledKnownBadHashSets,
69  List<String> namesOfDisabledKnownHashSets,
70  List<String> namesOfDisabledKnownBadHashSets) {
71  this.shouldCalculateHashes = shouldCalculateHashes;
72  this.namesOfEnabledKnownHashSets = new HashSet<>(namesOfEnabledKnownHashSets);
73  this.namesOfEnabledKnownBadHashSets = new HashSet<>(namesOfEnabledKnownBadHashSets);
74  this.namesOfDisabledKnownHashSets = new HashSet<>(namesOfDisabledKnownHashSets);
75  this.namesOfDisabledKnownBadHashSets = new HashSet<>(namesOfDisabledKnownBadHashSets);
76  }
77 
81  @Override
82  public long getVersionNumber() {
83  this.upgradeFromOlderVersions();
84  return HashLookupModuleSettings.serialVersionUID;
85  }
86 
93  boolean shouldCalculateHashes() {
94  this.upgradeFromOlderVersions();
95  return this.shouldCalculateHashes;
96  }
97 
106  boolean isHashSetEnabled(String hashSetName) {
107  this.upgradeFromOlderVersions();
108  return !(this.namesOfDisabledKnownHashSets.contains(hashSetName) || this.namesOfDisabledKnownBadHashSets.contains(hashSetName));
109  }
110 
116  List<String> getNamesOfEnabledKnownHashSets() {
117  this.upgradeFromOlderVersions();
118  return new ArrayList<>(this.namesOfEnabledKnownHashSets);
119  }
120 
126  List<String> getNamesOfDisabledKnownHashSets() {
127  this.upgradeFromOlderVersions();
128  return new ArrayList<>(namesOfDisabledKnownHashSets);
129  }
130 
136  List<String> getNamesOfEnabledKnownBadHashSets() {
137  this.upgradeFromOlderVersions();
138  return new ArrayList<>(this.namesOfEnabledKnownBadHashSets);
139  }
140 
146  List<String> getNamesOfDisabledKnownBadHashSets() {
147  this.upgradeFromOlderVersions();
148  return new ArrayList<>(this.namesOfDisabledKnownBadHashSets);
149  }
150 
155  private void upgradeFromOlderVersions() {
156  if (null == this.namesOfDisabledKnownHashSets) {
157  this.namesOfDisabledKnownHashSets = new HashSet<>();
158  }
159  if (null == this.namesOfDisabledKnownBadHashSets) {
160  this.namesOfDisabledKnownBadHashSets = new HashSet<>();
161  }
162  }
163 
164 }

Copyright © 2012-2016 Basis Technology. Generated on: Mon Apr 24 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.