Autopsy  4.19.2
Graphical digital forensics platform for The Sleuth Kit and other tools.
ExtractIE.java
Go to the documentation of this file.
1 /*
2  *
3  * Autopsy Forensic Browser
4  *
5  * Copyright 2012-2021 Basis Technology Corp.
6  *
7  * Copyright 2012 42six Solutions.
8  * Contact: aebadirad <at> 42six <dot> com
9  * Project Contact/Architect: carrier <at> sleuthkit <dot> org
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 package org.sleuthkit.autopsy.recentactivity;
24 
25 import java.io.BufferedReader;
26 import org.openide.util.NbBundle;
29 import java.io.File;
30 import java.io.FileInputStream;
31 import java.io.FileNotFoundException;
32 import java.io.IOException;
33 import java.io.InputStreamReader;
34 import java.nio.file.Paths;
35 import java.text.ParseException;
36 import java.text.SimpleDateFormat;
37 import java.util.ArrayList;
38 import java.util.List;
39 import java.util.logging.Level;
41 import java.util.Collection;
42 import java.util.Scanner;
43 import java.util.stream.Collectors;
44 import org.openide.modules.InstalledFileLocator;
45 import org.openide.util.NbBundle.Messages;
48 import org.sleuthkit.datamodel.BlackboardArtifact;
49 import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
50 import org.sleuthkit.datamodel.BlackboardAttribute;
51 import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
52 import org.sleuthkit.datamodel.Content;
57 import org.sleuthkit.datamodel.AbstractFile;
58 import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY;
59 import org.sleuthkit.datamodel.ReadContentInputStream;
60 import org.sleuthkit.datamodel.TskCoreException;
61 
66 class ExtractIE extends Extract {
67 
68  private static final Logger logger = Logger.getLogger(ExtractIE.class.getName());
69  private String PASCO_LIB_PATH;
70  private final String JAVA_PATH;
71  private static final String RESOURCE_URL_PREFIX = "res://";
72  private static final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
73  private Content dataSource;
74  private final IngestJobContext context;
75 
76  @Messages({
77  "Progress_Message_IE_History=IE History",
78  "Progress_Message_IE_Bookmarks=IE Bookmarks",
79  "Progress_Message_IE_Cookies=IE Cookies",
80  "Progress_Message_IE_Downloads=IE Downloads",
81  "Progress_Message_IE_FormHistory=IE Form History",
82  "Progress_Message_IE_AutoFill=IE Auto Fill",
83  "Progress_Message_IE_Logins=IE Logins",})
84 
85  ExtractIE(IngestJobContext context) {
86  super(NbBundle.getMessage(ExtractIE.class, "ExtractIE.moduleName.text"), context);
87  JAVA_PATH = PlatformUtil.getJavaPath();
88  this.context = context;
89  }
90 
91  @Override
92  public void process(Content dataSource, DataSourceIngestModuleProgress progressBar) {
93  String moduleTempDir = RAImageIngestModule.getRATempPath(getCurrentCase(), "IE", context.getJobId());
94  String moduleTempResultsDir = Paths.get(moduleTempDir, "results").toString();
95 
96  this.dataSource = dataSource;
97  dataFound = false;
98 
99  progressBar.progress(Bundle.Progress_Message_IE_Bookmarks());
100  this.getBookmark();
101 
102  if (context.dataSourceIngestIsCancelled()) {
103  return;
104  }
105 
106  progressBar.progress(Bundle.Progress_Message_IE_Cookies());
107  this.getCookie();
108 
109  if (context.dataSourceIngestIsCancelled()) {
110  return;
111  }
112 
113  progressBar.progress(Bundle.Progress_Message_IE_History());
114  this.getHistory(moduleTempDir, moduleTempResultsDir);
115  }
116 
120  private void getBookmark() {
121  org.sleuthkit.autopsy.casemodule.services.FileManager fileManager = currentCase.getServices().getFileManager();
122  List<AbstractFile> favoritesFiles;
123  try {
124  favoritesFiles = fileManager.findFiles(dataSource, "%.url", "Favorites"); //NON-NLS
125  } catch (TskCoreException ex) {
126  logger.log(Level.WARNING, "Error fetching 'url' files for Internet Explorer bookmarks.", ex); //NON-NLS
127  this.addErrorMessage(
128  NbBundle.getMessage(this.getClass(), "ExtractIE.getBookmark.errMsg.errGettingBookmarks",
129  this.getDisplayName()));
130  return;
131  }
132 
133  if (favoritesFiles.isEmpty()) {
134  logger.log(Level.INFO, "Didn't find any IE bookmark files."); //NON-NLS
135  return;
136  }
137 
138  dataFound = true;
139  Collection<BlackboardArtifact> bbartifacts = new ArrayList<>();
140  for (AbstractFile fav : favoritesFiles) {
141  if (fav.getSize() == 0) {
142  continue;
143  }
144 
145  if (context.dataSourceIngestIsCancelled()) {
146  break;
147  }
148 
149  String url = getURLFromIEBookmarkFile(fav);
150 
151  String name = fav.getName();
152  Long datetime = fav.getCrtime();
153  String Tempdate = datetime.toString();
154  datetime = Long.valueOf(Tempdate);
155  String domain = extractDomain(url);
156 
157  Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
158  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
159  RecentActivityExtracterModuleFactory.getModuleName(), url));
160  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE,
161  RecentActivityExtracterModuleFactory.getModuleName(), name));
162  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
163  RecentActivityExtracterModuleFactory.getModuleName(), datetime));
164  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
165  RecentActivityExtracterModuleFactory.getModuleName(),
166  NbBundle.getMessage(this.getClass(), "ExtractIE.moduleName.text")));
167  if (domain != null && domain.isEmpty() == false) {
168  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
169  RecentActivityExtracterModuleFactory.getModuleName(), domain));
170  }
171 
172  try {
173  bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_BOOKMARK, fav, bbattributes));
174  } catch (TskCoreException ex) {
175  logger.log(Level.SEVERE, String.format("Failed to create %s for file %d", ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getDisplayName(), fav.getId()), ex);
176  }
177  }
178 
179  if (!context.dataSourceIngestIsCancelled()) {
180  postArtifacts(bbartifacts);
181  }
182  }
183 
184  private String getURLFromIEBookmarkFile(AbstractFile fav) {
185  BufferedReader reader = new BufferedReader(new InputStreamReader(new ReadContentInputStream(fav)));
186  String line, url = "";
187  try {
188  line = reader.readLine();
189  while (null != line) {
190  // The actual shortcut line we are interested in is of the
191  // form URL=http://path/to/website
192  if (line.startsWith("URL")) { //NON-NLS
193  url = line.substring(line.indexOf("=") + 1);
194  break;
195  }
196  line = reader.readLine();
197  }
198  } catch (IOException ex) {
199  logger.log(Level.WARNING, "Failed to read from content: " + fav.getName(), ex); //NON-NLS
200  this.addErrorMessage(
201  NbBundle.getMessage(this.getClass(), "ExtractIE.getURLFromIEBmkFile.errMsg", this.getDisplayName(),
202  fav.getName()));
203  } catch (IndexOutOfBoundsException ex) {
204  logger.log(Level.WARNING, "Failed while getting URL of IE bookmark. Unexpected format of the bookmark file: " + fav.getName(), ex); //NON-NLS
205  this.addErrorMessage(
206  NbBundle.getMessage(this.getClass(), "ExtractIE.getURLFromIEBmkFile.errMsg2", this.getDisplayName(),
207  fav.getName()));
208  } finally {
209  try {
210  reader.close();
211  } catch (IOException ex) {
212  logger.log(Level.WARNING, "Failed to close reader.", ex); //NON-NLS
213  }
214  }
215 
216  return url;
217  }
218 
222  private void getCookie() {
223  org.sleuthkit.autopsy.casemodule.services.FileManager fileManager = currentCase.getServices().getFileManager();
224  List<AbstractFile> cookiesFiles;
225  try {
226  cookiesFiles = fileManager.findFiles(dataSource, "%.txt", "Cookies"); //NON-NLS
227  } catch (TskCoreException ex) {
228  logger.log(Level.WARNING, "Error getting cookie files for IE"); //NON-NLS
229  this.addErrorMessage(
230  NbBundle.getMessage(this.getClass(), "ExtractIE.getCookie.errMsg.errGettingFile", this.getDisplayName()));
231  return;
232  }
233 
234  if (cookiesFiles.isEmpty()) {
235  logger.log(Level.INFO, "Didn't find any IE cookies files."); //NON-NLS
236  return;
237  }
238 
239  dataFound = true;
240  Collection<BlackboardArtifact> bbartifacts = new ArrayList<>();
241  for (AbstractFile cookiesFile : cookiesFiles) {
242  if (context.dataSourceIngestIsCancelled()) {
243  break;
244  }
245  if (cookiesFile.getSize() == 0) {
246  continue;
247  }
248 
249  byte[] t = new byte[(int) cookiesFile.getSize()];
250  try {
251  final int bytesRead = cookiesFile.read(t, 0, cookiesFile.getSize());
252  } catch (TskCoreException ex) {
253  logger.log(Level.WARNING, "Error reading bytes of Internet Explorer cookie.", ex); //NON-NLS
254  this.addErrorMessage(
255  NbBundle.getMessage(this.getClass(), "ExtractIE.getCookie.errMsg.errReadingIECookie",
256  this.getDisplayName(), cookiesFile.getName()));
257  continue;
258  }
259  String cookieString = new String(t);
260  String[] values = cookieString.split("\n");
261  String url = values.length > 2 ? values[2] : "";
262  String value = values.length > 1 ? values[1] : "";
263  String name = values.length > 0 ? values[0] : "";
264  Long datetime = cookiesFile.getCrtime();
265  String tempDate = datetime.toString();
266  datetime = Long.valueOf(tempDate);
267  String domain = extractDomain(url);
268 
269  Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
270  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
271  RecentActivityExtracterModuleFactory.getModuleName(), url));
272  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
273  RecentActivityExtracterModuleFactory.getModuleName(), datetime));
274  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME,
275  RecentActivityExtracterModuleFactory.getModuleName(), (name != null) ? name : ""));
276  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_VALUE,
277  RecentActivityExtracterModuleFactory.getModuleName(), value));
278  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
279  RecentActivityExtracterModuleFactory.getModuleName(),
280  NbBundle.getMessage(this.getClass(), "ExtractIE.moduleName.text")));
281  if (domain != null && domain.isEmpty() == false) {
282  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
283  RecentActivityExtracterModuleFactory.getModuleName(), domain));
284  }
285 
286  try {
287  bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_COOKIE, cookiesFile, bbattributes));
288  } catch (TskCoreException ex) {
289  logger.log(Level.SEVERE, String.format("Failed to create %s for file %d", BlackboardArtifact.Type.TSK_WEB_COOKIE.getDisplayName(), cookiesFile.getId()), ex);
290  }
291  }
292 
293  if (!context.dataSourceIngestIsCancelled()) {
294  postArtifacts(bbartifacts);
295  }
296  }
297 
305  private void getHistory(String moduleTempDir, String moduleTempResultsDir) {
306  logger.log(Level.INFO, "Pasco results path: {0}", moduleTempResultsDir); //NON-NLS
307  boolean foundHistory = false;
308 
309  final File pascoRoot = InstalledFileLocator.getDefault().locate("pasco2", ExtractIE.class.getPackage().getName(), false); //NON-NLS
310  if (pascoRoot == null) {
311  this.addErrorMessage(
312  NbBundle.getMessage(this.getClass(), "ExtractIE.getHistory.errMsg.unableToGetHist", this.getDisplayName()));
313  logger.log(Level.SEVERE, "Error finding pasco program "); //NON-NLS
314  return;
315  }
316 
317  final String pascoHome = pascoRoot.getAbsolutePath();
318  logger.log(Level.INFO, "Pasco2 home: {0}", pascoHome); //NON-NLS
319 
320  PASCO_LIB_PATH = pascoHome + File.separator + "pasco2.jar" + File.pathSeparator //NON-NLS
321  + pascoHome + File.separator + "*";
322 
323  File resultsDir = new File(moduleTempResultsDir);
324  resultsDir.mkdirs();
325 
326  // get index.dat files
327  FileManager fileManager = currentCase.getServices().getFileManager();
328  List<AbstractFile> indexFiles;
329  try {
330  indexFiles = fileManager.findFiles(dataSource, "index.dat"); //NON-NLS
331  } catch (TskCoreException ex) {
332  this.addErrorMessage(NbBundle.getMessage(this.getClass(), "ExtractIE.getHistory.errMsg.errGettingHistFiles",
333  this.getDisplayName()));
334  logger.log(Level.WARNING, "Error fetching 'index.data' files for Internet Explorer history."); //NON-NLS
335  return;
336  }
337 
338  if (indexFiles.isEmpty()) {
339  String msg = NbBundle.getMessage(this.getClass(), "ExtractIE.getHistory.errMsg.noHistFiles");
340  logger.log(Level.INFO, msg);
341  return;
342  }
343 
344  dataFound = true;
345  Collection<BlackboardArtifact> bbartifacts = new ArrayList<>();
346  String temps;
347  String indexFileName;
348  for (AbstractFile indexFile : indexFiles) {
349  // Since each result represent an index.dat file,
350  // just create these files with the following notation:
351  // index<Number>.dat (i.e. index0.dat, index1.dat,..., indexN.dat)
352  // where <Number> is the obj_id of the file.
353  // Write each index.dat file to a temp directory.
354  //BlackboardArtifact bbart = fsc.newArtifact(ARTIFACT_TYPE.TSK_WEB_HISTORY);
355  indexFileName = "index" + Integer.toString((int) indexFile.getId()) + ".dat"; //NON-NLS
356  //indexFileName = "index" + Long.toString(bbart.getArtifactID()) + ".dat";
357  temps = moduleTempDir + File.separator + indexFileName; //NON-NLS
358  File datFile = new File(temps);
359  if (context.dataSourceIngestIsCancelled()) {
360  break;
361  }
362  try {
363  ContentUtils.writeToFile(indexFile, datFile, context::dataSourceIngestIsCancelled);
364  } catch (IOException e) {
365  logger.log(Level.WARNING, "Error while trying to write index.dat file " + datFile.getAbsolutePath(), e); //NON-NLS
366  this.addErrorMessage(
367  NbBundle.getMessage(this.getClass(), "ExtractIE.getHistory.errMsg.errWriteFile", this.getDisplayName(),
368  datFile.getAbsolutePath()));
369  continue;
370  }
371 
372  String filename = "pasco2Result." + indexFile.getId() + ".txt"; //NON-NLS
373  boolean bPascProcSuccess = executePasco(temps, filename, moduleTempResultsDir);
374  if (context.dataSourceIngestIsCancelled()) {
375  return;
376  }
377 
378  //At this point pasco2 proccessed the index files.
379  //Now fetch the results, parse them and the delete the files.
380  if (bPascProcSuccess) {
381  // Don't add TSK_OS_ACCOUNT artifacts to the ModuleDataEvent
382  bbartifacts.addAll(parsePascoOutput(indexFile, filename, moduleTempResultsDir).stream()
383  .filter(bbart -> bbart.getArtifactTypeID() == ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID())
384  .collect(Collectors.toList()));
385  if (context.dataSourceIngestIsCancelled()) {
386  return;
387  }
388  foundHistory = true;
389 
390  //Delete index<n>.dat file since it was succcessfully by Pasco
391  datFile.delete();
392  } else {
393  logger.log(Level.WARNING, "pasco execution failed on: {0}", filename); //NON-NLS
394  this.addErrorMessage(
395  NbBundle.getMessage(this.getClass(), "ExtractIE.getHistory.errMsg.errProcHist", this.getDisplayName()));
396  }
397  }
398 
399  if (!context.dataSourceIngestIsCancelled()) {
400  postArtifacts(bbartifacts);
401  }
402  }
403 
413  @Messages({
414  "# {0} - sub module name",
415  "ExtractIE_executePasco_errMsg_errorRunningPasco={0}: Error analyzing Internet Explorer web history",})
416  private boolean executePasco(String indexFilePath, String outputFileName, String moduleTempResultsDir) {
417  boolean success = true;
418  try {
419  final String outputFileFullPath = moduleTempResultsDir + File.separator + outputFileName;
420  final String errFileFullPath = moduleTempResultsDir + File.separator + outputFileName + ".err"; //NON-NLS
421  logger.log(Level.INFO, "Writing pasco results to: {0}", outputFileFullPath); //NON-NLS
422  List<String> commandLine = new ArrayList<>();
423  commandLine.add(JAVA_PATH);
424  commandLine.add("-cp"); //NON-NLS
425  commandLine.add(PASCO_LIB_PATH);
426  commandLine.add("isi.pasco2.Main"); //NON-NLS
427  commandLine.add("-T"); //NON-NLS
428  commandLine.add("history"); //NON-NLS
429  commandLine.add(indexFilePath);
430  ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
431  processBuilder.redirectOutput(new File(outputFileFullPath));
432  processBuilder.redirectError(new File(errFileFullPath));
433  /*
434  * NOTE on Pasco return codes: There is no documentation for Pasco.
435  * Looking at the Pasco source code I see that when something goes
436  * wrong Pasco returns a negative number as a return code. However,
437  * we should still attempt to parse the Pasco output even if that
438  * happens. I have seen many situations where Pasco output file
439  * contains a lot of useful data and only the last entry is
440  * corrupted.
441  */
442  ExecUtil.execute(processBuilder, new DataSourceIngestModuleProcessTerminator(context, true));
443  // @@@ Investigate use of history versus cache as type.
444  } catch (IOException ex) {
445  logger.log(Level.SEVERE, "Error executing Pasco to process Internet Explorer web history", ex); //NON-NLS
446  addErrorMessage(Bundle.ExtractIE_executePasco_errMsg_errorRunningPasco(getDisplayName()));
447  success = false;
448  }
449  return success;
450  }
451 
462  private Collection<BlackboardArtifact> parsePascoOutput(AbstractFile origFile, String pascoOutputFileName, String moduleTempResultsDir) {
463 
464  Collection<BlackboardArtifact> bbartifacts = new ArrayList<>();
465  String fnAbs = moduleTempResultsDir + File.separator + pascoOutputFileName;
466 
467  File file = new File(fnAbs);
468  if (file.exists() == false) {
469  this.addErrorMessage(
470  NbBundle.getMessage(this.getClass(), "ExtractIE.parsePascoOutput.errMsg.notFound", this.getDisplayName(),
471  file.getName()));
472  logger.log(Level.WARNING, "Pasco Output not found: {0}", file.getPath()); //NON-NLS
473  return bbartifacts;
474  }
475 
476  // Make sure the file the is not empty or the Scanner will
477  // throw a "No Line found" Exception
478  if (file.length() == 0) {
479  return bbartifacts;
480  }
481 
482  Scanner fileScanner;
483  try {
484  fileScanner = new Scanner(new FileInputStream(file.toString()));
485  } catch (FileNotFoundException ex) {
486  this.addErrorMessage(
487  NbBundle.getMessage(this.getClass(), "ExtractIE.parsePascoOutput.errMsg.errParsing", this.getDisplayName(),
488  file.getName()));
489  logger.log(Level.WARNING, "Unable to find the Pasco file at " + file.getPath(), ex); //NON-NLS
490  return bbartifacts;
491  }
492  while (fileScanner.hasNext()) {
493 
494  if (context.dataSourceIngestIsCancelled()) {
495  return bbartifacts;
496  }
497 
498  String line = fileScanner.nextLine();
499  if (!line.startsWith("URL")) { //NON-NLS
500  continue;
501  }
502 
503  String[] lineBuff = line.split("\\t"); //NON-NLS
504 
505  if (lineBuff.length < 4) {
506  logger.log(Level.INFO, "Found unrecognized IE history format."); //NON-NLS
507  continue;
508  }
509 
510  String actime = lineBuff[3];
511  Long ftime = (long) 0;
512  String user = "";
513  String realurl = null;
514  String domain;
515 
516  /*
517  * We've seen two types of lines: URL http://XYZ.com .... URL
518  * Visited: Joe@http://XYZ.com ....
519  */
520  if (lineBuff[1].contains("@")) {
521  String url[] = lineBuff[1].split("@", 2);
522 
523  /*
524  * Verify the left portion of the URL is valid.
525  */
526  domain = extractDomain(url[0]);
527 
528  if (domain != null && domain.isEmpty() == false) {
529  /*
530  * Use the entire input for the URL.
531  */
532  realurl = lineBuff[1].trim();
533  } else {
534  /*
535  * Use the left portion of the input for the user, and the
536  * right portion for the host.
537  */
538  user = url[0];
539  user = user.replace("Visited:", ""); //NON-NLS
540  user = user.replace(":Host:", ""); //NON-NLS
541  user = user.replaceAll("(:)(.*?)(:)", "");
542  user = user.trim();
543  realurl = url[1];
544  realurl = realurl.replace("Visited:", ""); //NON-NLS
545  realurl = realurl.replaceAll(":(.*?):", "");
546  realurl = realurl.replace(":Host:", ""); //NON-NLS
547  realurl = realurl.trim();
548  domain = extractDomain(realurl);
549  }
550  } else {
551  /*
552  * Use the entire input for the URL.
553  */
554  realurl = lineBuff[1].trim();
555  domain = extractDomain(realurl);
556  }
557 
558  if (!actime.isEmpty()) {
559  try {
560  Long epochtime = dateFormatter.parse(actime).getTime();
561  ftime = epochtime / 1000;
562  } catch (ParseException e) {
563  this.addErrorMessage(
564  NbBundle.getMessage(this.getClass(), "ExtractIE.parsePascoOutput.errMsg.errParsingEntry",
565  this.getDisplayName()));
566  logger.log(Level.WARNING, String.format("Error parsing Pasco results, may have partial processing of corrupt file (id=%d)", origFile.getId()), e); //NON-NLS
567  }
568  }
569 
570  Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
571  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
572  RecentActivityExtracterModuleFactory.getModuleName(), realurl));
573  //bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL_DECODED.getTypeID(), "RecentActivity", EscapeUtil.decodeURL(realurl)));
574 
575  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED,
576  RecentActivityExtracterModuleFactory.getModuleName(), ftime));
577  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REFERRER,
578  RecentActivityExtracterModuleFactory.getModuleName(), ""));
579  // @@@ NOte that other browser modules are adding TITLE in here for the title
580  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
581  RecentActivityExtracterModuleFactory.getModuleName(),
582  NbBundle.getMessage(this.getClass(),
583  "ExtractIE.moduleName.text")));
584  if (domain != null && domain.isEmpty() == false) {
585  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
586  RecentActivityExtracterModuleFactory.getModuleName(), domain));
587  }
588  bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
589  RecentActivityExtracterModuleFactory.getModuleName(), user));
590 
591  try {
592  bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_HISTORY, origFile, bbattributes));
593  } catch (TskCoreException ex) {
594  logger.log(Level.SEVERE, String.format("Failed to create %s for file %d", BlackboardArtifact.Type.TSK_WEB_HISTORY.getDisplayName(), origFile.getId()), ex);
595  }
596  }
597  fileScanner.close();
598  return bbartifacts;
599  }
600 
609  private String extractDomain(String url) {
610  if (url == null || url.isEmpty()) {
611  return url;
612  }
613 
614  if (url.toLowerCase().startsWith(RESOURCE_URL_PREFIX)) {
615  /*
616  * Ignore URLs that begin with the matched text.
617  */
618  return null;
619  }
620 
621  return NetworkUtils.extractDomain(url);
622  }
623 }
List< AbstractFile > findFiles(String fileName)

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