Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
AutopsyOptionProcessor.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.core;
20 
21 import java.util.HashSet;
22 import java.util.Map;
23 import java.util.Set;
24 import java.util.logging.Level;
26 import org.netbeans.api.sendopts.CommandException;
27 import org.netbeans.spi.sendopts.Env;
28 import org.netbeans.spi.sendopts.Option;
29 import org.netbeans.spi.sendopts.OptionProcessor;
30 import org.openide.util.lookup.ServiceProvider;
33 
39 @ServiceProvider(service=OptionProcessor.class)
40 public class AutopsyOptionProcessor extends OptionProcessor {
41 
42  private static final Logger logger = Logger.getLogger(AutopsyOptionProcessor.class.getName());
43  private final Option liveAutopsyOption = Option.optionalArgument('l', "liveAutopsy");
44  private final Option deadAutopsyOption = Option.optionalArgument('2', "deadAutopsy");
45  // @@@ We should centralize where we store this. It is defined in 2 other places.
46  private final static String PROP_BASECASE = "LBL_BaseCase_PATH";
47 
48 
49  @Override
50  protected Set<Option> getOptions() {
51  Set<Option> set = new HashSet<>();
52  set.add(liveAutopsyOption);
53  return set;
54  }
55 
56  @Override
57  protected void process(Env env, Map<Option, String[]> values) throws CommandException {
58  if(values.containsKey(liveAutopsyOption)){
59  try {
61 
62  // get the starting folder to store cases in
63  String[] argDirs= values.get(liveAutopsyOption);
64  String startingCaseDir;
65  if (argDirs == null || argDirs.length == 0) {
66  startingCaseDir = PlatformUtil.getUserDirectory().toString();
67  }
68  else {
69  startingCaseDir = argDirs[0];
70  }
71  ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_BASECASE, startingCaseDir);
73  logger.log(Level.SEVERE, ex.getMessage(), ex);
74  }
75  }
76  }
77 }
static synchronized void setRunningInTarget(boolean runningInTarget)
static synchronized void setConfigSetting(String moduleName, String settingName, String settingVal)
void process(Env env, Map< Option, String[]> values)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Mon Apr 17 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.