Skip to content
Snippets Groups Projects
Commit 0bec0017 authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

fixes

parent 6e5e2ff2
No related branches found
No related tags found
No related merge requests found
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.netbeans.spi.options.OptionsPanelController; import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel; import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
/** /**
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
import java.util.concurrent.CancellationException; import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
...@@ -51,6 +50,7 @@ ...@@ -51,6 +50,7 @@
import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProvider;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.core.UserPreferences; import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
/** /**
* Options panel to be displayed in the CTOptionsPanel for settings regarding * Options panel to be displayed in the CTOptionsPanel for settings regarding
......
/** ************************************************************************* /*
** This data and information is proprietary to, and a valuable trade secret * Autopsy Forensic Browser
** of, Sleuth Kit Labs. It is given in confidence by Sleuth Kit Labs *
** and may only be used as permitted under the license agreement under which * Copyright 2023 Basis Technology Corp.
** it has been distributed, and in no other way. * Contact: carrier <at> sleuthkit <dot> org
** *
** Copyright (c) 2023 Sleuth Kit Labs, LLC. All rights reserved * Licensed under the Apache License, Version 2.0 (the "License");
** * you may not use this file except in compliance with the License.
** The technical data and information provided herein are provided with * You may obtain a copy of the License at
** `limited rights', and the computer software provided herein is provided *
** with `restricted rights' as those terms are defined in DAR and ASPR * http://www.apache.org/licenses/LICENSE-2.0
** 7-104.9(a). *
************************************************************************** */ * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basistech.df.cybertriage.autopsy.incidentoptions; package com.basistech.df.cybertriage.autopsy.incidentoptions;
import com.basistech.df.cybertriage.autopsy.ctoptions.subpanel.CTOptionsSubPanel; import com.basistech.df.cybertriage.autopsy.ctoptions.subpanel.CTOptionsSubPanel;
...@@ -21,7 +26,7 @@ ...@@ -21,7 +26,7 @@
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Collections; import java.util.Collections;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
......
/** ************************************************************************* /*
** This data and information is proprietary to, and a valuable trade secret * Autopsy Forensic Browser
** of, Sleuth Kit Labs. It is given in confidence by Sleuth Kit Labs *
** and may only be used as permitted under the license agreement under which * Copyright 2023 Basis Technology Corp.
** it has been distributed, and in no other way. * Contact: carrier <at> sleuthkit <dot> org
** *
** Copyright (c) 2023 Sleuth Kit Labs, LLC. All rights reserved * Licensed under the Apache License, Version 2.0 (the "License");
** * you may not use this file except in compliance with the License.
** The technical data and information provided herein are provided with * You may obtain a copy of the License at
** `limited rights', and the computer software provided herein is provided *
** with `restricted rights' as those terms are defined in DAR and ASPR * http://www.apache.org/licenses/LICENSE-2.0
** 7-104.9(a). *
************************************************************************** */ * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basistech.df.cybertriage.autopsy.incidentoptions; package com.basistech.df.cybertriage.autopsy.incidentoptions;
import java.io.IOException; import java.io.IOException;
...@@ -19,40 +24,60 @@ ...@@ -19,40 +24,60 @@
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openide.modules.Places; import org.openide.modules.Places;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/** /**
* CT settings that don't include license information. This code must be kept in-sync with code in * CT settings that don't include license information. This code must be kept
* CT Autopsy Importer NBM. * in-sync with code in CT Autopsy Importer NBM.
*/ */
public class CTSettings { public class CTSettings {
private static final Logger LOGGER = Logger.getLogger(CTSettings.class.getCanonicalName());
private static final String DEFAULT_FILE_REPO_PATH = getAppDataLocalDirectory(); private static final String DEFAULT_FILE_REPO_PATH = getAppDataLocalDirectory();
// taken from com.basistech.df.cybertriage.utils.SystemProperties private static final String CYBERTRIAGE_FOLDER = "cybertriage";
private static String getAppDataLocalDirectory() { private static final String CYBERTRIAGE_DOT_FOLDER = "." + CYBERTRIAGE_FOLDER;
Logger LOGGER = java.util.logging.Logger.getLogger(CTSettings.class.getCanonicalName()); // based on com.basistech.df.cybertriage.utils.SystemProperties
private static String getAppDataLocalDirectory() {
if (Objects.nonNull(Places.getUserDirectory()) && Places.getUserDirectory().getAbsolutePath().endsWith("testuserdir")) { // APP is in testing .. this should return the test path if (Objects.nonNull(Places.getUserDirectory()) && Places.getUserDirectory().getAbsolutePath().endsWith("testuserdir")) { // APP is in testing .. this should return the test path
LOGGER.log(Level.INFO, "Application Data (test mode) Path: " + Places.getUserDirectory().getAbsolutePath()); LOGGER.log(Level.INFO, "Application Data (test mode) Path: " + Places.getUserDirectory().getAbsolutePath());
return Places.getUserDirectory().getAbsolutePath(); return Places.getUserDirectory().getAbsolutePath();
} else { }
Path localAppPath = StringUtils.isBlank(System.getenv("LOCALAPPDATA")) // try to use LOCALAPPDATA on windows
? Places.getUserDirectory().toPath().toAbsolutePath() String localDataStr = System.getenv("LOCALAPPDATA");
: Paths.get(System.getenv("LOCALAPPDATA"), "cybertriage"); if (StringUtils.isNotBlank(localDataStr)) {
Path localAppPath = Paths.get(localDataStr, CYBERTRIAGE_FOLDER);
try { try {
Files.createDirectories(localAppPath); Files.createDirectories(localAppPath);
LOGGER.log(Level.INFO, "Application Data Path: " + localAppPath.toString()); LOGGER.log(Level.INFO, "Application Data Path: " + localAppPath.toString());
return localAppPath.toString(); return localAppPath.toString();
} catch (IOException ex) { } catch (IOException ex) {
LOGGER.log(Level.SEVERE, "IO Error, defaulting to user dir", ex); LOGGER.log(Level.SEVERE, "IO Error using " + localAppPath.toString(), ex);
return Places.getUserDirectory().getAbsolutePath(); // In case of an IO Error
} }
} }
// try to use ~/.cybertriage anywhere else
if (!PlatformUtil.isWindowsOS()) {
String homePathStr = System.getenv("HOME");
if (StringUtils.isNotBlank(homePathStr)) {
Path localAppPath = Paths.get(homePathStr, CYBERTRIAGE_DOT_FOLDER);
try {
Files.createDirectories(localAppPath);
LOGGER.log(Level.INFO, "Non-windows Application Data Path: " + localAppPath.toString());
return localAppPath.toString();
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "IO Error using " + localAppPath.toString(), ex);
}
}
}
// defer to user directory otherwise
return Places.getUserDirectory().getAbsolutePath(); // In case of an IO Error
} }
public static String getDefaultFileRepoPath() { public static String getDefaultFileRepoPath() {
......
/** ************************************************************************* /*
** This data and information is proprietary to, and a valuable trade secret * Autopsy Forensic Browser
** of, Sleuth Kit Labs. It is given in confidence by Sleuth Kit Labs *
** and may only be used as permitted under the license agreement under which * Copyright 2023 Basis Technology Corp.
** it has been distributed, and in no other way. * Contact: carrier <at> sleuthkit <dot> org
** *
** Copyright (c) 2023 Sleuth Kit Labs, LLC. All rights reserved * Licensed under the Apache License, Version 2.0 (the "License");
** * you may not use this file except in compliance with the License.
** The technical data and information provided herein are provided with * You may obtain a copy of the License at
** `limited rights', and the computer software provided herein is provided *
** with `restricted rights' as those terms are defined in DAR and ASPR * http://www.apache.org/licenses/LICENSE-2.0
** 7-104.9(a). *
************************************************************************** */ * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basistech.df.cybertriage.autopsy.incidentoptions; package com.basistech.df.cybertriage.autopsy.incidentoptions;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment