19 package org.sleuthkit.autopsy.modules.hashdatabase;
21 import java.util.ArrayList;
22 import java.util.HashSet;
23 import java.util.List;
29 final class HashLookupModuleSettings
implements IngestModuleIngestJobSettings {
31 private static final long serialVersionUID = 1L;
32 private HashSet<String> namesOfEnabledKnownHashSets;
33 private HashSet<String> namesOfDisabledKnownHashSets;
34 private HashSet<String> namesOfEnabledKnownBadHashSets;
35 private HashSet<String> namesOfDisabledKnownBadHashSets;
36 private boolean shouldCalculateHashes =
true;
47 HashLookupModuleSettings(
boolean shouldCalculateHashes,
48 List<String> namesOfEnabledKnownHashSets,
49 List<String> namesOfEnabledKnownBadHashSets) {
50 this(shouldCalculateHashes, namesOfEnabledKnownHashSets, namesOfEnabledKnownBadHashSets,
new ArrayList<>(),
new ArrayList<>());
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);
82 public long getVersionNumber() {
83 this.upgradeFromOlderVersions();
84 return HashLookupModuleSettings.serialVersionUID;
93 boolean shouldCalculateHashes() {
94 this.upgradeFromOlderVersions();
95 return this.shouldCalculateHashes;
106 boolean isHashSetEnabled(String hashSetName) {
107 this.upgradeFromOlderVersions();
108 return !(this.namesOfDisabledKnownHashSets.contains(hashSetName) || this.namesOfDisabledKnownBadHashSets.contains(hashSetName));
116 List<String> getNamesOfEnabledKnownHashSets() {
117 this.upgradeFromOlderVersions();
118 return new ArrayList<>(this.namesOfEnabledKnownHashSets);
126 List<String> getNamesOfDisabledKnownHashSets() {
127 this.upgradeFromOlderVersions();
128 return new ArrayList<>(namesOfDisabledKnownHashSets);
136 List<String> getNamesOfEnabledKnownBadHashSets() {
137 this.upgradeFromOlderVersions();
138 return new ArrayList<>(this.namesOfEnabledKnownBadHashSets);
146 List<String> getNamesOfDisabledKnownBadHashSets() {
147 this.upgradeFromOlderVersions();
148 return new ArrayList<>(this.namesOfDisabledKnownBadHashSets);
155 private void upgradeFromOlderVersions() {
156 if (null == this.namesOfDisabledKnownHashSets) {
157 this.namesOfDisabledKnownHashSets =
new HashSet<>();
159 if (null == this.namesOfDisabledKnownBadHashSets) {
160 this.namesOfDisabledKnownBadHashSets =
new HashSet<>();