23 package org.sleuthkit.autopsy.recentactivity;
25 import java.io.BufferedReader;
27 import java.io.FileInputStream;
28 import java.io.FileNotFoundException;
29 import java.io.FileReader;
30 import java.io.FileWriter;
31 import java.io.IOException;
32 import java.io.StringReader;
33 import java.text.ParseException;
34 import java.text.SimpleDateFormat;
35 import java.util.logging.Level;
36 import javax.xml.parsers.DocumentBuilder;
37 import javax.xml.parsers.DocumentBuilderFactory;
38 import javax.xml.parsers.ParserConfigurationException;
39 import org.apache.commons.io.FilenameUtils;
40 import org.openide.modules.InstalledFileLocator;
41 import org.openide.util.NbBundle;
49 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
50 import org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
51 import org.w3c.dom.Document;
52 import org.w3c.dom.Element;
53 import org.w3c.dom.Node;
54 import org.w3c.dom.NodeList;
55 import org.xml.sax.InputSource;
56 import org.xml.sax.SAXException;
57 import java.nio.file.Path;
58 import java.util.AbstractMap;
59 import java.util.ArrayList;
60 import java.util.Arrays;
61 import java.util.List;
62 import java.util.Collection;
63 import java.util.Date;
64 import java.util.HashMap;
66 import java.util.Scanner;
68 import java.util.HashSet;
69 import static java.util.Locale.US;
70 import static java.util.TimeZone.getTimeZone;
71 import org.openide.util.Lookup;
80 import org.
sleuthkit.datamodel.Blackboard.BlackboardException;
82 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
83 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_ACCOUNT;
85 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT;
86 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT;
87 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME;
88 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED;
89 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED;
90 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_MODIFIED;
91 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_ID;
92 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME;
93 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH;
94 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_USER_ID;
95 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_USER_NAME;
97 import org.
sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException;
108 "RegRipperNotFound=Autopsy RegRipper executable not found.",
109 "RegRipperFullNotFound=Full version RegRipper executable not found.",
110 "Progress_Message_Analyze_Registry=Analyzing Registry Files",
111 "Shellbag_Artifact_Display_Name=Shell Bags",
112 "Shellbag_Key_Attribute_Display_Name=Key",
113 "Shellbag_Last_Write_Attribute_Display_Name=Last Write",
114 "Recently_Used_Artifacts_Office_Trustrecords=Stored in TrustRecords because Office security exception was granted",
115 "Recently_Used_Artifacts_ArcHistory=Recently opened by 7Zip",
116 "Recently_Used_Artifacts_Applets=Recently opened according to Applets registry key",
117 "Recently_Used_Artifacts_Mmc=Recently opened according to Windows Management Console MRU",
118 "Recently_Used_Artifacts_Winrar=Recently opened according to WinRAR MRU",
119 "Recently_Used_Artifacts_Officedocs=Recently opened according to Office MRU",
120 "Recently_Used_Artifacts_Adobe=Recently opened according to Adobe MRU",
121 "Recently_Used_Artifacts_Mediaplayer=Recently opened according to Media Player MRU",
122 "Registry_System_Bam=Recently Executed according to Background Activity Moderator (BAM)"
124 class ExtractRegistry extends Extract {
126 private static final String USERNAME_KEY =
"Username";
127 private static final String SID_KEY =
"SID";
128 private static final String RID_KEY =
"RID";
129 private static final String ACCOUNT_CREATED_KEY =
"Account Created";
130 private static final String LAST_LOGIN_KEY =
"Last Login Date";
131 private static final String LOGIN_COUNT_KEY =
"Login Count";
132 private static final String FULL_NAME_KEY =
"Full Name";
133 private static final String USER_COMMENT_KEY =
"User Comment";
134 private static final String ACCOUNT_TYPE_KEY =
"Account Type";
135 private static final String NAME_KEY =
"Name";
136 private static final String PWD_RESET_KEY =
"Pwd Rest Date";
137 private static final String PWD_FAILE_KEY =
"Pwd Fail Date";
138 private static final String INTERNET_NAME_KEY =
"InternetName";
139 private static final String PWD_DOES_NOT_EXPIRE_KEY =
"Password does not expire";
140 private static final String ACCOUNT_DISABLED_KEY =
"Account Disabled";
141 private static final String PWD_NOT_REQUIRED_KEY =
"Password not required";
142 private static final String NORMAL_ACCOUNT_KEY =
"Normal user account";
143 private static final String HOME_DIRECTORY_REQUIRED_KEY =
"Home directory required";
144 private static final String TEMPORARY_DUPLICATE_ACCOUNT =
"Temporary duplicate account";
145 private static final String MNS_LOGON_ACCOUNT_KEY =
"MNS logon user account";
146 private static final String INTERDOMAIN_TRUST_ACCOUNT_KEY =
"Interdomain trust account";
147 private static final String WORKSTATION_TRUST_ACCOUNT =
"Workstation trust account";
148 private static final String SERVER_TRUST_ACCOUNT =
"Server trust account";
149 private static final String ACCOUNT_AUTO_LOCKED =
"Account auto locked";
150 private static final String PASSWORD_HINT =
"Password Hint";
152 private static final String[] PASSWORD_SETTINGS_FLAGS = {PWD_DOES_NOT_EXPIRE_KEY, PWD_NOT_REQUIRED_KEY};
153 private static final String[] ACCOUNT_SETTINGS_FLAGS = {ACCOUNT_AUTO_LOCKED, HOME_DIRECTORY_REQUIRED_KEY, ACCOUNT_DISABLED_KEY};
154 private static final String[] ACCOUNT_TYPE_FLAGS = {NORMAL_ACCOUNT_KEY, SERVER_TRUST_ACCOUNT, WORKSTATION_TRUST_ACCOUNT, INTERDOMAIN_TRUST_ACCOUNT_KEY, MNS_LOGON_ACCOUNT_KEY, TEMPORARY_DUPLICATE_ACCOUNT};
156 final private static UsbDeviceIdMapper USB_MAPPER =
new UsbDeviceIdMapper();
157 final private static String RIP_EXE =
"rip.exe";
158 final private static String RIP_PL =
"rip.pl";
159 final private static String RIP_PL_INCLUDE_FLAG =
"-I";
160 final private static int MS_IN_SEC = 1000;
161 final private static String NEVER_DATE =
"Never";
162 final private static String SECTION_DIVIDER =
"-------------------------";
163 final private static Logger logger = Logger.getLogger(ExtractRegistry.class.getName());
164 private final List<String> rrCmd =
new ArrayList<>();
165 private final List<String> rrFullCmd =
new ArrayList<>();
166 private final Path rrHome;
167 private final Path rrFullHome;
168 private Content dataSource;
169 private IngestJobContext context;
170 private Map<String, String> userNameMap;
172 private static final String SHELLBAG_ARTIFACT_NAME =
"RA_SHELL_BAG";
173 private static final String SHELLBAG_ATTRIBUTE_LAST_WRITE =
"RA_SHELL_BAG_LAST_WRITE";
174 private static final String SHELLBAG_ATTRIBUTE_KEY =
"RA_SHELL_BAG_KEY";
176 BlackboardArtifact.Type shellBagArtifactType = null;
177 BlackboardAttribute.Type shellBagKeyAttributeType = null;
178 BlackboardAttribute.Type shellBagLastWriteAttributeType = null;
180 ExtractRegistry() throws IngestModuleException {
181 moduleName = NbBundle.getMessage(ExtractIE.class,
"ExtractRegistry.moduleName.text");
183 final File rrRoot = InstalledFileLocator.getDefault().locate(
"rr", ExtractRegistry.class.getPackage().getName(),
false);
184 if (rrRoot == null) {
185 throw new IngestModuleException(Bundle.RegRipperNotFound());
188 final File rrFullRoot = InstalledFileLocator.getDefault().locate(
"rr-full", ExtractRegistry.class.getPackage().getName(),
false);
189 if (rrFullRoot == null) {
190 throw new IngestModuleException(Bundle.RegRipperFullNotFound());
193 String executableToRun = RIP_EXE;
194 if (!PlatformUtil.isWindowsOS()) {
195 executableToRun = RIP_PL;
197 rrHome = rrRoot.toPath();
198 String rrPath = rrHome.resolve(executableToRun).toString();
199 rrFullHome = rrFullRoot.toPath();
201 if (!(
new File(rrPath).exists())) {
202 throw new IngestModuleException(Bundle.RegRipperNotFound());
204 String rrFullPath = rrFullHome.resolve(executableToRun).toString();
205 if (!(
new File(rrFullPath).exists())) {
206 throw new IngestModuleException(Bundle.RegRipperFullNotFound());
208 if (PlatformUtil.isWindowsOS()) {
210 rrFullCmd.add(rrFullPath);
213 File usrBin =
new File(
"/usr/bin/perl");
214 File usrLocalBin =
new File(
"/usr/local/bin/perl");
215 if (usrBin.canExecute() && usrBin.exists() && !usrBin.isDirectory()) {
216 perl =
"/usr/bin/perl";
217 }
else if (usrLocalBin.canExecute() && usrLocalBin.exists() && !usrLocalBin.isDirectory()) {
218 perl =
"/usr/local/bin/perl";
220 throw new IngestModuleException(
"perl not found in your system");
223 rrCmd.add(RIP_PL_INCLUDE_FLAG);
224 rrCmd.add(rrHome.toString());
227 rrFullCmd.add(RIP_PL_INCLUDE_FLAG);
228 rrFullCmd.add(rrFullHome.toString());
229 rrFullCmd.add(rrFullPath);
236 private List<AbstractFile> findRegistryFiles() {
237 List<AbstractFile> allRegistryFiles =
new ArrayList<>();
242 allRegistryFiles.addAll(fileManager.findFiles(dataSource,
"sam",
"/system32/config"));
243 }
catch (TskCoreException ex) {
244 String msg = NbBundle.getMessage(this.getClass(),
245 "ExtractRegistry.findRegFiles.errMsg.errReadingFile",
"sam");
246 logger.log(Level.WARNING, msg, ex);
247 this.addErrorMessage(this.getName() +
": " + msg);
252 allRegistryFiles.addAll(fileManager.findFiles(dataSource,
"ntuser.dat"));
253 }
catch (TskCoreException ex) {
254 logger.log(Level.WARNING,
"Error fetching 'ntuser.dat' file.");
259 allRegistryFiles.addAll(fileManager.findFiles(dataSource,
"usrclass.dat"));
260 }
catch (TskCoreException ex) {
261 logger.log(Level.WARNING, String.format(
"Error finding 'usrclass.dat' files."), ex);
265 String[] regFileNames =
new String[]{
"system",
"software",
"security"};
266 for (String regFileName : regFileNames) {
268 allRegistryFiles.addAll(fileManager.findFiles(dataSource, regFileName,
"/system32/config"));
269 }
catch (TskCoreException ex) {
270 String msg = NbBundle.getMessage(this.getClass(),
271 "ExtractRegistry.findRegFiles.errMsg.errReadingFile", regFileName);
272 logger.log(Level.WARNING, msg, ex);
273 this.addErrorMessage(this.getName() +
": " + msg);
276 return allRegistryFiles;
283 private void analyzeRegistryFiles() {
284 List<AbstractFile> allRegistryFiles = findRegistryFiles();
287 FileWriter logFile = null;
289 logFile =
new FileWriter(RAImageIngestModule.getRAOutputPath(currentCase,
"reg") + File.separator +
"regripper-info.txt");
290 }
catch (IOException ex) {
291 logger.log(Level.SEVERE, null, ex);
294 for (AbstractFile regFile : allRegistryFiles) {
295 String regFileName = regFile.getName();
296 long regFileId = regFile.getId();
297 String regFileNameLocal = RAImageIngestModule.getRATempPath(currentCase,
"reg") + File.separator + regFileName;
298 String outputPathBase = RAImageIngestModule.getRAOutputPath(currentCase,
"reg") + File.separator + regFileName +
"-regripper-" + Long.toString(regFileId);
299 File regFileNameLocalFile =
new File(regFileNameLocal);
301 ContentUtils.writeToFile(regFile, regFileNameLocalFile, context::dataSourceIngestIsCancelled);
302 }
catch (ReadContentInputStreamException ex) {
303 logger.log(Level.WARNING, String.format(
"Error reading registry file '%s' (id=%d).",
304 regFile.getName(), regFileId), ex);
305 this.addErrorMessage(
306 NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.analyzeRegFiles.errMsg.errWritingTemp",
307 this.getName(), regFileName));
309 }
catch (IOException ex) {
310 logger.log(Level.SEVERE, String.format(
"Error writing temp registry file '%s' for registry file '%s' (id=%d).",
311 regFileNameLocal, regFile.getName(), regFileId), ex);
312 this.addErrorMessage(
313 NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.analyzeRegFiles.errMsg.errWritingTemp",
314 this.getName(), regFileName));
318 if (context.dataSourceIngestIsCancelled()) {
323 if (logFile != null) {
324 logFile.write(Long.toString(regFileId) +
"\t" + regFile.getUniquePath() +
"\n");
326 }
catch (TskCoreException | IOException ex) {
327 logger.log(Level.SEVERE, null, ex);
330 logger.log(Level.INFO,
"{0}- Now getting registry information from {1}",
new Object[]{moduleName, regFileNameLocal});
331 RegOutputFiles regOutputFiles = ripRegistryFile(regFileNameLocal, outputPathBase);
332 if (context.dataSourceIngestIsCancelled()) {
337 if (regOutputFiles.autopsyPlugins.isEmpty() ==
false && parseAutopsyPluginOutput(regOutputFiles.autopsyPlugins, regFile) ==
false) {
338 this.addErrorMessage(
339 NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.analyzeRegFiles.failedParsingResults",
340 this.getName(), regFileName));
344 if (!regOutputFiles.fullPlugins.isEmpty()) {
346 if (regFileNameLocal.toLowerCase().contains(
"sam") && parseSamPluginOutput(regOutputFiles.fullPlugins, regFile) ==
false) {
347 this.addErrorMessage(
348 NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.analyzeRegFiles.failedParsingResults",
349 this.getName(), regFileName));
350 }
else if (regFileNameLocal.toLowerCase().contains(
"ntuser") || regFileNameLocal.toLowerCase().contains(
"usrclass")) {
352 List<ShellBag> shellbags = ShellBagParser.parseShellbagOutput(regOutputFiles.fullPlugins);
353 createShellBagArtifacts(regFile, shellbags);
354 createRecentlyUsedArtifacts(regOutputFiles.fullPlugins, regFile);
355 }
catch (IOException | TskCoreException ex) {
356 logger.log(Level.WARNING, String.format(
"Unable to get shell bags from file %s", regOutputFiles.fullPlugins), ex);
358 }
else if (regFileNameLocal.toLowerCase().contains(
"system") && parseSystemPluginOutput(regOutputFiles.fullPlugins, regFile) ==
false) {
359 this.addErrorMessage(
360 NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.analyzeRegFiles.failedParsingResults",
361 this.getName(), regFileName));
364 Report report = currentCase.addReport(regOutputFiles.fullPlugins,
365 NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.parentModuleName.noSpace"),
366 "RegRipper " + regFile.getUniquePath(), regFile);
369 KeywordSearchService searchService = Lookup.getDefault().lookup(KeywordSearchService.class);
370 if (null == searchService) {
371 logger.log(Level.WARNING,
"Keyword search service not found. Report will not be indexed");
373 searchService.index(report);
376 }
catch (TskCoreException e) {
377 this.addErrorMessage(
"Error adding regripper output as Autopsy report: " + e.getLocalizedMessage());
381 regFileNameLocalFile.delete();
385 if (logFile != null) {
388 }
catch (IOException ex) {
389 logger.log(Level.SEVERE, null, ex);
400 private RegOutputFiles ripRegistryFile(String regFilePath, String outFilePathBase) {
401 String autopsyType =
"";
404 RegOutputFiles regOutputFiles =
new RegOutputFiles();
406 if (regFilePath.toLowerCase().contains(
"system")) {
407 autopsyType =
"autopsysystem";
409 }
else if (regFilePath.toLowerCase().contains(
"software")) {
410 autopsyType =
"autopsysoftware";
411 fullType =
"software";
412 }
else if (regFilePath.toLowerCase().contains(
"ntuser")) {
413 autopsyType =
"autopsyntuser";
415 }
else if (regFilePath.toLowerCase().contains(
"sam")) {
418 }
else if (regFilePath.toLowerCase().contains(
"security")) {
419 fullType =
"security";
420 }
else if (regFilePath.toLowerCase().contains(
"usrclass")) {
421 fullType =
"usrclass";
423 return regOutputFiles;
427 if (!autopsyType.isEmpty()) {
428 regOutputFiles.autopsyPlugins = outFilePathBase +
"-autopsy.txt";
429 String errFilePath = outFilePathBase +
"-autopsy.err.txt";
430 logger.log(Level.INFO,
"Writing RegRipper results to: {0}", regOutputFiles.autopsyPlugins);
431 executeRegRipper(rrCmd, rrHome, regFilePath, autopsyType, regOutputFiles.autopsyPlugins, errFilePath);
433 if (context.dataSourceIngestIsCancelled()) {
434 return regOutputFiles;
438 if (!fullType.isEmpty()) {
439 regOutputFiles.fullPlugins = outFilePathBase +
"-full.txt";
440 String errFilePath = outFilePathBase +
"-full.err.txt";
441 logger.log(Level.INFO,
"Writing Full RegRipper results to: {0}", regOutputFiles.fullPlugins);
442 executeRegRipper(rrFullCmd, rrFullHome, regFilePath, fullType, regOutputFiles.fullPlugins, errFilePath);
444 scanErrorLogs(errFilePath);
445 }
catch (IOException ex) {
446 logger.log(Level.SEVERE, String.format(
"Unable to run RegRipper on %s", regFilePath), ex);
447 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.execRegRip.errMsg.failedAnalyzeRegFile", this.getName(), regFilePath));
450 return regOutputFiles;
453 private void scanErrorLogs(String errFilePath)
throws IOException {
454 File regfile =
new File(errFilePath);
455 try (BufferedReader reader =
new BufferedReader(
new FileReader(regfile))) {
456 String line = reader.readLine();
457 while (line != null) {
459 if (line.toLowerCase().contains(
"error") || line.toLowerCase().contains(
"@inc")) {
460 logger.log(Level.WARNING,
"Regripper file {0} contains errors from run", errFilePath);
463 line = reader.readLine();
468 private void executeRegRipper(List<String> regRipperPath, Path regRipperHomeDir, String hiveFilePath, String hiveFileType, String outputFile, String errFile) {
470 List<String> commandLine =
new ArrayList<>();
471 for (String cmd : regRipperPath) {
472 commandLine.add(cmd);
474 commandLine.add(
"-r");
475 commandLine.add(hiveFilePath);
476 commandLine.add(
"-f");
477 commandLine.add(hiveFileType);
479 ProcessBuilder processBuilder =
new ProcessBuilder(commandLine);
480 processBuilder.directory(regRipperHomeDir.toFile());
481 processBuilder.redirectOutput(
new File(outputFile));
482 processBuilder.redirectError(
new File(errFile));
483 ExecUtil.execute(processBuilder,
new DataSourceIngestModuleProcessTerminator(context,
true));
484 }
catch (IOException ex) {
485 logger.log(Level.SEVERE, String.format(
"Error running RegRipper on %s", hiveFilePath), ex);
486 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"ExtractRegistry.execRegRip.errMsg.failedAnalyzeRegFile", this.getName(), hiveFilePath));
499 private boolean parseAutopsyPluginOutput(String regFilePath, AbstractFile regFile) {
500 FileInputStream fstream = null;
501 List<BlackboardArtifact> newArtifacts =
new ArrayList<>();
504 File regfile =
new File(regFilePath);
505 fstream =
new FileInputStream(regfile);
506 String regString =
new Scanner(fstream,
"UTF-8").useDelimiter(
"\\Z").next();
507 String startdoc =
"<?xml version=\"1.0\"?><document>";
508 String result = regString.replaceAll(
"----------------------------------------",
"");
509 result = result.replaceAll(
"\\n",
"");
510 result = result.replaceAll(
"\\r",
"");
511 result = result.replaceAll(
"'",
"'");
512 result = result.replaceAll(
"&",
"&");
513 result = result.replace(
'\0',
' ');
514 String enddoc =
"</document>";
515 String stringdoc = startdoc + result + enddoc;
516 DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
517 Document doc = builder.parse(
new InputSource(
new StringReader(stringdoc)));
520 Element oroot = doc.getDocumentElement();
521 NodeList children = oroot.getChildNodes();
522 int len = children.getLength();
523 for (
int i = 0; i < len; i++) {
525 if (context.dataSourceIngestIsCancelled()) {
529 Element tempnode = (Element) children.item(i);
531 String dataType = tempnode.getNodeName();
532 NodeList timenodes = tempnode.getElementsByTagName(
"mtime");
534 if (timenodes.getLength() > 0) {
535 Element timenode = (Element) timenodes.item(0);
536 String etime = timenode.getTextContent();
538 if (etime != null && !etime.isEmpty()) {
540 mtime =
new SimpleDateFormat(
"EEE MMM d HH:mm:ss yyyy", US).parse(etime).getTime();
541 String Tempdate = mtime.toString();
542 mtime = Long.valueOf(Tempdate) / MS_IN_SEC;
543 }
catch (ParseException ex) {
544 logger.log(Level.WARNING,
"Failed to parse epoch time when parsing the registry.", ex);
549 NodeList artroots = tempnode.getElementsByTagName(
"artifacts");
550 if (artroots.getLength() == 0) {
555 Element artroot = (Element) artroots.item(0);
556 NodeList myartlist = artroot.getChildNodes();
557 String parentModuleName = RecentActivityExtracterModuleFactory.getModuleName();
563 String systemRoot =
"";
564 String productId =
"";
565 String regOwner =
"";
567 Long installtime = null;
568 for (
int j = 0; j < myartlist.getLength(); j++) {
569 Node artchild = myartlist.item(j);
571 if (artchild.hasAttributes()) {
572 Element artnode = (Element) artchild;
574 String value = artnode.getTextContent();
576 value = value.trim();
578 String name = artnode.getAttribute(
"name");
588 version = version +
" " + value;
596 case "RegisteredOwner":
599 case "RegisteredOrganization":
603 if (value != null && !value.isEmpty()) {
605 installtime =
new SimpleDateFormat(
"EEE MMM d HH:mm:ss yyyy", US).parse(value).getTime();
606 String Tempdate = installtime.toString();
607 installtime = Long.valueOf(Tempdate) / MS_IN_SEC;
608 }
catch (ParseException e) {
609 logger.log(Level.WARNING,
"RegRipper::Conversion on DateTime -> ", e);
619 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
620 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME, parentModuleName, version));
621 if (installtime != null) {
622 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, parentModuleName, installtime));
624 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH, parentModuleName, systemRoot));
625 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PRODUCT_ID, parentModuleName, productId));
626 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_OWNER, parentModuleName, regOwner));
627 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_ORGANIZATION, parentModuleName, regOrg));
630 ArrayList<BlackboardArtifact> results = tskCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_OS_INFO, regFile.getId());
631 if (results.isEmpty()) {
632 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_OS_INFO);
633 bbart.addAttributes(bbattributes);
635 newArtifacts.add(bbart);
637 results.get(0).addAttributes(bbattributes);
640 }
catch (TskCoreException ex) {
641 logger.log(Level.SEVERE,
"Error adding installed program artifact to blackboard.");
646 String procArch =
"";
648 for (
int j = 0; j < myartlist.getLength(); j++) {
649 Node artchild = myartlist.item(j);
651 if (artchild.hasAttributes()) {
652 Element artnode = (Element) artchild;
654 String value = artnode.getTextContent().trim();
655 String name = artnode.getAttribute(
"name");
660 case "PROCESSOR_ARCHITECTURE":
663 case "PROCESSOR_IDENTIFIER":
674 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
675 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_VERSION, parentModuleName, os));
676 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROCESSOR_ARCHITECTURE, parentModuleName, procArch));
677 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TEMP_DIR, parentModuleName, tempDir));
680 ArrayList<BlackboardArtifact> results = tskCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_OS_INFO, regFile.getId());
681 if (results.isEmpty()) {
682 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_OS_INFO);
683 bbart.addAttributes(bbattributes);
685 newArtifacts.add(bbart);
687 results.get(0).addAttributes(bbattributes);
689 }
catch (TskCoreException ex) {
690 logger.log(Level.SEVERE,
"Error adding os info artifact to blackboard.");
694 String compName =
"";
696 for (
int j = 0; j < myartlist.getLength(); j++) {
697 Node artchild = myartlist.item(j);
699 if (artchild.hasAttributes()) {
700 Element artnode = (Element) artchild;
702 String value = artnode.getTextContent().trim();
703 String name = artnode.getAttribute(
"name");
705 if (name.equals(
"ComputerName")) {
707 }
else if (name.equals(
"Domain")) {
713 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
714 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME, parentModuleName, compName));
715 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN, parentModuleName, domain));
718 ArrayList<BlackboardArtifact> results = tskCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_OS_INFO, regFile.getId());
719 if (results.isEmpty()) {
720 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_OS_INFO);
721 bbart.addAttributes(bbattributes);
723 newArtifacts.add(bbart);
725 results.get(0).addAttributes(bbattributes);
727 }
catch (TskCoreException ex) {
728 logger.log(Level.SEVERE,
"Error adding os info artifact to blackboard.", ex);
732 for (
int j = 0; j < myartlist.getLength(); j++) {
733 Node artchild = myartlist.item(j);
735 if (artchild.hasAttributes()) {
736 Element artnode = (Element) artchild;
738 String value = artnode.getTextContent().trim();
739 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
752 Long usbMtime = Long.parseLong(artnode.getAttribute(
"mtime"));
753 usbMtime = Long.valueOf(usbMtime.toString());
755 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_DEVICE_ATTACHED);
756 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, parentModuleName, usbMtime));
757 String dev = artnode.getAttribute(
"dev");
760 if (dev.toLowerCase().contains(
"vid")) {
761 USBInfo info = USB_MAPPER.parseAndLookup(dev);
762 if (info.getVendor() != null) {
763 make = info.getVendor();
765 if (info.getProduct() != null) {
766 model = info.getProduct();
769 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_MAKE, parentModuleName, make));
770 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_MODEL, parentModuleName, model));
771 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_ID, parentModuleName, value));
772 bbart.addAttributes(bbattributes);
774 newArtifacts.add(bbart);
775 }
catch (TskCoreException ex) {
776 logger.log(Level.SEVERE,
"Error adding device attached artifact to blackboard.", ex);
780 Long itemMtime = null;
782 String mTimeAttr = artnode.getAttribute(
"mtime");
783 if (mTimeAttr != null && !mTimeAttr.isEmpty()) {
784 itemMtime =
new SimpleDateFormat(
"EEE MMM d HH:mm:ss yyyy", US).parse(mTimeAttr).getTime();
785 itemMtime /= MS_IN_SEC;
787 }
catch (ParseException ex) {
788 logger.log(Level.SEVERE,
"Failed to parse epoch time for installed program artifact.", ex);
792 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME, parentModuleName, value));
793 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, parentModuleName, itemMtime));
794 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_INSTALLED_PROG);
795 bbart.addAttributes(bbattributes);
797 newArtifacts.add(bbart);
798 }
catch (TskCoreException ex) {
799 logger.log(Level.SEVERE,
"Error adding installed program artifact to blackboard.", ex);
803 String officeName = artnode.getAttribute(
"name");
806 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_RECENT_OBJECT);
809 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED, parentModuleName, mtime));
811 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME, parentModuleName, officeName));
812 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_VALUE, parentModuleName, value));
813 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME, parentModuleName, artnode.getNodeName()));
814 bbart.addAttributes(bbattributes);
816 newArtifacts.add(bbart);
817 }
catch (TskCoreException ex) {
818 logger.log(Level.SEVERE,
"Error adding recent object artifact to blackboard.", ex);
822 case "ProcessorArchitecture":
839 String homeDir = value;
840 String sid = artnode.getAttribute(
"sid");
841 String username = artnode.getAttribute(
"username");
842 BlackboardArtifact bbart = null;
845 ArrayList<BlackboardArtifact> existingArtifacts = currentCase.getSleuthkitCase().getBlackboardArtifacts(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
846 for (BlackboardArtifact artifact : existingArtifacts) {
847 if (artifact.getDataSource().getId() == regFile.getDataSourceObjectId()) {
848 BlackboardAttribute attribute = artifact.getAttribute(
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_ID));
849 if (attribute != null && attribute.getValueString().equals(sid)) {
855 }
catch (TskCoreException ex) {
856 logger.log(Level.SEVERE,
"Error getting existing os account artifact", ex);
860 bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
861 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
862 parentModuleName, username));
863 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_ID,
864 parentModuleName, sid));
865 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
866 parentModuleName, homeDir));
868 newArtifacts.add(bbart);
871 BlackboardAttribute bbattr = bbart.getAttribute(
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_NAME));
873 if (bbattr == null) {
874 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
875 parentModuleName, username));
877 bbattr = bbart.getAttribute(
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_PATH));
878 if (bbattr == null) {
879 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
880 parentModuleName, homeDir));
883 bbart.addAttributes(bbattributes);
885 }
catch (TskCoreException ex) {
886 logger.log(Level.SEVERE,
"Error adding account artifact to blackboard.", ex);
890 case "NtuserNetwork":
892 String localPath = artnode.getAttribute(
"localPath");
893 String remoteName = value;
894 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_REMOTE_DRIVE);
895 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LOCAL_PATH,
896 parentModuleName, localPath));
897 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REMOTE_PATH,
898 parentModuleName, remoteName));
899 bbart.addAttributes(bbattributes);
900 newArtifacts.add(bbart);
901 }
catch (TskCoreException ex) {
902 logger.log(Level.SEVERE,
"Error adding network artifact to blackboard.", ex);
906 String adapter = artnode.getAttribute(
"adapter");
908 Long lastWriteTime = Long.parseLong(artnode.getAttribute(
"writeTime"));
909 lastWriteTime = Long.valueOf(lastWriteTime.toString());
910 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_SSID, parentModuleName, value));
911 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, parentModuleName, lastWriteTime));
912 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DEVICE_ID, parentModuleName, adapter));
913 BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_WIFI_NETWORK);
914 bbart.addAttributes(bbattributes);
915 newArtifacts.add(bbart);
916 }
catch (TskCoreException ex) {
917 logger.log(Level.SEVERE,
"Error adding SSID artifact to blackboard.", ex);
927 logger.log(Level.SEVERE,
"Unrecognized node name: {0}", dataType);
936 }
catch (FileNotFoundException ex) {
937 logger.log(Level.WARNING, String.format(
"Error finding the registry file: %s", regFilePath), ex);
938 }
catch (SAXException ex) {
939 logger.log(Level.WARNING, String.format(
"Error parsing the registry XML: %s", regFilePath), ex);
940 }
catch (IOException ex) {
941 logger.log(Level.WARNING, String.format(
"Error building the document parser: %s", regFilePath), ex);
942 }
catch (ParserConfigurationException ex) {
943 logger.log(Level.WARNING, String.format(
"Error configuring the registry parser: %s", regFilePath), ex);
946 if (fstream != null) {
949 }
catch (IOException ex) {
952 postArtifacts(newArtifacts);
957 private boolean parseSystemPluginOutput(String regfilePath, AbstractFile regAbstractFile) {
958 File regfile =
new File(regfilePath);
959 try (BufferedReader reader =
new BufferedReader(
new FileReader(regfile))) {
960 String line = reader.readLine();
961 while (line != null) {
964 if (line.toLowerCase().matches(
"^bam v.*")) {
965 parseBamKey(regAbstractFile, reader, Bundle.Registry_System_Bam());
966 }
else if (line.toLowerCase().matches(
"^bthport v..*")) {
967 parseBlueToothDevices(regAbstractFile, reader);
969 line = reader.readLine();
972 }
catch (FileNotFoundException ex) {
973 logger.log(Level.WARNING,
"Error finding the registry file.", ex);
974 }
catch (IOException ex) {
975 logger.log(Level.WARNING,
"Error reading the system hive: {0}", ex);
994 private void parseBlueToothDevices(AbstractFile regFile, BufferedReader reader)
throws FileNotFoundException, IOException {
995 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
996 String line = reader.readLine();
997 while ((line != null) && (!line.contains(SECTION_DIVIDER))) {
998 line = reader.readLine();
1004 if ((line != null) && (line.toLowerCase().contains(
"device unique id"))) {
1008 while (line != null && !line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.toLowerCase().contains(
"radio support not found")) {
1009 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1010 addBlueToothAttribute(line, attributes, TSK_DEVICE_ID);
1011 line = reader.readLine();
1013 if ((line != null) && (line.toLowerCase().contains(
"name"))) {
1014 addBlueToothAttribute(line, attributes, TSK_NAME);
1015 line = reader.readLine();
1017 addBlueToothAttribute(line, attributes, TSK_DATETIME);
1018 line = reader.readLine();
1019 addBlueToothAttribute(line, attributes, TSK_DATETIME_ACCESSED);
1020 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING, regFile, attributes);
1022 bbartifacts.add(bba);
1026 line = reader.readLine();
1034 if (!bbartifacts.isEmpty()) {
1035 postArtifacts(bbartifacts);
1039 private void addBlueToothAttribute(String line, Collection<BlackboardAttribute> attributes, ATTRIBUTE_TYPE attributeType) {
1044 String tokens[] = line.split(
": ");
1045 if (tokens.length > 1 && !tokens[1].isEmpty()) {
1046 String tokenString = tokens[1];
1047 if (attributeType.getDisplayName().toLowerCase().contains(
"date")) {
1048 String dateString = tokenString.toLowerCase().replace(
" z",
"");
1050 SimpleDateFormat dateFormat =
new SimpleDateFormat(
"EEE MMM d HH:mm:ss yyyy", US);
1051 Long dateLong = Long.valueOf(0);
1053 Date newDate = dateFormat.parse(dateString);
1054 dateLong = newDate.getTime() / 1000;
1055 }
catch (ParseException ex) {
1058 logger.log(Level.WARNING, String.format(
"Failed to parse date/time %s for Bluetooth Last Seen attribute.", dateString), ex);
1060 attributes.add(
new BlackboardAttribute(attributeType, getName(), dateLong));
1062 attributes.add(
new BlackboardAttribute(attributeType, getName(), tokenString));
1076 private boolean parseSamPluginOutput(String regFilePath, AbstractFile regAbstractFile) {
1077 File regfile =
new File(regFilePath);
1078 List<BlackboardArtifact> newArtifacts =
new ArrayList<>();
1079 try (BufferedReader bufferedReader =
new BufferedReader(
new FileReader(regfile))) {
1081 String userInfoSection =
"User Information";
1082 String previousLine = null;
1083 String line = bufferedReader.readLine();
1084 Set<Map<String, String>> userSet =
new HashSet<>();
1085 Map<String, List<String>> groupMap = null;
1086 while (line != null) {
1087 if (line.contains(SECTION_DIVIDER) && previousLine != null && previousLine.contains(userInfoSection)) {
1088 readUsers(bufferedReader, userSet);
1091 if (line.contains(SECTION_DIVIDER) && previousLine != null && previousLine.contains(
"Group Membership Information")) {
1092 groupMap = readGroups(bufferedReader);
1095 previousLine = line;
1096 line = bufferedReader.readLine();
1098 Map<String, Map<String, String>> userInfoMap =
new HashMap<>();
1100 for (Map<String, String> userInfo : userSet) {
1101 userInfoMap.put(userInfo.get(SID_KEY), userInfo);
1104 List<BlackboardArtifact> existingOsAccounts = tskCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
1105 for (BlackboardArtifact osAccount : existingOsAccounts) {
1107 if (osAccount.getDataSource().getId() == regAbstractFile.getDataSourceObjectId()) {
1108 BlackboardAttribute existingUserId = osAccount.getAttribute(
new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_USER_ID));
1109 if (existingUserId != null) {
1110 String userID = existingUserId.getValueString().trim();
1111 Map<String, String> userInfo = userInfoMap.remove(userID);
1113 if (userInfo != null) {
1114 osAccount.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userID),
true, regAbstractFile));
1121 for (Map<String, String> userInfo : userInfoMap.values()) {
1122 BlackboardArtifact bbart = regAbstractFile.newArtifact(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
1123 bbart.addAttributes(getAttributesForAccount(userInfo, groupMap.get(userInfo.get(SID_KEY)),
false, regAbstractFile));
1125 newArtifacts.add(bbart);
1130 userNameMap = makeUserNameMap(dataSource);
1131 }
catch (TskCoreException ex) {
1132 logger.log(Level.WARNING,
"Unable to create OS Account user name map", ex);
1135 userNameMap =
new HashMap<>();
1138 }
catch (FileNotFoundException ex) {
1139 logger.log(Level.WARNING,
"Error finding the registry file.", ex);
1140 }
catch (IOException ex) {
1141 logger.log(Level.WARNING,
"Error building the document parser: {0}", ex);
1142 }
catch (ParseException ex) {
1143 logger.log(Level.WARNING,
"Error parsing the the date from the registry file", ex);
1144 }
catch (TskCoreException ex) {
1145 logger.log(Level.WARNING,
"Error updating TSK_OS_ACCOUNT artifacts to include newly parsed data.", ex);
1147 postArtifacts(newArtifacts);
1163 Collection<BlackboardAttribute> getAttributesForAccount(Map<String, String> userInfo, List<String> groupList,
boolean existingUser, AbstractFile regAbstractFile)
throws ParseException {
1164 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
1166 SimpleDateFormat regRipperTimeFormat =
new SimpleDateFormat(
"EEE MMM dd HH:mm:ss yyyy 'Z'", US);
1167 regRipperTimeFormat.setTimeZone(getTimeZone(
"GMT"));
1169 if (!existingUser) {
1170 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_ID,
1171 getRAModuleName(), userInfo.get(SID_KEY)));
1173 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1174 this.moduleName, userInfo.get(USERNAME_KEY)));
1177 String value = userInfo.get(ACCOUNT_CREATED_KEY);
1178 if (value != null && !value.isEmpty() && !value.equals(NEVER_DATE)) {
1179 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
1180 getRAModuleName(), regRipperTimeFormat.parse(value).getTime() / MS_IN_SEC));
1183 value = userInfo.get(LAST_LOGIN_KEY);
1184 if (value != null && !value.isEmpty() && !value.equals(NEVER_DATE)) {
1185 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED,
1186 getRAModuleName(), regRipperTimeFormat.parse(value).getTime() / MS_IN_SEC));
1189 value = userInfo.get(LOGIN_COUNT_KEY);
1190 if (value != null && !value.isEmpty()) {
1191 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COUNT,
1192 getRAModuleName(), Integer.parseInt(value)));
1195 value = userInfo.get(ACCOUNT_TYPE_KEY);
1196 if (value != null && !value.isEmpty()) {
1197 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE,
1198 getRAModuleName(), value));
1201 value = userInfo.get(USER_COMMENT_KEY);
1202 if (value != null && !value.isEmpty()) {
1203 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DESCRIPTION,
1204 getRAModuleName(), value));
1207 value = userInfo.get(NAME_KEY);
1208 if (value != null && !value.isEmpty()) {
1209 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME,
1210 getRAModuleName(), value));
1213 value = userInfo.get(INTERNET_NAME_KEY);
1214 if (value != null && !value.isEmpty()) {
1217 Case.getCurrentCaseThrows()
1219 .getCommunicationsManager()
1220 .createAccountFileInstance(Account.Type.EMAIL,
1221 value, getRAModuleName(), regAbstractFile);
1222 }
catch (NoCurrentCaseException | TskCoreException ex) {
1223 logger.log(Level.SEVERE,
1224 String.format(
"Error adding email account with value "
1225 +
"%s, to the case database for file %s [objId=%d]",
1226 value, regAbstractFile.getName(), regAbstractFile.getId()), ex);
1229 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_EMAIL,
1230 getRAModuleName(), value));
1233 value = userInfo.get(FULL_NAME_KEY);
1234 if (value != null && !value.isEmpty()) {
1235 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DISPLAY_NAME,
1236 getRAModuleName(), value));
1239 value = userInfo.get(PWD_RESET_KEY);
1240 if (value != null && !value.isEmpty() && !value.equals(NEVER_DATE)) {
1241 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_PASSWORD_RESET,
1242 getRAModuleName(), regRipperTimeFormat.parse(value).getTime() / MS_IN_SEC));
1245 value = userInfo.get(PASSWORD_HINT);
1246 if (value != null && !value.isEmpty()) {
1247 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PASSWORD_HINT,
1248 getRAModuleName(), value));
1251 value = userInfo.get(PWD_FAILE_KEY);
1252 if (value != null && !value.isEmpty() && !value.equals(NEVER_DATE)) {
1253 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_PASSWORD_FAIL,
1254 getRAModuleName(), regRipperTimeFormat.parse(value).getTime() / MS_IN_SEC));
1257 String settingString =
"";
1258 for (String setting : PASSWORD_SETTINGS_FLAGS) {
1259 if (userInfo.containsKey(setting)) {
1260 settingString += setting +
", ";
1264 if (!settingString.isEmpty()) {
1265 settingString = settingString.substring(0, settingString.length() - 2);
1266 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PASSWORD_SETTINGS,
1267 getRAModuleName(), settingString));
1271 for (String setting : ACCOUNT_SETTINGS_FLAGS) {
1272 if (userInfo.containsKey(setting)) {
1273 settingString += setting +
", ";
1277 if (!settingString.isEmpty()) {
1278 settingString = settingString.substring(0, settingString.length() - 2);
1279 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_ACCOUNT_SETTINGS,
1280 getRAModuleName(), settingString));
1284 for (String setting : ACCOUNT_TYPE_FLAGS) {
1285 if (userInfo.containsKey(setting)) {
1286 settingString += setting +
", ";
1290 if (!settingString.isEmpty()) {
1291 settingString = settingString.substring(0, settingString.length() - 2);
1292 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_FLAG,
1293 getRAModuleName(), settingString));
1296 if (groupList != null && groupList.isEmpty()) {
1298 for (String group : groupList) {
1299 groups += group +
", ";
1302 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_GROUPS,
1303 getRAModuleName(), groups.substring(0, groups.length() - 2)));
1306 return bbattributes;
1320 private void readUsers(BufferedReader bufferedReader, Set<Map<String, String>> users) throws IOException {
1321 String line = bufferedReader.readLine();
1323 String userName =
"";
1324 String user_rid =
"";
1325 while (line != null && !line.contains(SECTION_DIVIDER)) {
1327 if (line.contains(USERNAME_KEY)) {
1328 String regx = USERNAME_KEY +
"\\s*?:";
1329 String userNameAndIdString = line.replaceAll(regx,
"");
1330 userName = userNameAndIdString.substring(0, userNameAndIdString.lastIndexOf(
'[')).trim();
1331 user_rid = userNameAndIdString.substring(userNameAndIdString.lastIndexOf(
'['), userNameAndIdString.lastIndexOf(
']'));
1332 }
else if (line.contains(SID_KEY) && !userName.isEmpty()) {
1333 Map.Entry<String, String> entry = getSAMKeyValue(line);
1335 HashMap<String, String> userInfo =
new HashMap<>();
1336 userInfo.put(USERNAME_KEY, userName);
1337 userInfo.put(RID_KEY, user_rid);
1338 userInfo.put(entry.getKey(), entry.getValue());
1341 line = bufferedReader.readLine();
1342 while (line != null && !line.isEmpty()) {
1343 entry = getSAMKeyValue(line);
1344 if (entry != null) {
1345 userInfo.put(entry.getKey(), entry.getValue());
1347 line = bufferedReader.readLine();
1349 users.add(userInfo);
1353 line = bufferedReader.readLine();
1366 private void createRecentlyUsedArtifacts(String regFileName, AbstractFile regFile)
throws FileNotFoundException, IOException {
1367 File regfile =
new File(regFileName);
1368 try (BufferedReader reader =
new BufferedReader(
new FileReader(regfile))) {
1369 String line = reader.readLine();
1370 while (line != null) {
1373 if (line.matches(
"^adoberdr v.*")) {
1374 parseAdobeMRUList(regFile, reader, Bundle.Recently_Used_Artifacts_Adobe());
1375 }
else if (line.matches(
"^mpmru v.*")) {
1376 parseMediaPlayerMRUList(regFile, reader, Bundle.Recently_Used_Artifacts_Mediaplayer());
1377 }
else if (line.matches(
"^trustrecords v.*")) {
1378 parseOfficeTrustRecords(regFile, reader, Bundle.Recently_Used_Artifacts_Office_Trustrecords());
1379 }
else if (line.matches(
"^ArcHistory:")) {
1380 parse7ZipMRU(regFile, reader, Bundle.Recently_Used_Artifacts_ArcHistory());
1381 }
else if (line.matches(
"^applets v.*")) {
1382 parseGenericMRUList(regFile, reader, Bundle.Recently_Used_Artifacts_Applets());
1383 }
else if (line.matches(
"^mmc v.*")) {
1384 parseGenericMRUList(regFile, reader, Bundle.Recently_Used_Artifacts_Mmc());
1385 }
else if (line.matches(
"^winrar v.*")) {
1386 parseWinRARMRUList(regFile, reader, Bundle.Recently_Used_Artifacts_Winrar());
1387 }
else if (line.matches(
"^officedocs2010 v.*")) {
1388 parseOfficeDocs2010MRUList(regFile, reader, Bundle.Recently_Used_Artifacts_Officedocs());
1390 line = reader.readLine();
1406 private void parseBamKey(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1407 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1408 String line = reader.readLine();
1410 while (!line.contains(SECTION_DIVIDER)) {
1411 line = reader.readLine();
1414 line = reader.readLine();
1416 while (!line.contains(SECTION_DIVIDER)) {
1419 String tokens[] = line.split(
"\\|");
1420 Long progRunDateTime = Long.valueOf(tokens[0]);
1423 String fileNameSid[] = tokens[4].split(
"\\s+\\(S-");
1424 String userSid =
"S-" + fileNameSid[1].substring(0, fileNameSid[1].length() - 1);
1425 String userName = userNameMap.get(userSid);
1426 if (userName == null) {
1429 String fileName = fileNameSid[0];
1430 if (fileName.startsWith(
"\\Device\\HarddiskVolume")) {
1432 int fileNameStart = fileName.indexOf(
'\\', 16);
1433 fileName = fileName.substring(fileNameStart, fileName.length());
1436 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1437 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME, getName(), fileName));
1438 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME, getName(), userName));
1439 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, getName(), progRunDateTime));
1440 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, getName(), comment));
1441 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_PROG_RUN, regFile, attributes);
1443 bbartifacts.add(bba);
1444 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1446 bbartifacts.add(bba);
1449 line = reader.readLine();
1451 if (!bbartifacts.isEmpty()) {
1452 postArtifacts(bbartifacts);
1467 private void parseAdobeMRUList(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1468 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1469 String line = reader.readLine();
1470 SimpleDateFormat adobePluginDateFormat =
new SimpleDateFormat(
"yyyyMMddHHmmssZ", US);
1471 Long adobeUsedTime = Long.valueOf(0);
1472 while (!line.contains(SECTION_DIVIDER)) {
1473 line = reader.readLine();
1475 if (line.matches(
"^Key name,file name,sDate,uFileSize,uPageCount")) {
1476 line = reader.readLine();
1479 while (!line.contains(SECTION_DIVIDER)) {
1482 String tokens[] = line.split(
",(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
1483 String fileName = tokens[1].substring(0, tokens[1].length() - 1);
1484 fileName = fileName.replace(
"\"",
"");
1485 if (fileName.charAt(0) ==
'/') {
1486 fileName = fileName.substring(1, fileName.length() - 1);
1487 fileName = fileName.replaceFirst(
"/",
":/");
1490 if (tokens.length > 2) {
1493 String fileUsedTime = tokens[2].replaceAll(
"'",
"");
1494 Date usedDate = adobePluginDateFormat.parse(fileUsedTime);
1495 adobeUsedTime = usedDate.getTime() / 1000;
1496 }
catch (ParseException ex) {
1499 logger.log(Level.WARNING, String.format(
"Failed to parse date/time %s for adobe file artifact.", tokens[2]), ex);
1502 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1503 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1504 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED, getName(), adobeUsedTime));
1505 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1506 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1508 bbartifacts.add(bba);
1509 fileName = fileName.replace(
"\0",
"");
1510 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1512 bbartifacts.add(bba);
1515 line = reader.readLine();
1520 if (!bbartifacts.isEmpty()) {
1521 postArtifacts(bbartifacts);
1537 private void parseMediaPlayerMRUList(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1538 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1539 String line = reader.readLine();
1540 while (!line.contains(SECTION_DIVIDER)) {
1541 line = reader.readLine();
1543 if (line.contains(
"LastWrite")) {
1544 line = reader.readLine();
1547 while (!line.contains(SECTION_DIVIDER) && !line.contains(
"RecentFileList has no values.")) {
1549 String tokens[] = line.split(
"> ");
1550 String fileName = tokens[1];
1551 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1552 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1553 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1554 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1556 bbartifacts.add(bba);
1557 bba = createAssociatedArtifact(fileName, bba);
1559 bbartifacts.add(bba);
1560 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1562 bbartifacts.add(bba);
1566 line = reader.readLine();
1571 if (!bbartifacts.isEmpty()) {
1572 postArtifacts(bbartifacts);
1588 private void parseGenericMRUList(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1589 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1590 String line = reader.readLine();
1591 while (!line.contains(SECTION_DIVIDER)) {
1592 line = reader.readLine();
1594 if (line.contains(
"LastWrite")) {
1595 line = reader.readLine();
1598 while (!line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.contains(
"Applets")
1599 && !line.contains((
"Recent File List"))) {
1601 String tokens[] = line.split(
"> ");
1602 String fileName = tokens[1];
1603 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1604 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1605 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1606 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1608 bbartifacts.add(bba);
1609 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1611 bbartifacts.add(bba);
1614 line = reader.readLine();
1619 if (!bbartifacts.isEmpty()) {
1620 postArtifacts(bbartifacts);
1636 private void parseWinRARMRUList(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1637 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1638 String line = reader.readLine();
1639 while (!line.contains(SECTION_DIVIDER)) {
1640 line = reader.readLine();
1642 if (line.contains(
"LastWrite")) {
1643 line = reader.readLine();
1646 if (!line.isEmpty()) {
1647 while (!line.contains(SECTION_DIVIDER)) {
1649 String tokens[] = line.split(
"> ");
1650 String fileName = tokens[1];
1651 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1652 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1653 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1654 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1656 bbartifacts.add(bba);
1657 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1659 bbartifacts.add(bba);
1662 line = reader.readLine();
1668 if (!bbartifacts.isEmpty()) {
1669 postArtifacts(bbartifacts);
1685 private void parse7ZipMRU(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1686 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1687 String line = reader.readLine();
1689 if (!line.contains(
"PathHistory:")) {
1690 while (!line.contains(
"PathHistory:") && !line.isEmpty()) {
1693 String fileName = line;
1694 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1695 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1696 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1697 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1699 bbartifacts.add(bba);
1700 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1702 bbartifacts.add(bba);
1705 line = reader.readLine();
1709 if (!bbartifacts.isEmpty()) {
1710 postArtifacts(bbartifacts);
1726 private void parseOfficeDocs2010MRUList(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1727 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1728 String line = reader.readLine();
1732 while (!line.contains(SECTION_DIVIDER)) {
1733 line = reader.readLine();
1735 line = reader.readLine();
1736 while (!line.contains(SECTION_DIVIDER)) {
1739 String tokens[] = line.split(
"\\|");
1740 Long docDate = Long.valueOf(tokens[0]);
1741 String fileNameTokens[] = tokens[4].split(
" - ");
1742 String fileName = fileNameTokens[1];
1743 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1744 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1745 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED, getName(), docDate));
1746 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1747 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1749 bbartifacts.add(bba);
1750 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1752 bbartifacts.add(bba);
1755 line = reader.readLine();
1758 if (!bbartifacts.isEmpty()) {
1759 postArtifacts(bbartifacts);
1775 private void parseOfficeTrustRecords(AbstractFile regFile, BufferedReader reader, String comment)
throws FileNotFoundException, IOException {
1776 String userProfile = regFile.getParentPath();
1777 userProfile = userProfile.substring(0, userProfile.length() - 1);
1778 List<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1779 SimpleDateFormat pluginDateFormat =
new SimpleDateFormat(
"EEE MMM dd HH:mm:ss yyyy", US);
1780 Long usedTime = Long.valueOf(0);
1781 String line = reader.readLine();
1782 while (!line.contains(SECTION_DIVIDER)) {
1783 line = reader.readLine();
1785 usedTime = Long.valueOf(0);
1786 if (!line.contains(
"**") && !line.contains(
"----------") && !line.contains(
"LastWrite")
1787 && !line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.contains(
"TrustRecords")
1788 && !line.contains(
"VBAWarnings =")) {
1792 String fileName = null;
1793 String tokens[] = line.split(
" : ");
1794 fileName = tokens[1];
1795 fileName = fileName.replace(
"%USERPROFILE%", userProfile);
1798 String fileUsedTime = tokens[0].replaceAll(
" Z",
"");
1799 Date usedDate = pluginDateFormat.parse(fileUsedTime);
1800 usedTime = usedDate.getTime() / 1000;
1801 }
catch (ParseException ex) {
1804 logger.log(Level.WARNING, String.format(
"Failed to parse date/time %s for TrustRecords artifact.", tokens[0]), ex);
1806 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1807 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), fileName));
1808 attributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED, getName(), usedTime));
1809 attributes.add(
new BlackboardAttribute(TSK_COMMENT, getName(), comment));
1810 BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
1812 bbartifacts.add(bba);
1813 bba = createAssociatedArtifact(FilenameUtils.normalize(fileName,
true), bba);
1815 bbartifacts.add(bba);
1821 if (!bbartifacts.isEmpty()) {
1822 postArtifacts(bbartifacts);
1836 private BlackboardArtifact createAssociatedArtifact(String filePathName, BlackboardArtifact bba) {
1838 String fileName = FilenameUtils.getName(filePathName);
1839 String filePath = FilenameUtils.getPath(filePathName);
1840 List<AbstractFile> sourceFiles;
1842 sourceFiles = fileManager.
findFiles(dataSource, fileName, filePath);
1843 if (!sourceFiles.isEmpty()) {
1844 for (AbstractFile sourceFile : sourceFiles) {
1845 if (sourceFile.getParentPath().endsWith(filePath)) {
1846 Collection<BlackboardAttribute> bbattributes2 =
new ArrayList<>();
1847 bbattributes2.addAll(Arrays.asList(
1848 new BlackboardAttribute(TSK_ASSOCIATED_ARTIFACT, this.getName(),
1849 bba.getArtifactID())));
1851 BlackboardArtifact associatedObjectBba = createArtifactWithAttributes(TSK_ASSOCIATED_OBJECT, sourceFile, bbattributes2);
1852 if (associatedObjectBba != null) {
1853 return associatedObjectBba;
1858 }
catch (TskCoreException ex) {
1861 logger.log(Level.WARNING, String.format(
"Error finding actual file %s. file may not exist", filePathName));
1876 private Map<String, String> makeUserNameMap(Content dataSource)
throws TskCoreException {
1877 Map<String, String> userNameMap =
new HashMap<>();
1879 List<BlackboardArtifact> accounts = blackboard.getArtifacts(TSK_OS_ACCOUNT.getTypeID(), dataSource.getId());
1881 for (BlackboardArtifact account : accounts) {
1882 BlackboardAttribute nameAttribute = getAttributeForArtifact(account, TSK_USER_NAME);
1883 BlackboardAttribute idAttribute = getAttributeForArtifact(account, TSK_USER_ID);
1885 String userName = nameAttribute != null ? nameAttribute.getDisplayString() :
"";
1886 String userID = idAttribute != null ? idAttribute.getDisplayString() :
"";
1888 if (!userID.isEmpty()) {
1889 userNameMap.put(userID, userName);
1906 private BlackboardAttribute getAttributeForArtifact(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException {
1907 return artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(type.getTypeID())));
1918 void createShellBagArtifacts(AbstractFile regFile, List<ShellBag> shellbags)
throws TskCoreException {
1919 List<BlackboardArtifact> artifacts =
new ArrayList<>();
1921 for (ShellBag bag : shellbags) {
1922 Collection<BlackboardAttribute> attributes =
new ArrayList<>();
1923 BlackboardArtifact artifact = regFile.newArtifact(getShellBagArtifact().getTypeID());
1924 attributes.add(
new BlackboardAttribute(TSK_PATH, getName(), bag.getResource()));
1925 attributes.add(
new BlackboardAttribute(getKeyAttribute(), getName(), bag.getKey()));
1928 time = bag.getLastWrite();
1930 attributes.add(
new BlackboardAttribute(getLastWriteAttribute(), getName(), time));
1933 time = bag.getModified();
1935 attributes.add(
new BlackboardAttribute(TSK_DATETIME_MODIFIED, getName(), time));
1938 time = bag.getCreated();
1940 attributes.add(
new BlackboardAttribute(TSK_DATETIME_CREATED, getName(), time));
1943 time = bag.getAccessed();
1945 attributes.add(
new BlackboardAttribute(TSK_DATETIME_ACCESSED, getName(), time));
1948 artifact.addAttributes(attributes);
1950 artifacts.add(artifact);
1953 postArtifacts(artifacts);
1965 private BlackboardArtifact.Type getShellBagArtifact() throws TskCoreException {
1966 if (shellBagArtifactType == null) {
1968 shellBagArtifactType = tskCase.getBlackboard().getOrAddArtifactType(SHELLBAG_ARTIFACT_NAME, Bundle.Shellbag_Artifact_Display_Name());
1969 }
catch (BlackboardException ex) {
1970 throw new TskCoreException(String.format(
"Failed to get shell bag artifact type", SHELLBAG_ARTIFACT_NAME), ex);
1974 return shellBagArtifactType;
1985 private BlackboardAttribute.Type getLastWriteAttribute() throws TskCoreException {
1986 if (shellBagLastWriteAttributeType == null) {
1988 shellBagLastWriteAttributeType = tskCase.getBlackboard().getOrAddAttributeType(SHELLBAG_ATTRIBUTE_LAST_WRITE,
1989 BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME,
1990 Bundle.Shellbag_Last_Write_Attribute_Display_Name());
1991 }
catch (BlackboardException ex) {
1993 throw new TskCoreException(String.format(
"Failed to get custom attribute %s", SHELLBAG_ATTRIBUTE_LAST_WRITE), ex);
1996 return shellBagLastWriteAttributeType;
2007 private BlackboardAttribute.Type getKeyAttribute() throws TskCoreException {
2008 if (shellBagKeyAttributeType == null) {
2010 shellBagKeyAttributeType = tskCase.getBlackboard().getOrAddAttributeType(SHELLBAG_ATTRIBUTE_KEY,
2011 BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING,
2012 Bundle.Shellbag_Key_Attribute_Display_Name());
2013 }
catch (BlackboardException ex) {
2014 throw new TskCoreException(String.format(
"Failed to get key attribute %s", SHELLBAG_ATTRIBUTE_KEY), ex);
2017 return shellBagKeyAttributeType;
2029 Map<String, List<String>> readGroups(BufferedReader bufferedReader)
throws IOException {
2030 Map<String, List<String>> groupMap =
new HashMap<>();
2032 String line = bufferedReader.readLine();
2035 String groupName = null;
2037 while (line != null && !line.contains(SECTION_DIVIDER)) {
2039 if (line.contains(
"Group Name")) {
2040 String value = line.replaceAll(
"Group Name\\s*?:",
"").trim();
2041 groupName = (value.replaceAll(
"\\[\\d*?\\]",
"")).trim();
2042 int startIndex = value.indexOf(
" [") + 1;
2043 int endIndex = value.indexOf(
']');
2045 if (startIndex != -1 && endIndex != -1) {
2046 String countStr = value.substring(startIndex + 1, endIndex);
2047 userCount = Integer.parseInt(countStr);
2049 }
else if (line.matches(
"Users\\s*?:")) {
2050 for (
int i = 0; i < userCount; i++) {
2051 line = bufferedReader.readLine();
2053 String sid = line.trim();
2054 List<String> groupList = groupMap.get(sid);
2055 if (groupList == null) {
2056 groupList =
new ArrayList<>();
2057 groupMap.put(sid, groupList);
2059 groupList.add(groupName);
2064 line = bufferedReader.readLine();
2077 private Map.Entry<String, String> getSAMKeyValue(String line) {
2078 int index = line.indexOf(
':');
2079 Map.Entry<String, String> returnValue = null;
2081 String value = null;
2084 key = line.substring(0, index).trim();
2085 if (index + 1 < line.length()) {
2086 value = line.substring(index + 1).trim();
2091 }
else if (line.contains(
"-->")) {
2092 key = line.replace(
"-->",
"").trim();
2097 returnValue =
new AbstractMap.SimpleEntry<>(key, value);
2104 public void process(Content dataSource, IngestJobContext context, DataSourceIngestModuleProgress progressBar) {
2105 this.dataSource = dataSource;
2106 this.context = context;
2108 progressBar.progress(Bundle.Progress_Message_Analyze_Registry());
2109 analyzeRegistryFiles();
2118 public String autopsyPlugins =
"";
2119 public String fullPlugins =
"";
synchronized List< AbstractFile > findFiles(String fileName)