mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Normalize file path names.
normalize path names with unix/linux format instead of windows in Recent Documents by LNK and Recent Doc MRU's
This commit is contained in:
parent
a97f29b1fa
commit
492382ea74
@ -66,6 +66,7 @@ import java.util.Set;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import static java.util.Locale.US;
|
import static java.util.Locale.US;
|
||||||
import static java.util.TimeZone.getTimeZone;
|
import static java.util.TimeZone.getTimeZone;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.openide.util.Lookup;
|
import org.openide.util.Lookup;
|
||||||
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
|
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException;
|
import org.sleuthkit.autopsy.ingest.IngestModule.IngestModuleException;
|
||||||
@ -1229,6 +1230,7 @@ class ExtractRegistry extends Extract {
|
|||||||
if (fileName.charAt(0) == '/') {
|
if (fileName.charAt(0) == '/') {
|
||||||
fileName = fileName.substring(1,fileName.length() - 1);
|
fileName = fileName.substring(1,fileName.length() - 1);
|
||||||
fileName = fileName.replaceFirst("/", ":/");
|
fileName = fileName.replaceFirst("/", ":/");
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
}
|
}
|
||||||
// Check to see if more then 2 tokens, Date may not be populated, will default to 0
|
// Check to see if more then 2 tokens, Date may not be populated, will default to 0
|
||||||
if (tokens.length > 2) {
|
if (tokens.length > 2) {
|
||||||
@ -1285,6 +1287,7 @@ class ExtractRegistry extends Extract {
|
|||||||
// Split line on "> " which is the record delimiter between position and file
|
// Split line on "> " which is the record delimiter between position and file
|
||||||
String tokens[] = line.split("> ");
|
String tokens[] = line.split("> ");
|
||||||
String fileName = tokens[1];
|
String fileName = tokens[1];
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||||
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
||||||
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
||||||
@ -1326,6 +1329,7 @@ class ExtractRegistry extends Extract {
|
|||||||
// Split line on "> " which is the record delimiter between position and file
|
// Split line on "> " which is the record delimiter between position and file
|
||||||
String tokens[] = line.split("> ");
|
String tokens[] = line.split("> ");
|
||||||
String fileName = tokens[1];
|
String fileName = tokens[1];
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||||
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
||||||
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
||||||
@ -1368,6 +1372,7 @@ class ExtractRegistry extends Extract {
|
|||||||
// Split line on "> " which is the record delimiter between position and file
|
// Split line on "> " which is the record delimiter between position and file
|
||||||
String tokens[] = line.split("> ");
|
String tokens[] = line.split("> ");
|
||||||
String fileName = tokens[1];
|
String fileName = tokens[1];
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||||
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
||||||
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
||||||
@ -1405,6 +1410,7 @@ class ExtractRegistry extends Extract {
|
|||||||
// Columns are
|
// Columns are
|
||||||
// <fileName>
|
// <fileName>
|
||||||
String fileName = line;
|
String fileName = line;
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||||
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
||||||
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_RECENT_OBJECT, regFile, attributes);
|
||||||
@ -1448,6 +1454,7 @@ class ExtractRegistry extends Extract {
|
|||||||
Long docDate = Long.valueOf(tokens[0]);
|
Long docDate = Long.valueOf(tokens[0]);
|
||||||
String fileNameTokens[] = tokens[4].split(" - ");
|
String fileNameTokens[] = tokens[4].split(" - ");
|
||||||
String fileName = fileNameTokens[1];
|
String fileName = fileNameTokens[1];
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
Collection<BlackboardAttribute> attributes = new ArrayList<>();
|
||||||
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
attributes.add(new BlackboardAttribute(TSK_PATH, getName(), fileName));
|
||||||
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, getName(), docDate));
|
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME, getName(), docDate));
|
||||||
@ -1494,6 +1501,7 @@ class ExtractRegistry extends Extract {
|
|||||||
String tokens[] = line.split(" : ");
|
String tokens[] = line.split(" : ");
|
||||||
fileName = tokens[1];
|
fileName = tokens[1];
|
||||||
fileName = fileName.replace("%USERPROFILE%", userProfile);
|
fileName = fileName.replace("%USERPROFILE%", userProfile);
|
||||||
|
fileName = FilenameUtils.normalize(fileName, true);
|
||||||
// Time in the format of Wed May 31 14:33:03 2017 Z
|
// Time in the format of Wed May 31 14:33:03 2017 Z
|
||||||
try {
|
try {
|
||||||
String fileUsedTime = tokens[0].replaceAll(" Z","");
|
String fileUsedTime = tokens[0].replaceAll(" Z","");
|
||||||
|
@ -29,6 +29,7 @@ import java.util.logging.Level;
|
|||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.autopsy.coreutils.JLNK;
|
import org.sleuthkit.autopsy.coreutils.JLNK;
|
||||||
import org.sleuthkit.autopsy.coreutils.JLnkParser;
|
import org.sleuthkit.autopsy.coreutils.JLnkParser;
|
||||||
@ -107,7 +108,7 @@ class RecentDocumentsByLnk extends Extract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
|
Collection<BlackboardAttribute> bbattributes = new ArrayList<>();
|
||||||
String path = lnk.getBestPath();
|
String path = FilenameUtils.normalize(lnk.getBestPath(), true);
|
||||||
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
|
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"RecentDocumentsByLnk.parentModuleName.noSpace"),
|
"RecentDocumentsByLnk.parentModuleName.noSpace"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user