Use getAllArtifacts() and added a null check.

This commit is contained in:
Samuel H. Kenyon 2013-12-01 19:24:05 -05:00
parent 97c8791c87
commit b423d0038a

View File

@ -154,14 +154,18 @@ 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) {
@ -176,6 +180,7 @@ public class FileExtMismatchIngestModule extends org.sleuthkit.autopsy.ingest.In
} }
} }
} }
}
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);
} }