mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Better deal with write failures in RecentActivity. Use more specialized temp/output folders
This commit is contained in:
parent
87f68da53c
commit
f1aa4441fe
@ -113,7 +113,7 @@ public class Chrome extends Extract {
|
||||
|
||||
int j = 0;
|
||||
while (j < historyFiles.size()) {
|
||||
String temps = currentCase.getTempDirectory() + File.separator + historyFiles.get(j).getName().toString() + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + historyFiles.get(j).getName().toString() + j + ".db";
|
||||
int errors = 0;
|
||||
final AbstractFile historyFile = historyFiles.get(j++);
|
||||
if (historyFile.getSize() == 0) {
|
||||
@ -124,6 +124,7 @@ public class Chrome extends Extract {
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome web history artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + historyFile.getName());
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
@ -172,13 +173,14 @@ public class Chrome extends Extract {
|
||||
if (bookmarkFiles != null && !bookmarkFiles.isEmpty()) {
|
||||
while (j < bookmarkFiles.size()) {
|
||||
AbstractFile bookmarkFile = bookmarkFiles.get(j++);
|
||||
String temps = currentCase.getTempDirectory() + File.separator + bookmarkFile.getName().toString() + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + bookmarkFile.getName().toString() + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(bookmarkFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome bookmark artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + bookmarkFile.getName());
|
||||
continue;
|
||||
}
|
||||
logger.log(Level.INFO, moduleName + "- Now getting Bookmarks from " + temps);
|
||||
File dbFile = new File(temps);
|
||||
@ -270,13 +272,14 @@ public class Chrome extends Extract {
|
||||
if (cookiesFiles != null && !cookiesFiles.isEmpty()) {
|
||||
while (j < cookiesFiles.size()) {
|
||||
AbstractFile cookiesFile = cookiesFiles.get(j++);
|
||||
String temps = currentCase.getTempDirectory() + File.separator + cookiesFile.getName().toString() + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + cookiesFile.getName().toString() + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(cookiesFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome cookie artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + cookiesFile.getName());
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
@ -333,13 +336,14 @@ public class Chrome extends Extract {
|
||||
if (historyFile.getSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
String temps = currentCase.getTempDirectory() + File.separator + historyFile.getName().toString() + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + historyFile.getName().toString() + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(historyFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome download artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + historyFile.getName());
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
@ -394,13 +398,14 @@ public class Chrome extends Extract {
|
||||
if (signonFiles != null && !signonFiles.isEmpty()) {
|
||||
while (j < signonFiles.size()) {
|
||||
AbstractFile signonFile = signonFiles.get(j++);
|
||||
String temps = currentCase.getTempDirectory() + File.separator + signonFile.getName().toString() + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "chrome") + File.separator + signonFile.getName().toString() + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(signonFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing temp sqlite db for Chrome login artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + signonFile.getName());
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
|
@ -282,7 +282,7 @@ public class ExtractIE extends Extract {
|
||||
currentCase = Case.getCurrentCase();
|
||||
tskCase = currentCase.getSleuthkitCase();
|
||||
|
||||
PASCO_RESULTS_PATH = Case.getCurrentCase().getTempDirectory() + File.separator + "results";
|
||||
PASCO_RESULTS_PATH = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "IE") + File.separator + "results";
|
||||
JAVA_PATH = PlatformUtil.getJavaPath();
|
||||
pascoResults = new ArrayList<String>();
|
||||
|
||||
@ -326,7 +326,7 @@ public class ExtractIE extends Extract {
|
||||
//BlackboardArtifact bbart = fsc.newArtifact(ARTIFACT_TYPE.TSK_WEB_HISTORY);
|
||||
indexFileName = "index" + Integer.toString((int) indexFile.getId()) + ".dat";
|
||||
//indexFileName = "index" + Long.toString(bbart.getArtifactID()) + ".dat";
|
||||
temps = currentCase.getTempDirectory() + File.separator + indexFileName;
|
||||
temps = RAImageIngestModule.getRATempPath(currentCase, "IE") + File.separator + indexFileName;
|
||||
File datFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
datFile.delete();
|
||||
@ -336,6 +336,8 @@ public class ExtractIE extends Extract {
|
||||
ContentUtils.writeToFile(indexFile, datFile);
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.SEVERE, "Error while trying to write index.dat file " + datFile.getAbsolutePath(), e);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to write file:" + datFile.getAbsolutePath());
|
||||
continue;
|
||||
}
|
||||
|
||||
String filename = "pasco2Result." + indexFile.getId() + ".txt";
|
||||
|
@ -139,7 +139,7 @@ public class ExtractRegistry extends Extract {
|
||||
ExtractUSB extrctr = new ExtractUSB();
|
||||
FileWriter logFile = null;
|
||||
try {
|
||||
logFile = new FileWriter(RAImageIngestModule.getRAOutputPath(currentCase) + File.separator + "regripper-info.txt");
|
||||
logFile = new FileWriter(RAImageIngestModule.getRAOutputPath(currentCase, "reg") + File.separator + "regripper-info.txt");
|
||||
} catch (IOException ex) {
|
||||
java.util.logging.Logger.getLogger(ExtractRegistry.class.getName()).log(Level.SEVERE, null, ex);
|
||||
logFile = null;
|
||||
@ -148,8 +148,8 @@ public class ExtractRegistry extends Extract {
|
||||
int j = 0;
|
||||
for (AbstractFile regFile : allRegistryFiles) {
|
||||
String regFileName = regFile.getName();
|
||||
String regFileNameLocal = RAImageIngestModule.getRATempPath(currentCase) + File.separator + regFileName;
|
||||
String outputPathBase = RAImageIngestModule.getRAOutputPath(currentCase) + File.separator + regFileName + "-regripper-" + Integer.toString(j++);
|
||||
String regFileNameLocal = RAImageIngestModule.getRATempPath(currentCase, "reg") + File.separator + regFileName;
|
||||
String outputPathBase = RAImageIngestModule.getRAOutputPath(currentCase, "reg") + File.separator + regFileName + "-regripper-" + Integer.toString(j++);
|
||||
File regFileNameLocalFile = new File(regFileNameLocal);
|
||||
try {
|
||||
ContentUtils.writeToFile(regFile, regFileNameLocalFile);
|
||||
|
@ -100,13 +100,14 @@ public class Firefox extends Extract {
|
||||
int j = 0;
|
||||
for (AbstractFile historyFile : historyFiles) {
|
||||
String fileName = historyFile.getName();
|
||||
String temps = currentCase.getTempDirectory() + File.separator + fileName + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(historyFile, new File(currentCase.getTempDirectory() + File.separator + fileName + j + ".db"));
|
||||
ContentUtils.writeToFile(historyFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing the sqlite db for firefox web history artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + fileName);
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
@ -156,13 +157,14 @@ public class Firefox extends Extract {
|
||||
int j = 0;
|
||||
for (AbstractFile bookmarkFile : bookmarkFiles) {
|
||||
String fileName = bookmarkFile.getName();
|
||||
String temps = currentCase.getTempDirectory() + File.separator + fileName + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(bookmarkFile, new File(currentCase.getTempDirectory() + File.separator + fileName + j + ".db"));
|
||||
ContentUtils.writeToFile(bookmarkFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing the sqlite db for firefox bookmark artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + fileName);
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
@ -211,13 +213,14 @@ public class Firefox extends Extract {
|
||||
int j = 0;
|
||||
for (AbstractFile cookiesFile : cookiesFiles) {
|
||||
String fileName = cookiesFile.getName();
|
||||
String temps = currentCase.getTempDirectory() + File.separator + fileName + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(cookiesFile, new File(currentCase.getTempDirectory() + File.separator + fileName + j + ".db"));
|
||||
ContentUtils.writeToFile(cookiesFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing the sqlite db for firefox cookie artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + fileName);
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
@ -287,13 +290,14 @@ public class Firefox extends Extract {
|
||||
int j = 0;
|
||||
for (AbstractFile downloadsFile : downloadsFiles) {
|
||||
String fileName = downloadsFile.getName();
|
||||
String temps = currentCase.getTempDirectory() + File.separator + fileName + j + ".db";
|
||||
String temps = RAImageIngestModule.getRATempPath(currentCase, "firefox") + File.separator + fileName + j + ".db";
|
||||
int errors = 0;
|
||||
try {
|
||||
ContentUtils.writeToFile(downloadsFile, new File(currentCase.getTempDirectory() + File.separator + fileName + j + ".db"));
|
||||
ContentUtils.writeToFile(downloadsFile, new File(temps));
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error writing the sqlite db for firefox download artifacts.{0}", ex);
|
||||
this.addErrorMessage(this.getName() + ": Error while trying to analyze file:" + fileName);
|
||||
continue;
|
||||
}
|
||||
File dbFile = new File(temps);
|
||||
if (controller.isCancelled()) {
|
||||
|
@ -183,8 +183,14 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static String getRATempPath(Case a_case) {
|
||||
String tmpDir = a_case.getTempDirectory() + File.separator + "RecentActivity" + File.separator;
|
||||
/**
|
||||
* Get the temp path for a specific sub-module in recent activity. Will create the dir if it doesn't exist.
|
||||
* @param a_case Case that directory is for
|
||||
* @param mod Module name that will be used for a sub folder in the temp folder to prevent name collisions
|
||||
* @return Path to directory
|
||||
*/
|
||||
protected static String getRATempPath(Case a_case, String mod) {
|
||||
String tmpDir = a_case.getTempDirectory() + File.separator + "RecentActivity" + File.separator + mod;
|
||||
File dir = new File(tmpDir);
|
||||
if (dir.exists() == false) {
|
||||
dir.mkdirs();
|
||||
@ -192,8 +198,14 @@ public final class RAImageIngestModule extends IngestModuleDataSource {
|
||||
return tmpDir;
|
||||
}
|
||||
|
||||
protected static String getRAOutputPath(Case a_case) {
|
||||
String tmpDir = a_case.getModulesOutputDirAbsPath() + File.separator + "RecentActivity" + File.separator;
|
||||
/**
|
||||
* Get the output path for a specific sub-module in recent activity. Will create the dir if it doesn't exist.
|
||||
* @param a_case Case that directory is for
|
||||
* @param mod Module name that will be used for a sub folder in the temp folder to prevent name collisions
|
||||
* @return Path to directory
|
||||
*/
|
||||
protected static String getRAOutputPath(Case a_case, String mod) {
|
||||
String tmpDir = a_case.getModulesOutputDirAbsPath() + File.separator + "RecentActivity" + File.separator + mod;
|
||||
File dir = new File(tmpDir);
|
||||
if (dir.exists() == false) {
|
||||
dir.mkdirs();
|
||||
|
Loading…
x
Reference in New Issue
Block a user