Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
KeywordSearchModuleFactory.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014-2021 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.keywordsearch;
20 
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.HashSet;
24 import java.util.List;
25 import org.openide.util.NbBundle;
26 import org.openide.util.lookup.ServiceProvider;
35 
40 @ServiceProvider(service = IngestModuleFactory.class)
42 
43  private static final HashSet<String> defaultDisabledKeywordListNames = new HashSet<>(Arrays.asList("Phone Numbers", "IP Addresses", "URLs", "Credit Card Numbers")); //NON-NLS
44  private KeywordSearchJobSettingsPanel jobSettingsPanel = null;
45 
46  @Override
47  public String getModuleDisplayName() {
48  return getModuleName();
49  }
50 
51  static String getModuleName() {
52  return NbBundle.getMessage(KeywordSearchIngestModule.class, "KeywordSearchIngestModule.moduleName");
53  }
54 
55  @Override
56  public String getModuleDescription() {
57  return NbBundle.getMessage(KeywordSearchIngestModule.class, "KeywordSearchIngestModule.moduleDescription");
58  }
59 
60  @Override
61  public String getModuleVersionNumber() {
62  return Version.getVersion();
63  }
64 
65  @Override
67  XmlKeywordSearchList listManager = XmlKeywordSearchList.getCurrent();
68  List<String> enabledKeywordLists = new ArrayList<>();
69  List<KeywordList> keywordLists = listManager.getListsL();
70  for (KeywordList keywordList : keywordLists) {
71  if (!defaultDisabledKeywordListNames.contains(keywordList.getName())) {
72  enabledKeywordLists.add(keywordList.getName());
73  }
74  }
75  return new KeywordSearchJobSettings(enabledKeywordLists);
76  }
77 
78  @Override
79  public boolean hasIngestJobSettingsPanel() {
80  return true;
81  }
82 
83  @Override
85  assert settings instanceof KeywordSearchJobSettings;
86  if (!(settings instanceof KeywordSearchJobSettings)) {
87  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
88  "KeywordSearchModuleFactory.getIngestJobSettingsPanel.exception.msg"));
89  }
90 
91  if (jobSettingsPanel == null) {
92  jobSettingsPanel = new KeywordSearchJobSettingsPanel((KeywordSearchJobSettings) settings);
93  } else {
94  jobSettingsPanel.reset((KeywordSearchJobSettings) settings);
95  }
96  return jobSettingsPanel;
97  }
98 
99  @Override
100  public boolean hasGlobalSettingsPanel() {
101  return true;
102  }
103 
104  @Override
106  KeywordSearchGlobalSettingsPanel globalSettingsPanel = new KeywordSearchGlobalSettingsPanel();
107  globalSettingsPanel.load();
108  return globalSettingsPanel;
109  }
110 
111  @Override
112  public boolean isFileIngestModuleFactory() {
113  return true;
114  }
115 
116  @Override
118  assert settings instanceof KeywordSearchJobSettings;
119  if (!(settings instanceof KeywordSearchJobSettings)) {
120  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
121  "KeywordSearchModuleFactory.createFileIngestModule.exception.msg"));
122  }
123  return new KeywordSearchIngestModule((KeywordSearchJobSettings) settings);
124  }
125 
126  @Override
128  return true;
129  }
130 
131  @Override
133  if (!(settings instanceof KeywordSearchJobSettings)) {
134  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
135  "KeywordSearchModuleFactory.createFileIngestModule.exception.msg"));
136  }
137 
138  return new KwsDataArtifactIngestModule((KeywordSearchJobSettings) settings);
139  }
140 
141  @Override
143  return true;
144  }
145 
146  @Override
148  if (!(settings instanceof KeywordSearchJobSettings)) {
149  throw new IllegalArgumentException(NbBundle.getMessage(this.getClass(),
150  "KeywordSearchModuleFactory.createFileIngestModule.exception.msg"));
151  }
152 
153  return new KwsAnalysisResultIngestModule((KeywordSearchJobSettings) settings);
154  }
155 
156 }
FileIngestModule createFileIngestModule(IngestModuleIngestJobSettings settings)
AnalysisResultIngestModule createAnalysisResultIngestModule(IngestModuleIngestJobSettings settings)
DataArtifactIngestModule createDataArtifactIngestModule(IngestModuleIngestJobSettings settings)
IngestModuleIngestJobSettingsPanel getIngestJobSettingsPanel(IngestModuleIngestJobSettings settings)

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.