mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Merge pull request #680 from mrtizmo/thunderbird
ThunderbirdParser - added NON-NLS tags
This commit is contained in:
commit
16f081ea8e
@ -71,7 +71,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
/**
|
/**
|
||||||
* The mime type string for html text.
|
* The mime type string for html text.
|
||||||
*/
|
*/
|
||||||
private static final String HTML_TYPE = "text/html";
|
private static final String HTML_TYPE = "text/html"; //NON-NLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The local path of the mbox file.
|
* The local path of the mbox file.
|
||||||
@ -89,7 +89,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static boolean isValidMimeTypeMbox(byte[] buffer) {
|
static boolean isValidMimeTypeMbox(byte[] buffer) {
|
||||||
return (new String(buffer)).startsWith("From ");
|
return (new String(buffer)).startsWith("From "); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +115,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// Not the right encoder
|
// Not the right encoder
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, "couldn't find mbox file.", ex);
|
logger.log(Level.WARNING, "couldn't find mbox file.", ex); //NON-NLS
|
||||||
addErrorMessage(NbBundle.getMessage(this.getClass(), "MboxParser.parse.errMsg.failedToReadFile"));
|
addErrorMessage(NbBundle.getMessage(this.getClass(), "MboxParser.parse.errMsg.failedToReadFile"));
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
Message msg = messageBuilder.parseMessage(message.asInputStream(theEncoder.charset()));
|
Message msg = messageBuilder.parseMessage(message.asInputStream(theEncoder.charset()));
|
||||||
emails.add(extractEmail(msg));
|
emails.add(extractEmail(msg));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, "Failed to get message from mbox: {0}", ex.getMessage());
|
logger.log(Level.WARNING, "Failed to get message from mbox: {0}", ex.getMessage()); //NON-NLS
|
||||||
failCount++;
|
failCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, "Error getting text body of mbox message", ex);
|
logger.log(Level.WARNING, "Error getting text body of mbox message", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
addErrorMessage(
|
addErrorMessage(
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"MboxParser.handleAttch.errMsg.failedToCreateOnDisk", filename));
|
"MboxParser.handleAttch.errMsg.failedToCreateOnDisk", filename));
|
||||||
logger.log(Level.INFO, "Failed to create file output stream for: " + outPath, ex);
|
logger.log(Level.INFO, "Failed to create file output stream for: " + outPath, ex); //NON-NLS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,14 +272,14 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
// This could potentially be other types. Only seen this once.
|
// This could potentially be other types. Only seen this once.
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.INFO, "Failed to write mbox email attachment to disk.", ex);
|
logger.log(Level.INFO, "Failed to write mbox email attachment to disk.", ex); //NON-NLS
|
||||||
addErrorMessage(NbBundle.getMessage(this.getClass(), "MboxParser.handleAttch.failedWriteToDisk", filename));
|
addErrorMessage(NbBundle.getMessage(this.getClass(), "MboxParser.handleAttch.failedWriteToDisk", filename));
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
fos.close();
|
fos.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.INFO, "Failed to close file output stream", ex);
|
logger.log(Level.INFO, "Failed to close file output stream", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
try {
|
try {
|
||||||
is = new BufferedInputStream(new FileInputStream(mboxFile));
|
is = new BufferedInputStream(new FileInputStream(mboxFile));
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
logger.log(Level.WARNING, "Failed to find mbox file while detecting charset");
|
logger.log(Level.WARNING, "Failed to find mbox file while detecting charset"); //NON-NLS
|
||||||
return possibleEncoders;
|
return possibleEncoders;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,18 +355,18 @@ import org.sleuthkit.autopsy.ingest.IngestServices;
|
|||||||
}
|
}
|
||||||
return possibleEncoders;
|
return possibleEncoders;
|
||||||
} catch (IOException | IllegalArgumentException ex) {
|
} catch (IOException | IllegalArgumentException ex) {
|
||||||
logger.log(Level.WARNING, "Failed to detect charset of mbox file.", ex);
|
logger.log(Level.WARNING, "Failed to detect charset of mbox file.", ex); //NON-NLS
|
||||||
return possibleEncoders;
|
return possibleEncoders;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
is.close();
|
is.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.INFO, "Failed to close input stream");
|
logger.log(Level.INFO, "Failed to close input stream"); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addErrorMessage(String msg) {
|
private void addErrorMessage(String msg) {
|
||||||
errors.append("<li>").append(msg).append("</li>");
|
errors.append("<li>").append(msg).append("</li>"); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,11 +88,11 @@ class PstParser {
|
|||||||
}
|
}
|
||||||
return ParseResult.OK;
|
return ParseResult.OK;
|
||||||
} catch (PSTException | IOException ex) {
|
} catch (PSTException | IOException ex) {
|
||||||
String msg = file.getName() + ": Failed to create internal java-libpst PST file to parse:\n" + ex.getMessage();
|
String msg = file.getName() + ": Failed to create internal java-libpst PST file to parse:\n" + ex.getMessage(); //NON-NLS
|
||||||
logger.log(Level.WARNING, msg);
|
logger.log(Level.WARNING, msg);
|
||||||
return ParseResult.ERROR;
|
return ParseResult.ERROR;
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
logger.log(Level.INFO, "Found encrypted PST file.");
|
logger.log(Level.INFO, "Found encrypted PST file."); //NON-NLS
|
||||||
return ParseResult.ENCRYPT;
|
return ParseResult.ENCRYPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ class PstParser {
|
|||||||
subFolders = folder.getSubFolders();
|
subFolders = folder.getSubFolders();
|
||||||
} catch (PSTException | IOException ex) {
|
} catch (PSTException | IOException ex) {
|
||||||
subFolders = new ArrayList<>();
|
subFolders = new ArrayList<>();
|
||||||
logger.log(Level.INFO, "java-libpst exception while getting subfolders: {0}", ex.getMessage());
|
logger.log(Level.INFO, "java-libpst exception while getting subfolders: {0}", ex.getMessage()); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PSTFolder f : subFolders) {
|
for (PSTFolder f : subFolders) {
|
||||||
@ -147,7 +147,7 @@ class PstParser {
|
|||||||
}
|
}
|
||||||
} catch (PSTException | IOException ex) {
|
} catch (PSTException | IOException ex) {
|
||||||
failCount++;
|
failCount++;
|
||||||
logger.log(Level.INFO, "java-libpst exception while getting emails from a folder: {0}", ex.getMessage());
|
logger.log(Level.INFO, "java-libpst exception while getting emails from a folder: {0}", ex.getMessage()); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ class PstParser {
|
|||||||
try {
|
try {
|
||||||
rtf = msg.getRTFBody();
|
rtf = msg.getRTFBody();
|
||||||
} catch (PSTException | IOException ex) {
|
} catch (PSTException | IOException ex) {
|
||||||
logger.log(Level.INFO, "Failed to get RTF content from pst email.");
|
logger.log(Level.INFO, "Failed to get RTF content from pst email."); //NON-NLS
|
||||||
}
|
}
|
||||||
email.setRtfBody(rtf);
|
email.setRtfBody(rtf);
|
||||||
email.setLocalPath(localPath);
|
email.setLocalPath(localPath);
|
||||||
@ -229,7 +229,7 @@ class PstParser {
|
|||||||
addErrorMessage(
|
addErrorMessage(
|
||||||
NbBundle.getMessage(this.getClass(), "PstParser.extractAttch.errMsg.failedToExtractToDisk",
|
NbBundle.getMessage(this.getClass(), "PstParser.extractAttch.errMsg.failedToExtractToDisk",
|
||||||
filename));
|
filename));
|
||||||
logger.log(Level.WARNING, "Failed to extract attachment from pst file.", ex);
|
logger.log(Level.WARNING, "Failed to extract attachment from pst file.", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,12 +294,12 @@ class PstParser {
|
|||||||
ByteBuffer bb = ByteBuffer.wrap(buffer);
|
ByteBuffer bb = ByteBuffer.wrap(buffer);
|
||||||
return bb.getInt() == PST_HEADER;
|
return bb.getInt() == PST_HEADER;
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.WARNING, "Exception while detecting if a file is a pst file.");
|
logger.log(Level.WARNING, "Exception while detecting if a file is a pst file."); //NON-NLS
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addErrorMessage(String msg) {
|
private void addErrorMessage(String msg) {
|
||||||
errors.append("<li>").append(msg).append("</li>");
|
errors.append("<li>").append(msg).append("</li>"); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
|
||||||
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
|
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
|
||||||
logger.log(Level.WARNING, "Not enough disk space to write file to disk.");
|
logger.log(Level.WARNING, "Not enough disk space to write file to disk."); //NON-NLS
|
||||||
IngestMessage msg = IngestMessage.createErrorMessage(EmailParserModuleFactory.getModuleName(), EmailParserModuleFactory.getModuleName(),
|
IngestMessage msg = IngestMessage.createErrorMessage(EmailParserModuleFactory.getModuleName(), EmailParserModuleFactory.getModuleName(),
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"ThunderbirdMboxFileIngestModule.processPst.errMsg.outOfDiskSpace",
|
"ThunderbirdMboxFileIngestModule.processPst.errMsg.outOfDiskSpace",
|
||||||
@ -132,7 +132,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
try {
|
try {
|
||||||
ContentUtils.writeToFile(abstractFile, file);
|
ContentUtils.writeToFile(abstractFile, file);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, "Failed writing pst file to disk.", ex);
|
logger.log(Level.WARNING, "Failed writing pst file to disk.", ex); //NON-NLS
|
||||||
return ProcessResult.OK;
|
return ProcessResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
EmailParserModuleFactory.getModuleName(),
|
EmailParserModuleFactory.getModuleName(),
|
||||||
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.encryptionFileLevel")));
|
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.encryptionFileLevel")));
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.INFO, "Failed to add encryption attribute to file: {0}", abstractFile.getName());
|
logger.log(Level.INFO, "Failed to add encryption attribute to file: {0}", abstractFile.getName()); //NON-NLS
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// parsing error: log message
|
// parsing error: log message
|
||||||
@ -159,12 +159,12 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
abstractFile.getName()),
|
abstractFile.getName()),
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"ThunderbirdMboxFileIngestModule.processPst.errProcFile.details"));
|
"ThunderbirdMboxFileIngestModule.processPst.errProcFile.details"));
|
||||||
logger.log(Level.INFO, "PSTParser failed to parse {0}", abstractFile.getName());
|
logger.log(Level.INFO, "PSTParser failed to parse {0}", abstractFile.getName()); //NON-NLS
|
||||||
return ProcessResult.ERROR;
|
return ProcessResult.ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.delete() == false) {
|
if (file.delete() == false) {
|
||||||
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName());
|
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName()); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
String errors = parser.getErrors();
|
String errors = parser.getErrors();
|
||||||
@ -190,20 +190,20 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
// use the local path to determine the e-mail folder structure
|
// use the local path to determine the e-mail folder structure
|
||||||
String emailFolder = "";
|
String emailFolder = "";
|
||||||
// email folder is everything after "Mail" or ImapMail
|
// email folder is everything after "Mail" or ImapMail
|
||||||
if (mboxParentDir.contains("/Mail/")) {
|
if (mboxParentDir.contains("/Mail/")) { //NON-NLS
|
||||||
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/Mail/") + 5);
|
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/Mail/") + 5); //NON-NLS
|
||||||
} else if (mboxParentDir.contains("/ImapMail/")) {
|
} else if (mboxParentDir.contains("/ImapMail/")) { //NON-NLS
|
||||||
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/ImapMail/") + 9);
|
emailFolder = mboxParentDir.substring(mboxParentDir.indexOf("/ImapMail/") + 9); //NON-NLS
|
||||||
}
|
}
|
||||||
emailFolder = emailFolder + mboxFileName;
|
emailFolder = emailFolder + mboxFileName;
|
||||||
emailFolder = emailFolder.replaceAll(".sbd", "");
|
emailFolder = emailFolder.replaceAll(".sbd", ""); //NON-NLS
|
||||||
|
|
||||||
String fileName = getTempPath() + File.separator + abstractFile.getName()
|
String fileName = getTempPath() + File.separator + abstractFile.getName()
|
||||||
+ "-" + String.valueOf(abstractFile.getId());
|
+ "-" + String.valueOf(abstractFile.getId());
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
|
||||||
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
|
if (abstractFile.getSize() >= services.getFreeDiskSpace()) {
|
||||||
logger.log(Level.WARNING, "Not enough disk space to write file to disk.");
|
logger.log(Level.WARNING, "Not enough disk space to write file to disk."); //NON-NLS
|
||||||
postErrorMessage(
|
postErrorMessage(
|
||||||
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.processMBox.errProcFile.msg",
|
NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.processMBox.errProcFile.msg",
|
||||||
abstractFile.getName()),
|
abstractFile.getName()),
|
||||||
@ -215,7 +215,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
try {
|
try {
|
||||||
ContentUtils.writeToFile(abstractFile, file);
|
ContentUtils.writeToFile(abstractFile, file);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, "Failed writing mbox file to disk.", ex);
|
logger.log(Level.WARNING, "Failed writing mbox file to disk.", ex); //NON-NLS
|
||||||
return ProcessResult.OK;
|
return ProcessResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
processEmails(emails, abstractFile);
|
processEmails(emails, abstractFile);
|
||||||
|
|
||||||
if (file.delete() == false) {
|
if (file.delete() == false) {
|
||||||
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName());
|
logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName()); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
String errors = parser.getErrors();
|
String errors = parser.getErrors();
|
||||||
@ -245,7 +245,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
*/
|
*/
|
||||||
public static String getTempPath() {
|
public static String getTempPath() {
|
||||||
String tmpDir = Case.getCurrentCase().getTempDirectory() + File.separator
|
String tmpDir = Case.getCurrentCase().getTempDirectory() + File.separator
|
||||||
+ "EmailParser";
|
+ "EmailParser"; //NON-NLS
|
||||||
File dir = new File(tmpDir);
|
File dir = new File(tmpDir);
|
||||||
if (dir.exists() == false) {
|
if (dir.exists() == false) {
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
@ -383,7 +383,7 @@ public final class ThunderbirdMboxFileIngestModule extends IngestModuleAdapter i
|
|||||||
if (localPath.isEmpty() == false) {
|
if (localPath.isEmpty() == false) {
|
||||||
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), localPath));
|
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), localPath));
|
||||||
} else {
|
} else {
|
||||||
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), "/foo/bar"));
|
bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH.getTypeID(), EmailParserModuleFactory.getModuleName(), "/foo/bar")); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user