mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #7386 from rcordovano/develop
7673 Allow helpers to call correct Blackboard.postArtifacts() API - format file
This commit is contained in:
commit
aa783db66c
@ -108,10 +108,10 @@ public final class LeappFileProcessor {
|
|||||||
* Main constructor.
|
* Main constructor.
|
||||||
*
|
*
|
||||||
* @param attributeType The BlackboardAttribute type or null if not
|
* @param attributeType The BlackboardAttribute type or null if not
|
||||||
* used. used.
|
* used. used.
|
||||||
* @param columnName The name of the column in the tsv file.
|
* @param columnName The name of the column in the tsv file.
|
||||||
* @param required Whether or not this attribute is required to be
|
* @param required Whether or not this attribute is required to be
|
||||||
* present.
|
* present.
|
||||||
*/
|
*/
|
||||||
TsvColumn(BlackboardAttribute.Type attributeType, String columnName, boolean required) {
|
TsvColumn(BlackboardAttribute.Type attributeType, String columnName, boolean required) {
|
||||||
this.attributeType = attributeType;
|
this.attributeType = attributeType;
|
||||||
@ -218,7 +218,8 @@ public final class LeappFileProcessor {
|
|||||||
"LeappFileProcessor.has.run=Leapp",
|
"LeappFileProcessor.has.run=Leapp",
|
||||||
"LeappFileProcessor.Leapp.cancelled=Leapp run was canceled",
|
"LeappFileProcessor.Leapp.cancelled=Leapp run was canceled",
|
||||||
"LeappFileProcessor.completed=Leapp Processing Completed",
|
"LeappFileProcessor.completed=Leapp Processing Completed",
|
||||||
"LeappFileProcessor.error.reading.Leapp.directory=Error reading Leapp Output Directory"})
|
"LeappFileProcessor.error.reading.Leapp.directory=Error reading Leapp Output Directory"
|
||||||
|
})
|
||||||
public ProcessResult processFiles(Content dataSource, Path moduleOutputPath, AbstractFile LeappFile) {
|
public ProcessResult processFiles(Content dataSource, Path moduleOutputPath, AbstractFile LeappFile) {
|
||||||
try {
|
try {
|
||||||
List<String> LeappTsvOutputFiles = findTsvFiles(moduleOutputPath);
|
List<String> LeappTsvOutputFiles = findTsvFiles(moduleOutputPath);
|
||||||
@ -275,7 +276,7 @@ public final class LeappFileProcessor {
|
|||||||
* Process the Leapp files that were found that match the xml mapping file
|
* Process the Leapp files that were found that match the xml mapping file
|
||||||
*
|
*
|
||||||
* @param LeappFilesToProcess List of files to process
|
* @param LeappFilesToProcess List of files to process
|
||||||
* @param LeappImageFile Abstract file to create artifact for
|
* @param LeappImageFile Abstract file to create artifact for
|
||||||
*
|
*
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -308,7 +309,7 @@ public final class LeappFileProcessor {
|
|||||||
* Process the Leapp files that were found that match the xml mapping file
|
* Process the Leapp files that were found that match the xml mapping file
|
||||||
*
|
*
|
||||||
* @param LeappFilesToProcess List of files to process
|
* @param LeappFilesToProcess List of files to process
|
||||||
* @param dataSource The data source.
|
* @param dataSource The data source.
|
||||||
*
|
*
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -318,7 +319,7 @@ public final class LeappFileProcessor {
|
|||||||
|
|
||||||
for (String LeappFileName : LeappFilesToProcess) {
|
for (String LeappFileName : LeappFilesToProcess) {
|
||||||
String fileName = FilenameUtils.getName(LeappFileName);
|
String fileName = FilenameUtils.getName(LeappFileName);
|
||||||
File LeappFile = new File(LeappFileName);
|
File LeappFile = new File(LeappFileName);
|
||||||
if (tsvFileAttributes.containsKey(fileName)) {
|
if (tsvFileAttributes.containsKey(fileName)) {
|
||||||
List<TsvColumn> attrList = tsvFileAttributes.get(fileName);
|
List<TsvColumn> attrList = tsvFileAttributes.get(fileName);
|
||||||
BlackboardArtifact.Type artifactType = tsvFileArtifacts.get(fileName);
|
BlackboardArtifact.Type artifactType = tsvFileArtifacts.get(fileName);
|
||||||
@ -408,7 +409,7 @@ public final class LeappFileProcessor {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (ACCOUNT_RELATIONSHIPS.getOrDefault(fileName.toLowerCase(), "norelationship").toLowerCase() == "trackpoint") {
|
if (ACCOUNT_RELATIONSHIPS.getOrDefault(fileName.toLowerCase(), "norelationship").toLowerCase() == "trackpoint") {
|
||||||
(new GeoArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(), moduleName, "", geoAbstractFile)).addTrack(trackpointSegmentName, pointList, new ArrayList<>());
|
(new GeoArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(), moduleName, "", geoAbstractFile)).addTrack(trackpointSegmentName, pointList, new ArrayList<>());
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
||||||
@ -418,10 +419,9 @@ public final class LeappFileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.cannot.create.waypoint.relationship=Cannot create TSK_WAYPOINT artifact.",
|
"LeappFileProcessor.cannot.create.waypoint.relationship=Cannot create TSK_WAYPOINT artifact."
|
||||||
})
|
})
|
||||||
|
private void createRoute(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
||||||
private void createRoute (Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
|
||||||
|
|
||||||
Double startLatitude = Double.valueOf(0);
|
Double startLatitude = Double.valueOf(0);
|
||||||
Double startLongitude = Double.valueOf(0);
|
Double startLongitude = Double.valueOf(0);
|
||||||
@ -478,19 +478,17 @@ public final class LeappFileProcessor {
|
|||||||
GeoWaypoints waypointList = new GeoWaypoints();
|
GeoWaypoints waypointList = new GeoWaypoints();
|
||||||
waypointList.addPoint(new Waypoint(startLatitude, startLongitude, zeroValue, ""));
|
waypointList.addPoint(new Waypoint(startLatitude, startLongitude, zeroValue, ""));
|
||||||
waypointList.addPoint(new Waypoint(endLatitude, endLongitude, zeroValue, locationName));
|
waypointList.addPoint(new Waypoint(endLatitude, endLongitude, zeroValue, locationName));
|
||||||
(new GeoArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(), moduleName, comment, absFile)).addRoute(destinationName, dateTime, waypointList, new ArrayList<>());
|
(new GeoArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(), moduleName, comment, absFile)).addRoute(destinationName, dateTime, waypointList, new ArrayList<>());
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
||||||
throw new IngestModuleException(Bundle.LeappFileProcessor_cannot_create_waypoint_relationship() + ex.getLocalizedMessage(), ex); //NON-NLS
|
throw new IngestModuleException(Bundle.LeappFileProcessor_cannot_create_waypoint_relationship() + ex.getLocalizedMessage(), ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.cannot.create.trackpoint.relationship=Cannot create TSK_TRACK_POINT artifact.",
|
"LeappFileProcessor.cannot.create.trackpoint.relationship=Cannot create TSK_TRACK_POINT artifact."
|
||||||
})
|
})
|
||||||
|
|
||||||
private AbstractFile createTrackpoint(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName, String trackpointSegmentName, GeoTrackPoints pointList) throws IngestModuleException {
|
private AbstractFile createTrackpoint(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName, String trackpointSegmentName, GeoTrackPoints pointList) throws IngestModuleException {
|
||||||
|
|
||||||
Double latitude = Double.valueOf(0);
|
Double latitude = Double.valueOf(0);
|
||||||
@ -539,13 +537,13 @@ public final class LeappFileProcessor {
|
|||||||
absFile = (AbstractFile) dataSource;
|
absFile = (AbstractFile) dataSource;
|
||||||
}
|
}
|
||||||
if ((trackpointSegmentName == null) || (trackpointSegmentName == segmentName)) {
|
if ((trackpointSegmentName == null) || (trackpointSegmentName == segmentName)) {
|
||||||
trackpointSegmentName = segmentName;
|
trackpointSegmentName = segmentName;
|
||||||
pointList.addPoint(new TrackPoint(latitude, longitude, altitude, segmentName, zeroValue, zeroValue, zeroValue, dateTime));
|
pointList.addPoint(new TrackPoint(latitude, longitude, altitude, segmentName, zeroValue, zeroValue, zeroValue, dateTime));
|
||||||
} else {
|
} else {
|
||||||
(new GeoArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(), moduleName, comment, absFile)).addTrack(segmentName, pointList, new ArrayList<>());
|
(new GeoArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(), moduleName, comment, absFile)).addTrack(segmentName, pointList, new ArrayList<>());
|
||||||
trackpointSegmentName = segmentName;
|
trackpointSegmentName = segmentName;
|
||||||
pointList = new GeoTrackPoints();
|
pointList = new GeoTrackPoints();
|
||||||
pointList.addPoint(new TrackPoint(latitude, longitude, altitude, segmentName, zeroValue, zeroValue, zeroValue, dateTime));
|
pointList.addPoint(new TrackPoint(latitude, longitude, altitude, segmentName, zeroValue, zeroValue, zeroValue, dateTime));
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
||||||
@ -556,11 +554,9 @@ public final class LeappFileProcessor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.cannot.create.message.relationship=Cannot create TSK_MESSAGE Relationship.",
|
"LeappFileProcessor.cannot.create.message.relationship=Cannot create TSK_MESSAGE Relationship."
|
||||||
})
|
})
|
||||||
|
|
||||||
private void createMessageRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
private void createMessageRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
||||||
|
|
||||||
String messageType = null;
|
String messageType = null;
|
||||||
@ -614,7 +610,7 @@ public final class LeappFileProcessor {
|
|||||||
sourceFile = bba.getValueString();
|
sourceFile = bba.getValueString();
|
||||||
break;
|
break;
|
||||||
case "TSK_READ_STATUS":
|
case "TSK_READ_STATUS":
|
||||||
if (bba.getValueInt() == 1 ) {
|
if (bba.getValueInt() == 1) {
|
||||||
messageStatus = MessageReadStatus.READ;
|
messageStatus = MessageReadStatus.READ;
|
||||||
} else {
|
} else {
|
||||||
messageStatus = MessageReadStatus.UNREAD;
|
messageStatus = MessageReadStatus.UNREAD;
|
||||||
@ -640,17 +636,17 @@ public final class LeappFileProcessor {
|
|||||||
absFile = (AbstractFile) dataSource;
|
absFile = (AbstractFile) dataSource;
|
||||||
}
|
}
|
||||||
CommunicationArtifactsHelper accountArtifact;
|
CommunicationArtifactsHelper accountArtifact;
|
||||||
Account.Type accountType = getAccountType(fileName);
|
Account.Type accountType = getAccountType(fileName);
|
||||||
if (alternateId == null) {
|
if (alternateId == null) {
|
||||||
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
||||||
moduleName, absFile, accountType);
|
moduleName, absFile, accountType);
|
||||||
} else {
|
} else {
|
||||||
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
||||||
moduleName, absFile, accountType, accountType, alternateId);
|
moduleName, absFile, accountType, accountType, alternateId);
|
||||||
}
|
}
|
||||||
BlackboardArtifact messageArtifact = accountArtifact.addMessage(messageType, communicationDirection, senderId,
|
BlackboardArtifact messageArtifact = accountArtifact.addMessage(messageType, communicationDirection, senderId,
|
||||||
receipentId, dateTime, messageStatus, subject,
|
receipentId, dateTime, messageStatus, subject,
|
||||||
messageText, threadId, otherAttributes);
|
messageText, threadId, otherAttributes);
|
||||||
if (!fileAttachments.isEmpty()) {
|
if (!fileAttachments.isEmpty()) {
|
||||||
messageAttachments = new MessageAttachments(fileAttachments, new ArrayList<>());
|
messageAttachments = new MessageAttachments(fileAttachments, new ArrayList<>());
|
||||||
accountArtifact.addAttachments(messageArtifact, messageAttachments);
|
accountArtifact.addAttachments(messageArtifact, messageAttachments);
|
||||||
@ -662,7 +658,7 @@ public final class LeappFileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.cannot.create.contact.relationship=Cannot create TSK_CONTACT Relationship.",
|
"LeappFileProcessor.cannot.create.contact.relationship=Cannot create TSK_CONTACT Relationship."
|
||||||
})
|
})
|
||||||
private void createContactRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
private void createContactRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
||||||
|
|
||||||
@ -719,10 +715,10 @@ public final class LeappFileProcessor {
|
|||||||
CommunicationArtifactsHelper accountArtifact;
|
CommunicationArtifactsHelper accountArtifact;
|
||||||
if (alternateId == null) {
|
if (alternateId == null) {
|
||||||
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
||||||
moduleName, absFile, accountType);
|
moduleName, absFile, accountType);
|
||||||
} else {
|
} else {
|
||||||
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
||||||
moduleName, absFile, accountType, accountType, alternateId);
|
moduleName, absFile, accountType, accountType, alternateId);
|
||||||
}
|
}
|
||||||
BlackboardArtifact messageArtifact = accountArtifact.addContact(contactName, phoneNumber, homePhoneNumber, mobilePhoneNumber, emailAddr, otherAttributes);
|
BlackboardArtifact messageArtifact = accountArtifact.addContact(contactName, phoneNumber, homePhoneNumber, mobilePhoneNumber, emailAddr, otherAttributes);
|
||||||
}
|
}
|
||||||
@ -732,14 +728,13 @@ public final class LeappFileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.cannot.create.calllog.relationship=Cannot create TSK_CALLLOG Relationship.",
|
"LeappFileProcessor.cannot.create.calllog.relationship=Cannot create TSK_CALLLOG Relationship."
|
||||||
})
|
})
|
||||||
|
|
||||||
private void createCalllogRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
private void createCalllogRelationship(Collection<BlackboardAttribute> bbattributes, Content dataSource, String fileName) throws IngestModuleException {
|
||||||
|
|
||||||
String callerId = null;
|
String callerId = null;
|
||||||
String alternateId = null;
|
String alternateId = null;
|
||||||
List<String> calleeId = Arrays.asList();
|
List<String> calleeId = Arrays.asList();
|
||||||
CommunicationDirection communicationDirection = CommunicationDirection.UNKNOWN;
|
CommunicationDirection communicationDirection = CommunicationDirection.UNKNOWN;
|
||||||
Long startDateTime = Long.valueOf(0);
|
Long startDateTime = Long.valueOf(0);
|
||||||
Long endDateTime = Long.valueOf(0);
|
Long endDateTime = Long.valueOf(0);
|
||||||
@ -751,14 +746,14 @@ public final class LeappFileProcessor {
|
|||||||
for (BlackboardAttribute bba : bbattributes) {
|
for (BlackboardAttribute bba : bbattributes) {
|
||||||
switch (bba.getAttributeType().getTypeName()) {
|
switch (bba.getAttributeType().getTypeName()) {
|
||||||
case "TSK_TEXT_FILE":
|
case "TSK_TEXT_FILE":
|
||||||
sourceFile = bba.getValueString();
|
sourceFile = bba.getValueString();
|
||||||
break;
|
break;
|
||||||
case "TSK_DATETIME_START":
|
case "TSK_DATETIME_START":
|
||||||
startDateTime = bba.getValueLong();
|
startDateTime = bba.getValueLong();
|
||||||
break;
|
break;
|
||||||
case "TSK_DATETIME_END":
|
case "TSK_DATETIME_END":
|
||||||
startDateTime = bba.getValueLong();
|
startDateTime = bba.getValueLong();
|
||||||
break;
|
break;
|
||||||
case "TSK_DIRECTION":
|
case "TSK_DIRECTION":
|
||||||
if (bba.getValueString().toLowerCase().equals("outgoing")) {
|
if (bba.getValueString().toLowerCase().equals("outgoing")) {
|
||||||
communicationDirection = CommunicationDirection.OUTGOING;
|
communicationDirection = CommunicationDirection.OUTGOING;
|
||||||
@ -773,8 +768,8 @@ public final class LeappFileProcessor {
|
|||||||
break;
|
break;
|
||||||
case "TSK_PHONE_NUMBER_TO":
|
case "TSK_PHONE_NUMBER_TO":
|
||||||
if (!bba.getValueString().isEmpty()) {
|
if (!bba.getValueString().isEmpty()) {
|
||||||
String [] calleeTempList = bba.getValueString().split(",", 0);
|
String[] calleeTempList = bba.getValueString().split(",", 0);
|
||||||
calleeId = Arrays.asList(calleeTempList);
|
calleeId = Arrays.asList(calleeTempList);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "TSK_ID":
|
case "TSK_ID":
|
||||||
@ -788,8 +783,8 @@ public final class LeappFileProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (calleeId.isEmpty() && communicationDirection == CommunicationDirection.OUTGOING) {
|
if (calleeId.isEmpty() && communicationDirection == CommunicationDirection.OUTGOING) {
|
||||||
String [] calleeTempList = callerId.split(",", 0);
|
String[] calleeTempList = callerId.split(",", 0);
|
||||||
calleeId = Arrays.asList(calleeTempList);
|
calleeId = Arrays.asList(calleeTempList);
|
||||||
callerId = null;
|
callerId = null;
|
||||||
}
|
}
|
||||||
AbstractFile absFile = findAbstractFile(dataSource, sourceFile);
|
AbstractFile absFile = findAbstractFile(dataSource, sourceFile);
|
||||||
@ -800,10 +795,10 @@ public final class LeappFileProcessor {
|
|||||||
CommunicationArtifactsHelper accountArtifact;
|
CommunicationArtifactsHelper accountArtifact;
|
||||||
if (accountType != null) {
|
if (accountType != null) {
|
||||||
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
||||||
moduleName, absFile, accountType);
|
moduleName, absFile, accountType);
|
||||||
} else {
|
} else {
|
||||||
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
accountArtifact = new CommunicationArtifactsHelper(Case.getCurrentCaseThrows().getSleuthkitCase(),
|
||||||
moduleName, absFile, accountType, accountType, alternateId);
|
moduleName, absFile, accountType, accountType, alternateId);
|
||||||
}
|
}
|
||||||
BlackboardArtifact callLogArtifact = accountArtifact.addCalllog(communicationDirection, callerId, calleeId, startDateTime, endDateTime, mediaType, otherAttributes);
|
BlackboardArtifact callLogArtifact = accountArtifact.addCalllog(communicationDirection, callerId, calleeId, startDateTime, endDateTime, mediaType, otherAttributes);
|
||||||
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
} catch (NoCurrentCaseException | TskCoreException | BlackboardException ex) {
|
||||||
@ -884,16 +879,18 @@ public final class LeappFileProcessor {
|
|||||||
/**
|
/**
|
||||||
* Process the line read and create the necessary attributes for it.
|
* Process the line read and create the necessary attributes for it.
|
||||||
*
|
*
|
||||||
* @param lineValues List of column values.
|
* @param lineValues List of column values.
|
||||||
* @param columnIndexes Mapping of column headers (trimmed; to lower case)
|
* @param columnIndexes Mapping of column headers (trimmed; to lower case)
|
||||||
* to column index. All header columns and only all header columns should be
|
* to column index. All header columns and only all
|
||||||
* present.
|
* header columns should be present.
|
||||||
* @param attrList The list of attributes as specified for the schema of
|
* @param attrList The list of attributes as specified for the schema
|
||||||
* this file.
|
* of this file.
|
||||||
* @param fileName The name of the file being processed.
|
* @param fileName The name of the file being processed.
|
||||||
* @param lineNum The line number in the file.
|
* @param lineNum The line number in the file.
|
||||||
|
*
|
||||||
* @return The collection of blackboard attributes for the artifact created
|
* @return The collection of blackboard attributes for the artifact created
|
||||||
* from this line.
|
* from this line.
|
||||||
|
*
|
||||||
* @throws IngestModuleException
|
* @throws IngestModuleException
|
||||||
*/
|
*/
|
||||||
private Collection<BlackboardAttribute> processReadLine(List<String> lineValues, Map<String, Integer> columnIndexes,
|
private Collection<BlackboardAttribute> processReadLine(List<String> lineValues, Map<String, Integer> columnIndexes,
|
||||||
@ -949,9 +946,10 @@ public final class LeappFileProcessor {
|
|||||||
* Check type of attribute and possibly format string based on it.
|
* Check type of attribute and possibly format string based on it.
|
||||||
*
|
*
|
||||||
* @param colAttr Column Attribute information
|
* @param colAttr Column Attribute information
|
||||||
* @param value string to be formatted
|
* @param value string to be formatted
|
||||||
|
*
|
||||||
* @return formatted string based on attribute type if no attribute type
|
* @return formatted string based on attribute type if no attribute type
|
||||||
* found then return original string
|
* found then return original string
|
||||||
*/
|
*/
|
||||||
private String formatValueBasedOnAttrType(TsvColumn colAttr, String value) {
|
private String formatValueBasedOnAttrType(TsvColumn colAttr, String value) {
|
||||||
if (colAttr.getAttributeType().getTypeName().equals("TSK_DOMAIN")) {
|
if (colAttr.getAttributeType().getTypeName().equals("TSK_DOMAIN")) {
|
||||||
@ -971,9 +969,10 @@ public final class LeappFileProcessor {
|
|||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param attrType The attribute type.
|
* @param attrType The attribute type.
|
||||||
* @param value The string value to be converted to the appropriate data
|
* @param value The string value to be converted to the appropriate data
|
||||||
* type for the attribute type.
|
* type for the attribute type.
|
||||||
* @param fileName The file name that the value comes from.
|
* @param fileName The file name that the value comes from.
|
||||||
|
*
|
||||||
* @return The generated blackboard attribute.
|
* @return The generated blackboard attribute.
|
||||||
*/
|
*/
|
||||||
private BlackboardAttribute getAttribute(BlackboardAttribute.Type attrType, String value, String fileName) {
|
private BlackboardAttribute getAttribute(BlackboardAttribute.Type attrType, String value, String fileName) {
|
||||||
@ -1022,7 +1021,9 @@ public final class LeappFileProcessor {
|
|||||||
* Handles converting a string value to a blackboard attribute.
|
* Handles converting a string value to a blackboard attribute.
|
||||||
*
|
*
|
||||||
* @param orig The original string value.
|
* @param orig The original string value.
|
||||||
|
*
|
||||||
* @return The generated blackboard attribute.
|
* @return The generated blackboard attribute.
|
||||||
|
*
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
* @throws NumberFormatException
|
* @throws NumberFormatException
|
||||||
*/
|
*/
|
||||||
@ -1033,13 +1034,15 @@ public final class LeappFileProcessor {
|
|||||||
* Runs parsing function on string value to convert to right data type and
|
* Runs parsing function on string value to convert to right data type and
|
||||||
* generates a blackboard attribute for that converted data type.
|
* generates a blackboard attribute for that converted data type.
|
||||||
*
|
*
|
||||||
* @param value The string value.
|
* @param value The string value.
|
||||||
* @param attrType The blackboard attribute type.
|
* @param attrType The blackboard attribute type.
|
||||||
* @param fileName The name of the file from which the value comes.
|
* @param fileName The name of the file from which the value comes.
|
||||||
* @param blankIsNull If string is blank return null attribute.
|
* @param blankIsNull If string is blank return null attribute.
|
||||||
* @param zeroIsNull If string is some version of 0, return null attribute.
|
* @param zeroIsNull If string is some version of 0, return null
|
||||||
|
* attribute.
|
||||||
* @param valueConverter The means of converting the string value to an
|
* @param valueConverter The means of converting the string value to an
|
||||||
* appropriate blackboard attribute.
|
* appropriate blackboard attribute.
|
||||||
|
*
|
||||||
* @return The generated blackboard attribute or null if not determined.
|
* @return The generated blackboard attribute or null if not determined.
|
||||||
*/
|
*/
|
||||||
private BlackboardAttribute parseAttrValue(String value, BlackboardAttribute.Type attrType, String fileName, boolean blankIsNull, boolean zeroIsNull, ParseExceptionFunction valueConverter) {
|
private BlackboardAttribute parseAttrValue(String value, BlackboardAttribute.Type attrType, String fileName, boolean blankIsNull, boolean zeroIsNull, ParseExceptionFunction valueConverter) {
|
||||||
@ -1063,6 +1066,9 @@ public final class LeappFileProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the XML config file and load the mappings into maps
|
||||||
|
*/
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"LeappFileProcessor.cannot.load.artifact.xml=Cannot load xml artifact file.",
|
"LeappFileProcessor.cannot.load.artifact.xml=Cannot load xml artifact file.",
|
||||||
"LeappFileProcessor.cannotBuildXmlParser=Cannot buld an XML parser.",
|
"LeappFileProcessor.cannotBuildXmlParser=Cannot buld an XML parser.",
|
||||||
@ -1070,10 +1076,6 @@ public final class LeappFileProcessor {
|
|||||||
"LeappFileProcessor.postartifacts_error=Error posting Blackboard Artifact",
|
"LeappFileProcessor.postartifacts_error=Error posting Blackboard Artifact",
|
||||||
"LeappFileProcessor.error.creating.new.artifacts=Error creating new artifacts."
|
"LeappFileProcessor.error.creating.new.artifacts=Error creating new artifacts."
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* Read the XML config file and load the mappings into maps
|
|
||||||
*/
|
|
||||||
private void loadConfigFile() throws IngestModuleException {
|
private void loadConfigFile() throws IngestModuleException {
|
||||||
Document xmlinput;
|
Document xmlinput;
|
||||||
try {
|
try {
|
||||||
@ -1209,11 +1211,12 @@ public final class LeappFileProcessor {
|
|||||||
/**
|
/**
|
||||||
* Generic method for creating a blackboard artifact with attributes
|
* Generic method for creating a blackboard artifact with attributes
|
||||||
*
|
*
|
||||||
* @param artType The artifact type.
|
* @param artType The artifact type.
|
||||||
* @param dataSource is the Content object that needs to have the artifact
|
* @param dataSource is the Content object that needs to have the artifact
|
||||||
* added for it
|
* added for it
|
||||||
* @param bbattributes is the collection of blackboard attributes that need
|
* @param bbattributes is the collection of blackboard attributes that need
|
||||||
* to be added to the artifact after the artifact has been created
|
* to be added to the artifact after the artifact has
|
||||||
|
* been created
|
||||||
*
|
*
|
||||||
* @return The newly-created artifact, or null on error
|
* @return The newly-created artifact, or null on error
|
||||||
*/
|
*/
|
||||||
@ -1238,7 +1241,7 @@ public final class LeappFileProcessor {
|
|||||||
* Method to post a list of BlackboardArtifacts to the blackboard.
|
* Method to post a list of BlackboardArtifacts to the blackboard.
|
||||||
*
|
*
|
||||||
* @param artifacts A list of artifacts. IF list is empty or null, the
|
* @param artifacts A list of artifacts. IF list is empty or null, the
|
||||||
* function will return.
|
* function will return.
|
||||||
*/
|
*/
|
||||||
void postArtifacts(Collection<BlackboardArtifact> artifacts) {
|
void postArtifacts(Collection<BlackboardArtifact> artifacts) {
|
||||||
if (artifacts == null || artifacts.isEmpty()) {
|
if (artifacts == null || artifacts.isEmpty()) {
|
||||||
@ -1259,7 +1262,7 @@ public final class LeappFileProcessor {
|
|||||||
*/
|
*/
|
||||||
private void configExtractor() throws IOException {
|
private void configExtractor() throws IOException {
|
||||||
PlatformUtil.extractResourceToUserConfigDir(LeappFileProcessor.class,
|
PlatformUtil.extractResourceToUserConfigDir(LeappFileProcessor.class,
|
||||||
xmlFile, true);
|
xmlFile, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Set<String> ALLOWED_EXTENSIONS = new HashSet<>(Arrays.asList("zip", "tar", "tgz"));
|
private static final Set<String> ALLOWED_EXTENSIONS = new HashSet<>(Arrays.asList("zip", "tar", "tgz"));
|
||||||
@ -1347,4 +1350,4 @@ public final class LeappFileProcessor {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user