Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
HashLookupModuleFactory.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.List;
23 import org.openide.util.NbBundle;
24 import org.openide.util.lookup.ServiceProvider;
32 
36 @ServiceProvider(service = IngestModuleFactory.class)
38 
39  private HashLookupModuleSettingsPanel moduleSettingsPanel = null;
40 
41  @Override
42  public String getModuleDisplayName() {
43  return getModuleName();
44  }
45 
46  static String getModuleName() {
47  return NbBundle.getMessage(HashLookupModuleFactory.class, "HashDbIngestModule.moduleName");
48  }
49 
50  @Override
51  public String getModuleDescription() {
52  return NbBundle.getMessage(HashLookupModuleFactory.class, "HashDbIngestModule.moduleDescription");
53  }
54 
55  @Override
56  public String getModuleVersionNumber() {
57  return Version.getVersion();
58  }
59 
60  @Override
62  // All available hash sets are enabled and always calculate hashes is true by default.
63  HashDbManager hashDbManager = HashDbManager.getInstance();
64  List<String> knownHashSetNames = getHashSetNames(hashDbManager.getKnownFileHashSets());
65  List<String> knownBadHashSetNames = getHashSetNames(hashDbManager.getKnownBadFileHashSets());
66  return new HashLookupModuleSettings(true, knownHashSetNames, knownBadHashSetNames);
67  }
68 
69  private List<String> getHashSetNames(List<HashDbManager.HashDb> hashDbs) {
70  List<String> hashSetNames = new ArrayList<>();
71  for (HashDbManager.HashDb db : hashDbs) {
72  hashSetNames.add(db.getHashSetName());
73  }
74  return hashSetNames;
75  }
76 
77  @Override
78  public boolean hasIngestJobSettingsPanel() {
79  return true;
80  }
81 
82  @Override
84  if (!(settings instanceof HashLookupModuleSettings)) {
85  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
86  "HashLookupModuleFactory.getIngestJobSettingsPanel.exception.msg"));
87  }
88  if (moduleSettingsPanel == null) {
89  moduleSettingsPanel = new HashLookupModuleSettingsPanel((HashLookupModuleSettings) settings);
90  } else {
91  moduleSettingsPanel.reset((HashLookupModuleSettings) settings);
92  }
93  return moduleSettingsPanel;
94  }
95 
96  @Override
97  public boolean hasGlobalSettingsPanel() {
98  return true;
99  }
100 
101  @Override
103  HashLookupSettingsPanel globalSettingsPanel = new HashLookupSettingsPanel();
104  globalSettingsPanel.load();
105  return globalSettingsPanel;
106  }
107 
108  @Override
109  public boolean isFileIngestModuleFactory() {
110  return true;
111  }
112 
113  @Override
115  if (!(settings instanceof HashLookupModuleSettings)) {
116  throw new IllegalArgumentException(
117  NbBundle.getMessage(this.getClass(), "HashLookupModuleFactory.createFileIngestModule.exception.msg"));
118  }
119  return new HashDbIngestModule((HashLookupModuleSettings) settings);
120  }
121 }
List< String > getHashSetNames(List< HashDbManager.HashDb > hashDbs)
IngestModuleIngestJobSettingsPanel getIngestJobSettingsPanel(IngestModuleIngestJobSettings settings)
FileIngestModule createFileIngestModule(IngestModuleIngestJobSettings settings)

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