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;
46 HashLookupModuleSettings(
boolean shouldCalculateHashes,
47 List<String> namesOfEnabledKnownHashSets,
48 List<String> namesOfEnabledKnownBadHashSets) {
49 this(shouldCalculateHashes, namesOfEnabledKnownHashSets, namesOfEnabledKnownBadHashSets,
new ArrayList<>(),
new ArrayList<>());
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);
79 public long getVersionNumber() {
80 this.upgradeFromOlderVersions();
81 return HashLookupModuleSettings.serialVersionUID;
90 boolean shouldCalculateHashes() {
91 this.upgradeFromOlderVersions();
92 return this.shouldCalculateHashes;
102 boolean isHashSetEnabled(String hashSetName) {
103 this.upgradeFromOlderVersions();
104 return !(this.namesOfDisabledKnownHashSets.contains(hashSetName) || this.namesOfDisabledKnownBadHashSets.contains(hashSetName));
112 List<String> getNamesOfEnabledKnownHashSets() {
113 this.upgradeFromOlderVersions();
114 return new ArrayList<>(this.namesOfEnabledKnownHashSets);
122 List<String> getNamesOfDisabledKnownHashSets() {
123 this.upgradeFromOlderVersions();
124 return new ArrayList<>(namesOfDisabledKnownHashSets);
132 List<String> getNamesOfEnabledKnownBadHashSets() {
133 this.upgradeFromOlderVersions();
134 return new ArrayList<>(this.namesOfEnabledKnownBadHashSets);
142 List<String> getNamesOfDisabledKnownBadHashSets() {
143 this.upgradeFromOlderVersions();
144 return new ArrayList<>(this.namesOfDisabledKnownBadHashSets);
151 private void upgradeFromOlderVersions() {
152 if (null == this.namesOfDisabledKnownHashSets) {
153 this.namesOfDisabledKnownHashSets =
new HashSet<>();
155 if (null == this.namesOfDisabledKnownBadHashSets) {
156 this.namesOfDisabledKnownBadHashSets =
new HashSet<>();