mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
updates to LeappFileProcessor
This commit is contained in:
parent
c0b053f512
commit
17365015f5
@ -220,6 +220,10 @@ public final class LeappFileProcessor {
|
|||||||
loadConfigFile();
|
loadConfigFile();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String normalizeKey(String origKey) {
|
||||||
|
return StringUtils.defaultString(origKey).trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.error.running.Leapp=Error running Leapp, see log file.",
|
"LeappFileProcessor.error.running.Leapp=Error running Leapp, see log file.",
|
||||||
@ -280,7 +284,7 @@ public final class LeappFileProcessor {
|
|||||||
.filter(f -> f.toLowerCase().endsWith(".tsv")).collect(Collectors.toList());
|
.filter(f -> f.toLowerCase().endsWith(".tsv")).collect(Collectors.toList());
|
||||||
|
|
||||||
for (String tsvFile : allTsvFiles) {
|
for (String tsvFile : allTsvFiles) {
|
||||||
if (tsvFiles.containsKey(FilenameUtils.getName(tsvFile.toLowerCase()))) {
|
if (tsvFiles.containsKey(normalizeKey(FilenameUtils.getName(tsvFile)))) {
|
||||||
foundTsvFiles.add(tsvFile);
|
foundTsvFiles.add(tsvFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,9 +333,10 @@ public final class LeappFileProcessor {
|
|||||||
progress.progress(Bundle.LeappFileProcessor_tsvProcessed(fileName), i);
|
progress.progress(Bundle.LeappFileProcessor_tsvProcessed(fileName), i);
|
||||||
|
|
||||||
File LeappFile = new File(LeappFileName);
|
File LeappFile = new File(LeappFileName);
|
||||||
if (tsvFileAttributes.containsKey(fileName)) {
|
String fileKey = fileName.toLowerCase().trim();
|
||||||
List<TsvColumn> attrList = tsvFileAttributes.get(fileName);
|
if (tsvFileAttributes.containsKey(normalizeKey(fileKey))) {
|
||||||
BlackboardArtifact.Type artifactType = tsvFileArtifacts.get(fileName);
|
List<TsvColumn> attrList = tsvFileAttributes.get(normalizeKey(fileKey));
|
||||||
|
BlackboardArtifact.Type artifactType = tsvFileArtifacts.get(normalizeKey(fileKey));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
processFile(LeappFile, attrList, fileName, artifactType, dataSource);
|
processFile(LeappFile, attrList, fileName, artifactType, dataSource);
|
||||||
@ -940,8 +945,8 @@ public final class LeappFileProcessor {
|
|||||||
attrsToRet.add(attr);
|
attrsToRet.add(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsvFileArtifactComments.containsKey(fileName)) {
|
if (tsvFileArtifactComments.containsKey(normalizeKey(fileName))) {
|
||||||
attrsToRet.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, moduleName, tsvFileArtifactComments.get(fileName)));
|
attrsToRet.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, moduleName, tsvFileArtifactComments.get(normalizeKey(fileName))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return attrsToRet;
|
return attrsToRet;
|
||||||
@ -1121,7 +1126,7 @@ public final class LeappFileProcessor {
|
|||||||
|
|
||||||
for (int i = 0; i < nlist.getLength(); i++) {
|
for (int i = 0; i < nlist.getLength(); i++) {
|
||||||
NamedNodeMap nnm = nlist.item(i).getAttributes();
|
NamedNodeMap nnm = nlist.item(i).getAttributes();
|
||||||
tsvFiles.put(nnm.getNamedItem("filename").getNodeValue().toLowerCase(), nnm.getNamedItem("description").getNodeValue());
|
tsvFiles.put(normalizeKey(nnm.getNamedItem("filename").getNodeValue()), nnm.getNamedItem("description").getNodeValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1147,11 +1152,11 @@ public final class LeappFileProcessor {
|
|||||||
logger.log(Level.SEVERE, String.format("No known artifact mapping found for [artifact: %s, %s]",
|
logger.log(Level.SEVERE, String.format("No known artifact mapping found for [artifact: %s, %s]",
|
||||||
artifactName, getXmlFileIdentifier(parentName)));
|
artifactName, getXmlFileIdentifier(parentName)));
|
||||||
} else {
|
} else {
|
||||||
tsvFileArtifacts.put(parentName, foundArtifactType);
|
tsvFileArtifacts.put(normalizeKey(parentName), foundArtifactType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!comment.toLowerCase().matches("null")) {
|
if (!comment.toLowerCase().matches("null")) {
|
||||||
tsvFileArtifactComments.put(parentName, comment);
|
tsvFileArtifactComments.put(normalizeKey(parentName), comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1213,14 +1218,14 @@ public final class LeappFileProcessor {
|
|||||||
columnName.trim().toLowerCase(),
|
columnName.trim().toLowerCase(),
|
||||||
"yes".compareToIgnoreCase(required) == 0);
|
"yes".compareToIgnoreCase(required) == 0);
|
||||||
|
|
||||||
if (tsvFileAttributes.containsKey(parentName)) {
|
if (tsvFileAttributes.containsKey(normalizeKey(parentName))) {
|
||||||
List<TsvColumn> attrList = tsvFileAttributes.get(parentName);
|
List<TsvColumn> attrList = tsvFileAttributes.get(normalizeKey(parentName));
|
||||||
attrList.add(thisCol);
|
attrList.add(thisCol);
|
||||||
tsvFileAttributes.replace(parentName, attrList);
|
tsvFileAttributes.replace(parentName, attrList);
|
||||||
} else {
|
} else {
|
||||||
List<TsvColumn> attrList = new ArrayList<>();
|
List<TsvColumn> attrList = new ArrayList<>();
|
||||||
attrList.add(thisCol);
|
attrList.add(thisCol);
|
||||||
tsvFileAttributes.put(parentName, attrList);
|
tsvFileAttributes.put(normalizeKey(parentName), attrList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user