Go to the documentation of this file.
19package org.sleuthkit.autopsy.modules.yara.rules;
21import java.beans.PropertyChangeListener;
22import java.beans.PropertyChangeSupport;
24import java.nio.file.Path;
25import java.nio.file.Paths;
26import java.util.ArrayList;
28import javax.swing.SwingUtilities;
29import org.sleuthkit.autopsy.coreutils.PlatformUtil;
98 if (name ==
null || name.isEmpty()) {
99 throw new RuleSetException(
"YARA rule set name cannot be null or empty string");
103 throw new RuleSetException(String.format(
"Yara rule set with name %s already exits.", name));
107 Path setPath = Paths.get(basePath.toString(), name);
109 setPath.toFile().mkdir();
113 SwingUtilities.invokeLater(
new Runnable() {
131 if (ruleSet ==
null) {
132 throw new RuleSetException(
"YARA rule set name cannot be null or empty string");
136 throw new RuleSetException(String.format(
"A YARA rule set with name %s does not exits.", ruleSet.getName()));
141 SwingUtilities.invokeLater(
new Runnable() {
155 List<RuleSet> ruleSets =
new ArrayList<>();
158 String[] ruleSetNames = basePath.toFile().list();
160 for (String setName : ruleSetNames) {
161 ruleSets.add(
new RuleSet(setName, Paths.get(basePath.toString(), setName)));
176 Path setPath = Paths.get(basePath.toString(), name);
178 return setPath.toFile().exists();
189 File baseFile = basePath.toFile();
191 if (!baseFile.exists()) {
215 File[] allContents = directoryToBeDeleted.listFiles();
216 if (allContents !=
null) {
217 for (File file : allContents) {
221 return directoryToBeDeleted.delete();
synchronized void deleteRuleSet(RuleSet ruleSet)
synchronized boolean isRuleSetExists(String name)
static final String RULE_SET_ADDED
static RuleSetManager instance
synchronized List< RuleSet > getRuleSetList()
static final String RULE_SET_DELETED
static void addPropertyChangeListener(PropertyChangeListener listener)
static final String RULE_SET_FOLDER
static final String BASE_FOLDER
synchronized RuleSet createRuleSet(String name)
final PropertyChangeSupport changeSupport
PropertyChangeSupport getChangeSupport()
void removePropertyChangeListener(PropertyChangeListener listener)
boolean deleteDirectory(File directoryToBeDeleted)
static synchronized RuleSetManager getInstance()
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.