104 protected void process(Env env, Map<Option, String[]> values)
throws CommandException {
105 logger.log(Level.INFO,
"Processing Autopsy command line options");
106 System.out.println(
"Processing Autopsy command line options");
121 handleError(
"Invalid command line, an input option must be supplied.");
126 String inputCaseName =
"";
129 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.LIST_ALL_INGEST_PROFILES);
135 if (argDirs.length < 1) {
138 inputCaseName = argDirs[0];
140 if (inputCaseName ==
null || inputCaseName.isEmpty()) {
146 if (inputCaseName ==
null || inputCaseName.isEmpty()) {
150 String caseType =
"";
154 if (argDirs.length < 1) {
157 caseType = argDirs[0];
159 if (caseType ==
null || caseType.isEmpty()) {
161 }
else if (!caseType.equalsIgnoreCase(CASETYPE_MULTI) && !caseType.equalsIgnoreCase(CASETYPE_SINGLE)) {
164 handleError(
"Unable to create multi user case. Confirm that multi user settings are configured correctly.");
168 String caseBaseDir =
"";
171 if (argDirs.length < 1) {
174 caseBaseDir = argDirs[0];
176 if (caseBaseDir ==
null || caseBaseDir.isEmpty()) {
177 handleError(
"Missing argument 'caseBaseDir' option");
180 if (!(
new File(caseBaseDir).exists()) || !(
new File(caseBaseDir).isDirectory())) {
181 handleError(
"'caseBaseDir' directory doesn't exist or is not a directory: " + caseBaseDir);
186 if (caseBaseDir ==
null || caseBaseDir.isEmpty()) {
187 handleError(
"Missing argument 'caseBaseDir' option");
190 String dataSourcePath =
"";
194 if (argDirs.length < 1) {
197 dataSourcePath = argDirs[0];
200 if (dataSourcePath ==
null || dataSourcePath.isEmpty()) {
204 if (!(
new File(dataSourcePath).exists())) {
205 handleError(
"Input data source file " + dataSourcePath +
" doesn't exist");
210 String bitlockerKey = ArrayUtils.isNotEmpty(keysArgs) ? keysArgs[0] :
null;
212 String dataSourceId =
"";
216 if (argDirs.length < 1) {
217 handleError(
"Missing argument 'dataSourceObjectIdOption'");
219 dataSourceId = argDirs[0];
222 if (dataSourceId ==
null || dataSourceId.isEmpty()) {
232 if (inputCaseName ==
null || inputCaseName.isEmpty()) {
236 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.CREATE_CASE);
237 newCommand.addInputValue(CommandLineCommand.InputType.CASE_NAME.name(), inputCaseName);
238 newCommand.addInputValue(CommandLineCommand.InputType.CASES_BASE_DIR_PATH.name(), caseBaseDir);
239 newCommand.addInputValue(CommandLineCommand.InputType.CASE_TYPE.name(), caseType);
248 if (dataSourcePath ==
null || dataSourcePath.isEmpty()) {
252 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.ADD_DATA_SOURCE);
253 newCommand.addInputValue(CommandLineCommand.InputType.CASE_NAME.name(), inputCaseName);
254 newCommand.addInputValue(CommandLineCommand.InputType.CASES_BASE_DIR_PATH.name(), caseBaseDir);
255 newCommand.addInputValue(CommandLineCommand.InputType.DATA_SOURCE_PATH.name(), dataSourcePath);
257 if (bitlockerKey !=
null) {
258 newCommand.addInputValue(CommandLineCommand.InputType.BITLOCKER_KEY.name(), bitlockerKey);
265 String ingestProfile =
"";
270 if(argDirs !=
null && argDirs.length > 0) {
271 ingestProfile = argDirs[0];
280 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.RUN_INGEST);
281 newCommand.addInputValue(CommandLineCommand.InputType.CASE_NAME.name(), inputCaseName);
282 newCommand.addInputValue(CommandLineCommand.InputType.CASES_BASE_DIR_PATH.name(), caseBaseDir);
283 newCommand.addInputValue(CommandLineCommand.InputType.DATA_SOURCE_ID.name(), dataSourceId);
284 newCommand.addInputValue(CommandLineCommand.InputType.INGEST_PROFILE_NAME.name(), ingestProfile);
285 newCommand.addInputValue(CommandLineCommand.InputType.DATA_SOURCE_PATH.name(), dataSourcePath);
293 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.LIST_ALL_DATA_SOURCES);
294 newCommand.addInputValue(CommandLineCommand.InputType.CASE_NAME.name(), inputCaseName);
295 newCommand.addInputValue(CommandLineCommand.InputType.CASES_BASE_DIR_PATH.name(), caseBaseDir);
302 List<String> reportProfiles;
304 if (argDirs.length > 0) {
306 reportProfiles = Stream.of(argDirs[0].split(
","))
308 .collect(Collectors.toList());
310 if (reportProfiles ==
null || reportProfiles.isEmpty()) {
311 handleError(
"'generateReports' argument is empty");
314 for (String reportProfile : reportProfiles) {
315 if (reportProfile.isEmpty()) {
318 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.GENERATE_REPORTS);
319 newCommand.addInputValue(CommandLineCommand.InputType.CASE_NAME.name(), inputCaseName);
320 newCommand.addInputValue(CommandLineCommand.InputType.CASES_BASE_DIR_PATH.name(), caseBaseDir);
321 newCommand.addInputValue(CommandLineCommand.InputType.REPORT_PROFILE_NAME.name(), reportProfile);
326 CommandLineCommand newCommand =
new CommandLineCommand(CommandLineCommand.CommandType.GENERATE_REPORTS);
327 newCommand.addInputValue(CommandLineCommand.InputType.CASE_NAME.name(), inputCaseName);
328 newCommand.addInputValue(CommandLineCommand.InputType.CASES_BASE_DIR_PATH.name(), caseBaseDir);
337 System.out.println(
"Completed processing Autopsy command line options");