19 package org.sleuthkit.autopsy.modules.interestingitems;
22 import java.io.IOException;
23 import java.nio.file.Paths;
24 import java.util.ArrayList;
25 import java.util.Arrays;
26 import java.util.Collections;
27 import java.util.HashMap;
28 import java.util.List;
30 import java.util.Observable;
31 import org.apache.commons.io.FileUtils;
32 import org.openide.util.NbBundle;
45 @NbBundle.Messages({
"FilesSetsManager.allFilesAndDirectories=All Files and Directories (Not Unallocated Space)",
46 "FilesSetsManager.allFilesDirectoriesAndUnallocated=All Files, Directories, and Unallocated Space"})
47 private static final List<String>
ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(
new ArrayList<>(Arrays.asList(
"\\",
"/",
":",
"*",
"?",
"\"",
"<",
">")));
48 private static final List<String>
ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(
new ArrayList<>(Arrays.asList(
"\\",
":",
"*",
"?",
"\"",
"<",
">")));
54 private static final String
FILE_FILTER_PATH = Paths.get(SETTINGS_PATH, FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString();
55 private static final String
INTERESTING_ITEM_PATH = Paths.get(SETTINGS_PATH, INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString();
60 Bundle.FilesSetsManager_allFilesAndDirectories(), Bundle.FilesSetsManager_allFilesAndDirectories(),
false,
true,
new HashMap<String, Rule>() {
62 put(Bundle.FilesSetsManager_allFilesAndDirectories(),
63 new Rule(Bundle.FilesSetsManager_allFilesAndDirectories(), null,
68 Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(),
69 false,
false,
new HashMap<String, Rule>() {
71 put(Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(),
72 new Rule(Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), null,
82 if (instance == null) {
91 static String getFileFilterPath() {
98 static String getInterestingItemPath() {
107 static List<String> getIllegalFileNameChars() {
108 return FilesSetsManager.ILLEGAL_FILE_NAME_CHARS;
117 static List<String> getIllegalFilePathChars() {
118 return FilesSetsManager.ILLEGAL_FILE_PATH_CHARS;
127 return Arrays.asList(FILES_DIRS_UNALLOC_INGEST_FILTER, FILES_DIRS_INGEST_FILTER);
190 this.notifyObservers();
197 void upgradeConfig() throws IOException {
199 File oldPath = Paths.get(LEGACY_SETTINGS_PATH, fileName).toFile();
200 File newPath = Paths.get(SETTINGS_PATH, fileName).toFile();
202 if (oldPath.exists() && !newPath.exists()) {
203 newPath.getParentFile().mkdirs();
204 FileUtils.copyFile(oldPath, newPath);
220 super(message, cause);
static final String INTERESTING_FILES_SET_DEFS_NAME
static List< FilesSet > getStandardFileIngestFilters()
static final FilesSet FILES_DIRS_INGEST_FILTER
Map< String, FilesSet > getInterestingFilesSets()
static final String FILE_FILTER_PATH
static final Object FILE_INGEST_FILTER_LOCK
static final List< String > ILLEGAL_FILE_PATH_CHARS
static synchronized FilesSetsManager getInstance()
static FilesSetsManager instance
static final String INTERESTING_ITEM_PATH
static final String LEGACY_SETTINGS_PATH
Map< String, FilesSet > getCustomFileIngestFilters()
static final List< String > ILLEGAL_FILE_NAME_CHARS
static FilesSet getDefaultFilter()
static final String LEGACY_FILES_SET_DEFS_FILE_NAME
static final Object INTERESTING_FILES_SET_LOCK
static final String FILE_INGEST_FILTER_DEFS_NAME
static final String SETTINGS_PATH
static final FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER