Autopsy  4.20.0
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  // @@@ We should centralize where we store this. It is defined in 2 other places.
45  private final static String PROP_BASECASE = "LBL_BaseCase_PATH";
46 
47 
48  @Override
49  protected Set<Option> getOptions() {
50  Set<Option> set = new HashSet<>();
51  set.add(liveAutopsyOption);
52  return set;
53  }
54 
55  @Override
56  protected void process(Env env, Map<Option, String[]> values) throws CommandException {
57  if(values.containsKey(liveAutopsyOption)){
58  try {
60 
61  // get the starting folder to store cases in
62  String[] argDirs= values.get(liveAutopsyOption);
63  String startingCaseDir;
64  if (argDirs == null || argDirs.length == 0) {
65  startingCaseDir = PlatformUtil.getUserDirectory().toString();
66  }
67  else {
68  startingCaseDir = argDirs[0];
69  }
70  ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_BASECASE, startingCaseDir);
72  logger.log(Level.SEVERE, ex.getMessage(), ex);
73  }
74  }
75  }
76 }
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: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.