mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-20 03:24:55 +00:00
Use getAllArtifacts() and added a null check.
This commit is contained in:
parent
97c8791c87
commit
b423d0038a
@ -154,23 +154,28 @@ public class FileExtMismatchIngestModule extends org.sleuthkit.autopsy.ingest.In
|
|||||||
String extStr = abstractFile.getName().substring(i + 1);
|
String extStr = abstractFile.getName().substring(i + 1);
|
||||||
|
|
||||||
// find file_sig value.
|
// find file_sig value.
|
||||||
ArrayList<BlackboardArtifact> artList = abstractFile.getArtifacts(ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID());
|
// getArtifacts by type doesn't seem to work, so get all artifacts
|
||||||
|
ArrayList<BlackboardArtifact> artList = abstractFile.getAllArtifacts();
|
||||||
|
|
||||||
for (BlackboardArtifact art : artList) {
|
for (BlackboardArtifact art : artList) {
|
||||||
List<BlackboardAttribute> atrList = art.getAttributes();
|
List<BlackboardAttribute> atrList = art.getAttributes();
|
||||||
for (BlackboardAttribute att : atrList) {
|
for (BlackboardAttribute att : atrList) {
|
||||||
if (att.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG.getTypeID()) {
|
if (att.getAttributeTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG.getTypeID()) {
|
||||||
|
|
||||||
//get known allowed values from the map for this type
|
//get known allowed values from the map for this type
|
||||||
List<String> allowedExtList = Arrays.asList(SigTypeToExtMap.get(att.getValueString()));
|
String[] slist = SigTypeToExtMap.get(att.getValueString());
|
||||||
|
if (slist != null) {
|
||||||
|
List<String> allowedExtList = Arrays.asList(slist);
|
||||||
|
|
||||||
// see if the filename ext is in the allowed list
|
// see if the filename ext is in the allowed list
|
||||||
if (allowedExtList != null) {
|
if (allowedExtList != null) {
|
||||||
for (String e : allowedExtList) {
|
for (String e : allowedExtList) {
|
||||||
if (e.equals(extStr)) {
|
if (e.equals(extStr)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return true; //potential mismatch
|
||||||
}
|
}
|
||||||
return true; //potential mismatch
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user