23 package org.sleuthkit.autopsy.recentactivity;
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.logging.Level;
29 import org.openide.util.NbBundle;
31 import java.util.Collection;
50 class RecentDocumentsByLnk
extends Extract {
51 private static final Logger logger = Logger.getLogger(RecentDocumentsByLnk.class.getName());
52 private IngestServices services = IngestServices.getInstance();
54 private IngestJobContext context;
61 private void getRecentDocuments() {
64 List<AbstractFile> recentFiles;
66 recentFiles = fileManager.
findFiles(dataSource,
"%.lnk",
"Recent");
68 logger.log(Level.WARNING,
"Error searching for .lnk files.");
70 NbBundle.getMessage(
this.getClass(),
"RecentDocumentsByLnk.getRecDoc.errMsg.errGetLnkFiles",
75 if (recentFiles.isEmpty()) {
76 logger.log(Level.INFO,
"Didn't find any recent files.");
82 if (context.dataSourceIngestIsCancelled()) {
86 if (recentFile.getSize() == 0) {
92 lnk = lnkParser.parse();
93 }
catch (JLnkParserException e) {
97 if (unalloc ==
false) {
98 logger.log(Level.SEVERE,
"Error lnk parsing the file to get recent files" + recentFile, e);
100 NbBundle.getMessage(
this.getClass(),
"RecentDocumentsByLnk.getRecDoc.errParsingFile",
101 this.getName(), recentFile.getName()));
106 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
107 String path = lnk.getBestPath();
109 NbBundle.getMessage(this.getClass(),
110 "RecentDocumentsByLnk.parentModuleName.noSpace"),
113 NbBundle.getMessage(this.getClass(),
114 "RecentDocumentsByLnk.parentModuleName.noSpace"),
115 Util.findID(dataSource, path)));
117 NbBundle.getMessage(this.getClass(),
118 "RecentDocumentsByLnk.parentModuleName.noSpace"),
119 recentFile.getCrtime()));
120 this.addArtifact(ARTIFACT_TYPE.TSK_RECENT_OBJECT, recentFile, bbattributes);
122 services.fireModuleDataEvent(
new ModuleDataEvent(
123 NbBundle.getMessage(
this.getClass(),
"RecentDocumentsByLnk.parentModuleName"),
128 public void process(
Content dataSource, IngestJobContext context) {
129 this.dataSource = dataSource;
130 this.context = context;
132 this.getRecentDocuments();
synchronized List< AbstractFile > findFiles(Content dataSource, String fileName)