Revert quoting of ProcessBuilder arguments

This commit is contained in:
Richard Cordovano 2020-10-01 18:42:06 -04:00
parent e7ed60e08b
commit 2acbfc2712
13 changed files with 30 additions and 30 deletions

View File

@ -193,7 +193,7 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
List<String> command = new ArrayList<>();
for (final String l01Path : logicalEvidenceFilePaths) {
command.clear();
command.add(String.format("\"%s\"", ewfexportPath.toAbsolutePath().toString()));
command.add(ewfexportPath.toAbsolutePath().toString());
command.add("-f");
command.add("files");
command.add("-t");
@ -203,8 +203,8 @@ public class LocalFilesDSProcessor implements DataSourceProcessor, AutoIngestDat
}
Path dirPath = Paths.get(FilenameUtils.getBaseName(l01Path) + UNIQUENESS_CONSTRAINT_SEPERATOR + System.currentTimeMillis());
command.add(String.format("\"%s\"", dirPath.toString()));
command.add(String.format("\"%s\"", l01Path));
command.add(dirPath.toString());
command.add(l01Path);
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.directory(l01Dir);
try {

View File

@ -173,10 +173,10 @@ class UnpackagePortableCaseProgressDialog extends javax.swing.JDialog implements
throw new TskCoreException("Error finding 7-Zip executable"); // NON-NLS
}
String outputFolderSwitch = String.format("\"-o%s\"",outputFolder); // NON-NLS
String outputFolderSwitch = "-o" + outputFolder; // NON-NLS
ProcessBuilder procBuilder = new ProcessBuilder();
procBuilder.command(
String.format("\"%s\"",sevenZipExe.getAbsolutePath()),
sevenZipExe.getAbsolutePath(),
"x", // Extract
packagedCase,
outputFolderSwitch

View File

@ -213,8 +213,8 @@ public class ILeappAnalyzerIngestModule implements DataSourceIngestModule {
ProcessBuilder processBuilder = buildProcessWithRunAsInvoker(
"\"" + iLeappExecutable + "\"", //NON-NLS
"-t", iLeappFileSystemType, //NON-NLS
"-i", String.format("\"%s\"",sourceFilePath), //NON-NLS
"-o", String.format("\"%s\"",moduleOutputPath.toString())
"-i", sourceFilePath, //NON-NLS
"-o", moduleOutputPath.toString()
);
processBuilder.redirectError(moduleOutputPath.resolve("iLeapp_err.txt").toFile()); //NON-NLS
processBuilder.redirectOutput(moduleOutputPath.resolve("iLeapp_out.txt").toFile()); //NON-NLS

View File

@ -321,9 +321,9 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
ProcessBuilder processAndSettings = new ProcessBuilder(
executableFile.toString(),
"/d", // NON-NLS
String.format("\"%s\"", Paths.get(outputDirPath.toAbsolutePath().toString(), PHOTOREC_RESULTS_BASE).toString()),
outputDirPath.toAbsolutePath().toString() + File.separator + PHOTOREC_RESULTS_BASE,
"/cmd", // NON-NLS
String.format("\"%s\"",tempFilePath.toFile().toString()));
tempFilePath.toFile().toString());
processAndSettings.command().add(this.optionsString);

View File

@ -190,9 +190,9 @@ public class HEICProcessor implements PictureProcessor {
// Any additional images found within the HEIC container will be
// formatted as fileName-1.jpg, fileName-2.jpg, etc.
final ProcessBuilder processBuilder = new ProcessBuilder()
.command(String.format("\"%s\"",IMAGE_MAGICK_PATH.toString()),
String.format("\"%s\"",localDiskCopy.toString()),
String.format("\"%s\"",outputFile.toString()));
.command(IMAGE_MAGICK_PATH.toString(),
localDiskCopy.toString(),
outputFile.toString());
processBuilder.redirectError(imageMagickErrorOutput.toFile());

View File

@ -235,8 +235,8 @@ public class PlasoIngestModule implements DataSourceIngestModule {
"--parsers", "\"" + parsersString + "\"",//NON-NLS
"--no_dependencies_check", //NON-NLS
"--workers", String.valueOf(LOG2TIMELINE_WORKERS),//NON-NLS
String.format("\"%s\"",moduleOutputPath.resolve(PLASO).toString()),
String.format("\"%s\"",image.getPaths()[0])
moduleOutputPath.resolve(PLASO).toString(),
image.getPaths()[0]
);
processBuilder.redirectError(moduleOutputPath.resolve("log2timeline_err.txt").toFile()); //NON-NLS
return processBuilder;
@ -256,8 +256,8 @@ public class PlasoIngestModule implements DataSourceIngestModule {
ProcessBuilder processBuilder = buildProcessWithRunAsInvoker(
"\"" + psortExecutable + "\"", //NON-NLS
"-o", "4n6time_sqlite", //NON-NLS
"-w", String.format("\"%s\"",moduleOutputPath.resolve("plasodb.db3").toString()), //NON-NLS
String.format("\"%s\"",moduleOutputPath.resolve(PLASO).toString())
"-w", moduleOutputPath.resolve("plasodb.db3").toString(), //NON-NLS
moduleOutputPath.resolve(PLASO).toString()
);
processBuilder.redirectOutput(moduleOutputPath.resolve("psort_output.txt").toFile()); //NON-NLS

View File

@ -1329,10 +1329,10 @@ public class PortableCaseReportModule implements ReportModule {
File zipFile = Paths.get(tempZipFolder.getAbsolutePath(), caseName + ".zip").toFile(); // NON-NLS
ProcessBuilder procBuilder = new ProcessBuilder();
procBuilder.command(
String.format("\"%s\"",sevenZipExe.getAbsolutePath()),
sevenZipExe.getAbsolutePath(),
"a", // Add to archive
String.format("\"%s\"",zipFile.getAbsolutePath()),
String.format("\"%s\"",dirToCompress.toAbsolutePath().toString()),
zipFile.getAbsolutePath(),
dirToCompress.toAbsolutePath().toString(),
chunkOption
);

View File

@ -196,7 +196,7 @@ class VolatilityProcessor {
List<String> commandLine = new ArrayList<>();
commandLine.add("\"" + executableFile + "\""); //NON-NLS
File memoryImage = new File(memoryImagePath);
commandLine.add("--filename=" + String.format("\"%s\"",memoryImage.getName())); //NON-NLS
commandLine.add("--filename=" + memoryImage.getName()); //NON-NLS
if (!profile.isEmpty()) {
commandLine.add("--profile=" + profile); //NON-NLS
}
@ -213,7 +213,7 @@ class VolatilityProcessor {
if (!directory.exists()) {
directory.mkdirs();
}
commandLine.add("--dump-dir=" + String.format("\"%s\"",outputDir)); //NON-NLS
commandLine.add("--dump-dir=" + outputDir); //NON-NLS
break;
default:
break;

View File

@ -575,10 +575,10 @@ final class ExtractEdge extends Extract {
List<String> commandLine = new ArrayList<>();
commandLine.add(dumperPath);
commandLine.add("/table"); //NON-NLS
commandLine.add(String.format("\"%s\"",inputFilePath));
commandLine.add(inputFilePath);
commandLine.add("*"); //NON-NLS
commandLine.add("/scomma"); //NON-NLS
commandLine.add(String.format("\"%s\"",outputDir + "\\" + "*.csv")); //NON-NLS
commandLine.add(outputDir + "\\" + "*.csv"); //NON-NLS
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
processBuilder.redirectOutput(outputFilePath.toFile());

View File

@ -400,7 +400,7 @@ class ExtractIE extends Extract {
List<String> commandLine = new ArrayList<>();
commandLine.add(JAVA_PATH);
commandLine.add("-cp"); //NON-NLS
commandLine.add(String.format("\"%s\"",PASCO_LIB_PATH));
commandLine.add(PASCO_LIB_PATH);
commandLine.add("isi.pasco2.Main"); //NON-NLS
commandLine.add("-T"); //NON-NLS
commandLine.add("history"); //NON-NLS

View File

@ -177,9 +177,9 @@ final class ExtractPrefetch extends Extract {
final Path errFilePath = Paths.get(tempOutPath, PREFETCH_ERROR_FILE_NAME);
List<String> commandLine = new ArrayList<>();
commandLine.add(String.format("\"%s\"",prefetchExePath));
commandLine.add(String.format("\"%s\"",prefetchDir)); //NON-NLS
commandLine.add(String.format("\"%s\"",tempOutFile));
commandLine.add(prefetchExePath);
commandLine.add(prefetchDir); //NON-NLS
commandLine.add(tempOutFile);
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
processBuilder.redirectOutput(outputFilePath.toFile());

View File

@ -472,7 +472,7 @@ class ExtractRegistry extends Extract {
commandLine.add(cmd);
}
commandLine.add("-r"); //NON-NLS
commandLine.add(String.format("\"%s\"",hiveFilePath));
commandLine.add(hiveFilePath);
commandLine.add("-f"); //NON-NLS
commandLine.add(hiveFileType);

View File

@ -247,10 +247,10 @@ final class ExtractSru extends Extract {
final Path errFilePath = Paths.get(tempOutPath, SRU_ERROR_FILE_NAME);
List<String> commandLine = new ArrayList<>();
commandLine.add(String.format("\"%s\"",sruExePath));
commandLine.add(sruExePath);
commandLine.add(sruFile); //NON-NLS
commandLine.add(softwareHiveFile);
commandLine.add(String.format("\"%s\"",tempOutFile));
commandLine.add(tempOutFile);
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
processBuilder.redirectOutput(outputFilePath.toFile());