Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
RuleSet.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2020 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 */
19package org.sleuthkit.autopsy.modules.yara.rules;
20
21import java.io.File;
22import java.io.Serializable;
23import java.nio.file.Path;
24import java.util.ArrayList;
25import java.util.Arrays;
26import java.util.List;
27
31public class RuleSet implements Comparable<RuleSet>, Serializable {
32
33 private static final long serialVersionUID = 1L;
34
35 private final String name;
36 private final Path path;
37
44 RuleSet(String name, Path path) {
45 this.name = name;
46 this.path = path;
47 }
48
54 public String getName() {
55 return name;
56 }
57
63 public Path getPath() {
64 return path;
65 }
66
72 public List<File> getRuleFiles() {
73 List<File> fileList = new ArrayList<>();
74 if(path.toFile().exists()) {
75 File[] fileArray = path.toFile().listFiles();
76 if(fileArray != null) {
77 fileList.addAll(Arrays.asList(fileArray));
78 }
79 }
80
81 return fileList;
82 }
83
84 @Override
85 public String toString() {
86 return getName();
87 }
88
89 @Override
90 public int compareTo(RuleSet ruleSet) {
91 return getName().compareTo(ruleSet.getName());
92 }
93}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.