Update ExtractSru.java

More codacy
This commit is contained in:
Mark McKinnon 2020-04-28 09:38:01 -04:00
parent 51eaee9c3e
commit e7edee6801

View File

@ -101,16 +101,13 @@ final class ExtractSru extends Extract {
this.context = context; this.context = context;
FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + "sru";
String modOutPath = Case.getCurrentCase().getModuleDirectory() + File.separator + "sru"; //NON-NLS
File dir = new File(modOutPath); File dir = new File(modOutPath);
if (dir.exists() == false) { if (dir.exists() == false) {
dir.mkdirs(); dir.mkdirs();
} }
String tempDirPath = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "sru"); //NON-NLS String tempDirPath = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "sru"); //NON-NLS
// String softwareHiveFileName = null;
String softwareHiveFileName = getSoftwareHiveFile(dataSource, tempDirPath); String softwareHiveFileName = getSoftwareHiveFile(dataSource, tempDirPath);
if (softwareHiveFileName == null) { if (softwareHiveFileName == null) {
@ -119,6 +116,7 @@ final class ExtractSru extends Extract {
List<AbstractFile> sruFiles; List<AbstractFile> sruFiles;
FileManager fileManager = Case.getCurrentCase().getServices().getFileManager();
try { try {
sruFiles = fileManager.findFiles(dataSource, "SRUDB.DAT"); //NON-NLS sruFiles = fileManager.findFiles(dataSource, "SRUDB.DAT"); //NON-NLS
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
@ -128,17 +126,13 @@ final class ExtractSru extends Extract {
} }
String sruFileName = null; String sruFileName = null;
String tempOutFile = null;
AbstractFile sruAbstractFile = null; AbstractFile sruAbstractFile = null;
String modOutFile = null;
for (AbstractFile sruFile : sruFiles) { for (AbstractFile sruFile : sruFiles) {
if (context.dataSourceIngestIsCancelled()) {
return;
}
sruFileName = tempDirPath + File.separator + sruFile.getId() + "_" + sruFile.getName(); sruFileName = tempDirPath + File.separator + sruFile.getId() + "_" + sruFile.getName();
tempOutFile = modOutPath + File.separator + sruFile.getId() + "_srudb.db3"; modOutFile = modOutPath + File.separator + sruFile.getId() + "_srudb.db3";
sruAbstractFile = sruFile; sruAbstractFile = sruFile;
try { try {
@ -168,10 +162,10 @@ final class ExtractSru extends Extract {
} }
try { try {
extractSruFiles(sruDumper, sruFileName, tempOutFile, tempDirPath, softwareHiveFileName); extractSruFiles(sruDumper, sruFileName, modOutFile, tempDirPath, softwareHiveFileName);
findSruExecutedFiles(tempOutFile, dataSource); findSruExecutedFiles(modOutFile, dataSource);
createNetUsageArtifacts(tempOutFile, sruAbstractFile); createNetUsageArtifacts(modOutFile, sruAbstractFile);
createAppUsageArtifacts(tempOutFile, sruAbstractFile); createAppUsageArtifacts(modOutFile, sruAbstractFile);
} catch (IOException ex) { } catch (IOException ex) {
this.addErrorMessage(Bundle.ExtractSru_process_error_executing_export_srudb_program()); this.addErrorMessage(Bundle.ExtractSru_process_error_executing_export_srudb_program());
logger.log(Level.SEVERE, "SRUDB.dat file not found"); //NON-NLS logger.log(Level.SEVERE, "SRUDB.dat file not found"); //NON-NLS
@ -208,10 +202,6 @@ final class ExtractSru extends Extract {
for (AbstractFile softwareFile : softwareHiveFiles) { for (AbstractFile softwareFile : softwareHiveFiles) {
if (context.dataSourceIngestIsCancelled()) {
return null;
}
if (softwareFile.getParentPath().endsWith("/config/")) { if (softwareFile.getParentPath().endsWith("/config/")) {
softwareHiveFileName = tempDirPath + File.separator + softwareFile.getId() + "_" + softwareFile.getName(); softwareHiveFileName = tempDirPath + File.separator + softwareFile.getId() + "_" + softwareFile.getName();