23 package org.sleuthkit.autopsy.recentactivity;
26 import java.nio.file.Path;
27 import java.nio.file.Paths;
28 import java.util.ArrayList;
29 import java.util.List;
30 import java.util.logging.Level;
31 import org.openide.util.NbBundle;
54 private final List<Extract>
extractors =
new ArrayList<>();
71 Extract iexplore =
new ExtractIE();
72 Extract edge =
new ExtractEdge();
73 Extract registry =
new ExtractRegistry();
74 Extract recentDocuments =
new RecentDocumentsByLnk();
75 Extract chrome =
new Chromium();
76 Extract firefox =
new Firefox();
77 Extract SEUQA =
new SearchEngineURLQueryAnalyzer();
78 Extract osExtract =
new ExtractOs();
79 Extract dataSourceAnalyzer =
new DataSourceUsageAnalyzer();
80 Extract safari =
new ExtractSafari();
81 Extract zoneInfo =
new ExtractZoneIdentifier();
82 Extract recycleBin =
new ExtractRecycleBin();
83 Extract sru =
new ExtractSru();
84 Extract prefetch =
new ExtractPrefetch();
85 Extract webAccountType =
new ExtractWebAccountType();
86 Extract messageDomainType =
new DomainCategoryRunner();
88 extractors.add(recentDocuments);
89 extractors.add(registry);
90 extractors.add(osExtract);
91 extractors.add(dataSourceAnalyzer);
92 extractors.add(chrome);
93 extractors.add(firefox);
94 extractors.add(iexplore);
96 extractors.add(safari);
97 extractors.add(SEUQA);
98 extractors.add(webAccountType);
99 extractors.add(zoneInfo);
100 extractors.add(recycleBin);
102 extractors.add(prefetch);
103 extractors.add(messageDomainType);
105 browserExtractors.add(chrome);
106 browserExtractors.add(firefox);
107 browserExtractors.add(iexplore);
108 browserExtractors.add(edge);
109 browserExtractors.add(safari);
111 for (Extract extractor : extractors) {
119 NbBundle.getMessage(this.getClass(),
120 "RAImageIngestModule.process.started",
121 dataSource.getName())));
125 ArrayList<String> errors =
new ArrayList<>();
127 for (
int i = 0; i < extractors.size(); i++) {
128 Extract extracter = extractors.get(i);
130 logger.log(Level.INFO,
"Recent Activity has been canceled, quitting before {0}", extracter.getName());
134 progressBar.
progress(extracter.getName(), i);
137 extracter.process(dataSource, context, progressBar, accountCache);
138 if (extracter instanceof ExtractRegistry) {
139 accountCache.initialize(tskCase, ((DataSource) dataSource).getHost());
141 }
catch (Exception ex) {
142 logger.log(Level.SEVERE,
"Exception occurred in " + extracter.getName(), ex);
143 subCompleted.append(NbBundle.getMessage(
this.getClass(),
"RAImageIngestModule.process.errModFailed",
144 extracter.getName()));
149 errors.addAll(extracter.getErrorMessages());
153 StringBuilder errorMessage =
new StringBuilder();
154 String errorMsgSubject;
156 if (errors.isEmpty() ==
false) {
159 NbBundle.getMessage(
this.getClass(),
"RAImageIngestModule.process.errMsg.errsEncountered"));
160 for (String msg : errors) {
161 errorMessage.append(
"<li>").append(msg).append(
"</li>\n");
163 errorMessage.append(
"</ul>\n");
165 if (errors.size() == 1) {
166 errorMsgSubject = NbBundle.getMessage(this.getClass(),
"RAImageIngestModule.process.errMsgSub.oneErr");
168 errorMsgSubject = NbBundle.getMessage(this.getClass(),
169 "RAImageIngestModule.process.errMsgSub.nErrs", errors.size());
172 errorMessage.append(NbBundle.getMessage(
this.getClass(),
"RAImageIngestModule.process.errMsg.noErrs"));
173 errorMsgSubject = NbBundle.getMessage(this.getClass(),
"RAImageIngestModule.process.errMsgSub.noErrs");
176 NbBundle.getMessage(this.getClass(),
177 "RAImageIngestModule.process.ingestMsg.finished",
178 dataSource.getName(), errorMsgSubject),
179 errorMessage.toString());
182 StringBuilder historyMsg =
new StringBuilder();
184 NbBundle.getMessage(
this.getClass(),
"RAImageIngestModule.process.histMsg.title", dataSource.getName()));
185 for (Extract module : browserExtractors) {
186 historyMsg.append(
"<li>").append(module.getName());
187 historyMsg.append(
": ").append((module.foundData()) ? NbBundle
188 .getMessage(this.getClass(),
"RAImageIngestModule.process.histMsg.found") : NbBundle
189 .getMessage(this.getClass(),
"RAImageIngestModule.process.histMsg.notFnd"));
190 historyMsg.append(
"</li>");
192 historyMsg.append(
"</ul>");
194 NbBundle.getMessage(this.getClass(),
195 "RAImageIngestModule.process.ingestMsg.results",
196 dataSource.getName()),
197 historyMsg.toString());
204 for (
int i = 0; i < extractors.size(); i++) {
205 Extract extracter = extractors.get(i);
207 extracter.complete();
208 }
catch (Exception ex) {
209 logger.log(Level.SEVERE,
"Exception occurred when completing " + extracter.getName(), ex);
210 subCompleted.append(NbBundle.getMessage(
this.getClass(),
"RAImageIngestModule.complete.errMsg.failed",
211 extracter.getName()));
230 String moduleFolder = String.format(
"%s_%d", module, ingestJobId);
231 Path tmpPath = Paths.get(basePath, RECENT_ACTIVITY_FOLDER, moduleFolder);
232 File dir = tmpPath.toFile();
233 if (dir.exists() ==
false) {
236 return tmpPath.toString();
249 static String getRATempPath(
Case a_case, String mod,
long ingestJobId) {
263 static String getRAOutputPath(Case a_case, String mod,
long ingestJobId) {
273 static String getRelModuleOutputPath(Case autCase, String mod,
long ingestJobId) {
274 return Paths.get(
getAndMakeRAPath(autCase.getModuleOutputDirectoryRelativePath(), mod, ingestJobId))
final List< Extract > extractors
static final Logger logger
String getTempDirectory()
RAOsAccountCache accountCache
final StringBuilder subCompleted
static IngestMessage createMessage(MessageType messageType, String source, String subject, String detailsHtml)
ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar)
static final String RECENT_ACTIVITY_FOLDER
void postMessage(final IngestMessage message)
SleuthkitCase getSleuthkitCase()
void startUp(IngestJobContext context)
boolean dataSourceIngestIsCancelled()
final List< Extract > browserExtractors
void switchToDeterminate(int workUnits)
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static String getAndMakeRAPath(String basePath, String module, long ingestJobId)
void progress(int workUnits)
final IngestServices services
static synchronized IngestServices getInstance()