mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Additions to the mboxparser/MboxFileIngestService.java class with some preliminary logic
This commit is contained in:
parent
caa565da66
commit
a17fbe6fef
@ -1,6 +1,3 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
@ -20,15 +17,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.mboxparser;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.tika.exception.TikaException;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManagerProxy;
|
||||
import org.sleuthkit.autopsy.ingest.IngestMessage;
|
||||
import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType;
|
||||
import org.sleuthkit.autopsy.ingest.IngestServiceAbstract.*;
|
||||
import org.sleuthkit.autopsy.ingest.IngestServiceAbstractFile;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
|
||||
import org.sleuthkit.datamodel.ReadContentInputStream;
|
||||
import org.sleuthkit.datamodel.TskException;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class MboxFileIngestService implements IngestServiceAbstractFile {
|
||||
|
||||
@ -47,17 +50,37 @@ public class MboxFileIngestService implements IngestServiceAbstractFile {
|
||||
@Override
|
||||
public ProcessResult process(AbstractFile fsContent) {
|
||||
managerProxy.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "Processing " + fsContent.getName()));
|
||||
MboxEmailParser mbox = new MboxEmailParser();
|
||||
boolean isMbox = false;
|
||||
|
||||
//service specific AbstractFile processing code here
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
byte[] t = new byte[(int) 128];
|
||||
int byteRead = fsContent.read(t, 0, 128);
|
||||
isMbox = mbox.detectMediaTypeFromBytes(t, fsContent.getName());
|
||||
} catch (TskException ex) {
|
||||
Logger.getLogger(MboxFileIngestService.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return ProcessResult.OK;
|
||||
|
||||
if (isMbox) {
|
||||
try {
|
||||
ReadContentInputStream contentStream = new ReadContentInputStream(fsContent);
|
||||
mbox.parse(contentStream);
|
||||
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(MboxFileIngestService.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MboxFileIngestService.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (SAXException ex) {
|
||||
Logger.getLogger(MboxFileIngestService.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (TikaException ex) {
|
||||
Logger.getLogger(MboxFileIngestService.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
return ProcessResult.OK ;
|
||||
}
|
||||
@Override
|
||||
public void complete() {
|
||||
logger.log(Level.INFO, "complete()");
|
||||
managerProxy.postMessage(IngestMessage.createMessage(++messageId, MessageType.INFO, this, "COMPLETE"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user