mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
fixes
This commit is contained in:
parent
6d234efe46
commit
e02bcedb1b
@ -217,6 +217,7 @@ public class Installer extends ModuleInstall {
|
|||||||
packageInstallers.add(org.sleuthkit.autopsy.casemodule.Installer.getDefault());
|
packageInstallers.add(org.sleuthkit.autopsy.casemodule.Installer.getDefault());
|
||||||
packageInstallers.add(org.sleuthkit.autopsy.texttranslation.translators.Installer.getDefault());
|
packageInstallers.add(org.sleuthkit.autopsy.texttranslation.translators.Installer.getDefault());
|
||||||
packageInstallers.add(org.sleuthkit.autopsy.modules.hashdatabase.infrastructure.Installer.getDefault());
|
packageInstallers.add(org.sleuthkit.autopsy.modules.hashdatabase.infrastructure.Installer.getDefault());
|
||||||
|
packageInstallers.add(org.sleuthkit.autopsy.report.infrastructure.Installer.getDefault());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a temporary workaround for the following bug in Tika that
|
* This is a temporary workaround for the following bug in Tika that
|
||||||
|
@ -87,6 +87,8 @@ public final class UserPreferences {
|
|||||||
static {
|
static {
|
||||||
// perform initial load to ensure disk preferences are loaded
|
// perform initial load to ensure disk preferences are loaded
|
||||||
try {
|
try {
|
||||||
|
// make shared directory paths if they don't exist.
|
||||||
|
new File(SharedConfigPath.getInstance().getSharedConfigPath()).mkdirs();
|
||||||
viewPreferences.load();
|
viewPreferences.load();
|
||||||
machineSpecificPreferences.load();
|
machineSpecificPreferences.load();
|
||||||
modePreferences.load();
|
modePreferences.load();
|
||||||
|
@ -27,6 +27,7 @@ import org.openide.modules.ModuleInstall;
|
|||||||
import org.python.icu.text.MessageFormat;
|
import org.python.icu.text.MessageFormat;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
|
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installer for hash databases that copies legacy settings to new location.
|
* Installer for hash databases that copies legacy settings to new location.
|
||||||
@ -47,7 +48,7 @@ public class Installer extends ModuleInstall {
|
|||||||
* package.
|
* package.
|
||||||
*
|
*
|
||||||
* @return The "package installer" singleton for the
|
* @return The "package installer" singleton for the
|
||||||
* org.sleuthkit.autopsy.centralrepository.eventlisteners package.
|
* org.sleuthkit.autopsy.modules.hashdatabase package.
|
||||||
*/
|
*/
|
||||||
public synchronized static Installer getDefault() {
|
public synchronized static Installer getDefault() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
@ -72,6 +73,7 @@ public class Installer extends ModuleInstall {
|
|||||||
File dbPath = new File(HashConfigPaths.getInstance().getDefaultDbPath());
|
File dbPath = new File(HashConfigPaths.getInstance().getDefaultDbPath());
|
||||||
if (legacyDbPath.exists() && !dbPath.exists()) {
|
if (legacyDbPath.exists() && !dbPath.exists()) {
|
||||||
try {
|
try {
|
||||||
|
dbPath.getParentFile().mkdirs();
|
||||||
FileUtils.copyDirectory(legacyDbPath, dbPath);
|
FileUtils.copyDirectory(legacyDbPath, dbPath);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy path hash dbs from {0} to {1}", legacyDbPath, dbPath), ex);
|
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy path hash dbs from {0} to {1}", legacyDbPath, dbPath), ex);
|
||||||
@ -83,6 +85,7 @@ public class Installer extends ModuleInstall {
|
|||||||
File settingsFile = new File(HashConfigPaths.getInstance().getSettingsPath());
|
File settingsFile = new File(HashConfigPaths.getInstance().getSettingsPath());
|
||||||
if (legacySettingsFile.exists() && !settingsFile.exists()) {
|
if (legacySettingsFile.exists() && !settingsFile.exists()) {
|
||||||
try {
|
try {
|
||||||
|
settingsFile.getParentFile().mkdirs();
|
||||||
FileUtils.copyFile(legacySettingsFile, settingsFile);
|
FileUtils.copyFile(legacySettingsFile, settingsFile);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy hash db settings from {0} to {1}", legacySettingsFile, settingsFile), ex);
|
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy hash db settings from {0} to {1}", legacySettingsFile, settingsFile), ex);
|
||||||
@ -93,12 +96,14 @@ public class Installer extends ModuleInstall {
|
|||||||
File xmlSettingsFile = new File(HashConfigPaths.getInstance().getXmlSettingsPath());
|
File xmlSettingsFile = new File(HashConfigPaths.getInstance().getXmlSettingsPath());
|
||||||
if (legacyXmlSettingsFile.exists() && !xmlSettingsFile.exists()) {
|
if (legacyXmlSettingsFile.exists() && !xmlSettingsFile.exists()) {
|
||||||
try {
|
try {
|
||||||
|
xmlSettingsFile.getParentFile().mkdirs();
|
||||||
FileUtils.copyFile(legacyXmlSettingsFile, xmlSettingsFile);
|
FileUtils.copyFile(legacyXmlSettingsFile, xmlSettingsFile);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy xml hash db settings from {0} to {1}", legacyXmlSettingsFile, xmlSettingsFile), ex);
|
logger.log(Level.WARNING, MessageFormat.format("There was an error copying legacy xml hash db settings from {0} to {1}", legacyXmlSettingsFile, xmlSettingsFile), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashDbManager.getInstance().loadLastSavedConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.modules.interestingitems;
|
package org.sleuthkit.autopsy.modules.interestingitems;
|
||||||
|
|
||||||
import com.google.common.annotations.Beta;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -27,7 +28,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
|
||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule;
|
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule;
|
||||||
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition;
|
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition;
|
||||||
@ -47,8 +50,10 @@ public final class FilesSetsManager extends Observable {
|
|||||||
private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
|
private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS
|
||||||
private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings";
|
private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings";
|
||||||
private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings";
|
private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings";
|
||||||
private static final String FILE_FILTER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString();
|
private static final String LEGACY_SETTINGS_PATH = PlatformUtil.getUserConfigDirectory();
|
||||||
private static final String INTERESTING_ITEM_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString();
|
private static final String SETTINGS_PATH = SharedConfigPath.getInstance().getSharedConfigPath();
|
||||||
|
private static final String FILE_FILTER_PATH = Paths.get(SETTINGS_PATH, FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString();
|
||||||
|
private static final String INTERESTING_ITEM_PATH = Paths.get(SETTINGS_PATH, INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString();
|
||||||
private static final Object FILE_INGEST_FILTER_LOCK = new Object();
|
private static final Object FILE_INGEST_FILTER_LOCK = new Object();
|
||||||
private static final Object INTERESTING_FILES_SET_LOCK = new Object();
|
private static final Object INTERESTING_FILES_SET_LOCK = new Object();
|
||||||
private static FilesSetsManager instance;
|
private static FilesSetsManager instance;
|
||||||
@ -133,7 +138,7 @@ public final class FilesSetsManager extends Observable {
|
|||||||
*/
|
*/
|
||||||
public Map<String, FilesSet> getCustomFileIngestFilters() throws FilesSetsManagerException {
|
public Map<String, FilesSet> getCustomFileIngestFilters() throws FilesSetsManagerException {
|
||||||
synchronized (FILE_INGEST_FILTER_LOCK) {
|
synchronized (FILE_INGEST_FILTER_LOCK) {
|
||||||
return FileSetsDefinitions.readSerializedDefinitions(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME);
|
return FileSetsDefinitions.readSerializedDefinitions(SharedConfigPath.getInstance().getSharedConfigPath(), FILE_INGEST_FILTER_DEFS_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +161,7 @@ public final class FilesSetsManager extends Observable {
|
|||||||
*/
|
*/
|
||||||
void setCustomFileIngestFilters(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
|
void setCustomFileIngestFilters(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
|
||||||
synchronized (FILE_INGEST_FILTER_LOCK) {
|
synchronized (FILE_INGEST_FILTER_LOCK) {
|
||||||
FileSetsDefinitions.writeDefinitionsFile(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME, filesSets);
|
FileSetsDefinitions.writeDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), FILE_INGEST_FILTER_DEFS_NAME, filesSets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +173,7 @@ public final class FilesSetsManager extends Observable {
|
|||||||
*/
|
*/
|
||||||
public Map<String, FilesSet> getInterestingFilesSets() throws FilesSetsManagerException {
|
public Map<String, FilesSet> getInterestingFilesSets() throws FilesSetsManagerException {
|
||||||
synchronized (INTERESTING_FILES_SET_LOCK) {
|
synchronized (INTERESTING_FILES_SET_LOCK) {
|
||||||
return InterestingItemsFilesSetSettings.readDefinitionsFile(PlatformUtil.getUserConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME);
|
return InterestingItemsFilesSetSettings.readDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,12 +186,27 @@ public final class FilesSetsManager extends Observable {
|
|||||||
*/
|
*/
|
||||||
void setInterestingFilesSets(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
|
void setInterestingFilesSets(Map<String, FilesSet> filesSets) throws FilesSetsManagerException {
|
||||||
synchronized (INTERESTING_FILES_SET_LOCK) {
|
synchronized (INTERESTING_FILES_SET_LOCK) {
|
||||||
InterestingItemsFilesSetSettings.writeDefinitionsFile(PlatformUtil.getUserConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, filesSets);
|
InterestingItemsFilesSetSettings.writeDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), INTERESTING_FILES_SET_DEFS_NAME, filesSets);
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
this.notifyObservers();
|
this.notifyObservers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves config files to current expected location.
|
||||||
|
*/
|
||||||
|
void upgradeConfig() throws IOException {
|
||||||
|
for (String fileName : new String[]{LEGACY_FILES_SET_DEFS_FILE_NAME, FILE_INGEST_FILTER_DEFS_NAME, INTERESTING_FILES_SET_DEFS_NAME }) {
|
||||||
|
File oldPath = Paths.get(LEGACY_SETTINGS_PATH, fileName).toFile();
|
||||||
|
File newPath = Paths.get(SETTINGS_PATH, fileName).toFile();
|
||||||
|
|
||||||
|
if (oldPath.exists() && !newPath.exists()) {
|
||||||
|
newPath.getParentFile().mkdirs();
|
||||||
|
FileUtils.copyFile(oldPath, newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class FilesSetsManagerException extends Exception {
|
public static class FilesSetsManagerException extends Exception {
|
||||||
|
|
||||||
FilesSetsManagerException() {
|
FilesSetsManagerException() {
|
||||||
|
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.modules.interestingitems;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -34,7 +35,7 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When the interesting items module loads, this runnable loads standard
|
* When the interesting items module loads, this runnable loads standard
|
||||||
* interesting file set rules.
|
* interesting file set rules and performs upgrades.
|
||||||
*/
|
*/
|
||||||
@OnStart
|
@OnStart
|
||||||
public class StandardInterestingFilesSetsLoader implements Runnable {
|
public class StandardInterestingFilesSetsLoader implements Runnable {
|
||||||
@ -57,6 +58,8 @@ public class StandardInterestingFilesSetsLoader implements Runnable {
|
|||||||
"StandardInterestingFilesSetsLoader_cannotUpdateInterestingFilesSets=Unable to write updated configuration for interesting files sets to config directory."
|
"StandardInterestingFilesSetsLoader_cannotUpdateInterestingFilesSets=Unable to write updated configuration for interesting files sets to config directory."
|
||||||
})
|
})
|
||||||
public void run() {
|
public void run() {
|
||||||
|
upgradeConfig();
|
||||||
|
|
||||||
Map<String, FilesSet> standardInterestingFileSets = null;
|
Map<String, FilesSet> standardInterestingFileSets = null;
|
||||||
try {
|
try {
|
||||||
standardInterestingFileSets = readStandardFileXML();
|
standardInterestingFileSets = readStandardFileXML();
|
||||||
@ -86,6 +89,17 @@ public class StandardInterestingFilesSetsLoader implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves settings to new location.
|
||||||
|
*/
|
||||||
|
private void upgradeConfig() {
|
||||||
|
try {
|
||||||
|
FilesSetsManager.getInstance().upgradeConfig();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LOGGER.log(Level.WARNING, "There was an error while upgrading config paths.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for handling top level exceptions and displaying to the user.
|
* Responsible for handling top level exceptions and displaying to the user.
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2022 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* 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 org.sleuthkit.autopsy.report.infrastructure;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import org.openide.modules.ModuleInstall;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installer for hash databases that copies legacy settings to new location.
|
||||||
|
*/
|
||||||
|
public class Installer extends ModuleInstall {
|
||||||
|
private static final Logger logger = Logger.getLogger(Installer.class.getName());
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static Installer instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the singleton "package installer" used by the registered Installer
|
||||||
|
* for the Autopsy-Core module located in the org.sleuthkit.autopsy.core
|
||||||
|
* package.
|
||||||
|
*
|
||||||
|
* @return The singleton instance of this class.
|
||||||
|
*/
|
||||||
|
public synchronized static Installer getDefault() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Installer();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the singleton "package installer" used by the registered
|
||||||
|
* Installer for the Autopsy-Core module located in the
|
||||||
|
* org.sleuthkit.autopsy.core package.
|
||||||
|
*/
|
||||||
|
private Installer() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restored() {
|
||||||
|
try {
|
||||||
|
ReportingConfigLoader.upgradeConfig();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
logger.log(Level.WARNING, "There was an error while upgrading config paths.", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -34,10 +34,12 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.openide.util.io.NbObjectInputStream;
|
import org.openide.util.io.NbObjectInputStream;
|
||||||
import org.openide.util.io.NbObjectOutputStream;
|
import org.openide.util.io.NbObjectOutputStream;
|
||||||
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
|
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
import org.sleuthkit.autopsy.report.GeneralReportSettings;
|
import org.sleuthkit.autopsy.report.GeneralReportSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,6 +51,12 @@ final class ReportingConfigLoader {
|
|||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ReportingConfigLoader.class.getName());
|
private static final Logger logger = Logger.getLogger(ReportingConfigLoader.class.getName());
|
||||||
private static final String REPORT_CONFIG_FOLDER = "ReportingConfigs"; //NON-NLS
|
private static final String REPORT_CONFIG_FOLDER = "ReportingConfigs"; //NON-NLS
|
||||||
|
|
||||||
|
private static final String REPORT_CONFIG_FOLDER_PATH_LEGACY = Paths.get(
|
||||||
|
PlatformUtil.getUserConfigDirectory(),
|
||||||
|
ReportingConfigLoader.REPORT_CONFIG_FOLDER
|
||||||
|
).toAbsolutePath().toString();
|
||||||
|
|
||||||
private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get(
|
private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get(
|
||||||
SharedConfigPath.getInstance().getSharedConfigPath(),
|
SharedConfigPath.getInstance().getSharedConfigPath(),
|
||||||
ReportingConfigLoader.REPORT_CONFIG_FOLDER
|
ReportingConfigLoader.REPORT_CONFIG_FOLDER
|
||||||
@ -241,8 +249,8 @@ final class ReportingConfigLoader {
|
|||||||
* Return a list of the names of the report profiles in the
|
* Return a list of the names of the report profiles in the
|
||||||
* REPORT_CONFIG_FOLDER_PATH.
|
* REPORT_CONFIG_FOLDER_PATH.
|
||||||
*
|
*
|
||||||
* @return Naturally ordered list of report profile names. If none were found
|
* @return Naturally ordered list of report profile names. If none were
|
||||||
* the list will be empty.
|
* found the list will be empty.
|
||||||
*/
|
*/
|
||||||
static synchronized Set<String> getListOfReportConfigs() {
|
static synchronized Set<String> getListOfReportConfigs() {
|
||||||
File reportDirPath = new File(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH);
|
File reportDirPath = new File(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH);
|
||||||
@ -276,4 +284,16 @@ final class ReportingConfigLoader {
|
|||||||
return reportDirectory.exists();
|
return reportDirectory.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void upgradeConfig() throws IOException {
|
||||||
|
File oldPath = new File(REPORT_CONFIG_FOLDER_PATH_LEGACY);
|
||||||
|
File newPath = new File(REPORT_CONFIG_FOLDER_PATH);
|
||||||
|
|
||||||
|
if (oldPath.exists() && Files.list(oldPath.toPath()).findFirst().isPresent()
|
||||||
|
&& (!newPath.exists() || !Files.list(newPath.toPath()).findFirst().isPresent())) {
|
||||||
|
newPath.mkdirs();
|
||||||
|
FileUtils.copyDirectory(oldPath, newPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package org.sleuthkit.autopsy.texttranslation.translators;
|
package org.sleuthkit.autopsy.texttranslation.translators;
|
||||||
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.core.configpath.SharedConfigPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModuleSettings keys and paths for translator settings.
|
* ModuleSettings keys and paths for translator settings.
|
||||||
@ -27,7 +27,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
|||||||
class TranslatorSettings {
|
class TranslatorSettings {
|
||||||
|
|
||||||
private static final String TRANSLATION_FOLDER = "Translation";
|
private static final String TRANSLATION_FOLDER = "Translation";
|
||||||
private static final String TRANSLATION_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), TRANSLATION_FOLDER).toString();
|
private static final String TRANSLATION_PATH = Paths.get(SharedConfigPath.getInstance().getSharedConfigPath(), TRANSLATION_FOLDER).toString();
|
||||||
|
|
||||||
private static TranslatorSettings instance = new TranslatorSettings();
|
private static TranslatorSettings instance = new TranslatorSettings();
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ class TranslatorSettings {
|
|||||||
* @return The resource name to use with ModuleSettings.
|
* @return The resource name to use with ModuleSettings.
|
||||||
*/
|
*/
|
||||||
String getModuleSettingsResource(String translationResource) {
|
String getModuleSettingsResource(String translationResource) {
|
||||||
return Paths.get(TRANSLATION_FOLDER, translationResource).toString();
|
return Paths.get(SharedConfigPath.getInstance().getSharedConfigFolder(), TRANSLATION_FOLDER, translationResource).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,10 +92,11 @@ public class SharedConfiguration {
|
|||||||
private static final String INGEST_MODULES_REL_PATH = new File(moduleDirPath).toURI().relativize(new File(INGEST_MODULES_PATH).toURI()).getPath();
|
private static final String INGEST_MODULES_REL_PATH = new File(moduleDirPath).toURI().relativize(new File(INGEST_MODULES_PATH).toURI()).getPath();
|
||||||
private static final Logger logger = Logger.getLogger(SharedConfiguration.class.getName());
|
private static final Logger logger = Logger.getLogger(SharedConfiguration.class.getName());
|
||||||
private static final String CENTRAL_REPO_DIR_PATH = Paths.get(SHARED_DIR_PATH, "CentralRepository").toAbsolutePath().toString();
|
private static final String CENTRAL_REPO_DIR_PATH = Paths.get(SHARED_DIR_PATH, "CentralRepository").toAbsolutePath().toString();
|
||||||
private static final String VIEW_PREFERENCE_FILE = Paths.get(SHARED_DIR_PATH, "ViewPreferences").toAbsolutePath().toString();
|
private static final String HASH_SETTINGS_PATH = Paths.get(SHARED_DIR_PATH, "HashLookup").toAbsolutePath().toString();
|
||||||
private static final String MACHINE_SPECIFIC_PREFERENCE_FILE = Paths.get(moduleDirPath, "MachineSpecificPreferences").toAbsolutePath().toString();
|
private static final String VIEW_PREFERENCE_FILE = "ViewPreferences.properties";
|
||||||
private static final String MODE_PREFERENCE_FILE = Paths.get(moduleDirPath, "ModePreferences").toAbsolutePath().toString();
|
private static final String MACHINE_SPECIFIC_PREFERENCE_FILE = "MachineSpecificPreferences.properties";
|
||||||
private static final String EXTERNAL_SERVICE_PREFERENCE_FILE = Paths.get(moduleDirPath, "ExternalServicePreferences").toAbsolutePath().toString();
|
private static final String MODE_PREFERENCE_FILE = "ModePreferences.properties";
|
||||||
|
private static final String EXTERNAL_SERVICE_PREFERENCE_FILE = "ExternalServicePreferences.properties";
|
||||||
|
|
||||||
|
|
||||||
private final UpdateConfigSwingWorker swingWorker;
|
private final UpdateConfigSwingWorker swingWorker;
|
||||||
@ -1000,8 +1001,8 @@ public class SharedConfiguration {
|
|||||||
Map<String, String> sharedVersions = readVersionsFromFile(sharedVersionFile);
|
Map<String, String> sharedVersions = readVersionsFromFile(sharedVersionFile);
|
||||||
|
|
||||||
// Copy the settings file
|
// Copy the settings file
|
||||||
copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME, SHARED_DIR_PATH, remoteFolder, true);
|
copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME, HASH_SETTINGS_PATH, remoteFolder, true);
|
||||||
copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, moduleDirPath, remoteFolder, true);
|
copyToRemoteFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, HASH_SETTINGS_PATH, remoteFolder, true);
|
||||||
|
|
||||||
// Get the list of databases from the file
|
// Get the list of databases from the file
|
||||||
List<String> databases = getHashFileNamesFromSettingsFile();
|
List<String> databases = getHashFileNamesFromSettingsFile();
|
||||||
@ -1249,8 +1250,8 @@ public class SharedConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy the settings filey
|
// Copy the settings filey
|
||||||
copyToLocalFolder(HASHDB_CONFIG_FILE_NAME, SHARED_DIR_PATH, remoteFolder, true);
|
copyToLocalFolder(HASHDB_CONFIG_FILE_NAME, HASH_SETTINGS_PATH, remoteFolder, true);
|
||||||
copyToLocalFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, moduleDirPath, remoteFolder, true);
|
copyToLocalFolder(HASHDB_CONFIG_FILE_NAME_LEGACY, HASH_SETTINGS_PATH, remoteFolder, true);
|
||||||
copyToLocalFolder(SHARED_CONFIG_VERSIONS, moduleDirPath, remoteFolder, true);
|
copyToLocalFolder(SHARED_CONFIG_VERSIONS, moduleDirPath, remoteFolder, true);
|
||||||
|
|
||||||
// Refresh HashDbManager with the new settings
|
// Refresh HashDbManager with the new settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user