Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
LogicalImagerRule.java
Go to the documentation of this file.
1/*
2 * Autopsy
3 *
4 * Copyright 2019 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.logicalimager.configuration;
20
21import com.google.gson.annotations.Expose;
22import com.google.gson.annotations.SerializedName;
23import java.util.ArrayList;
24import java.util.HashMap;
25import java.util.List;
26import java.util.Map;
27
32class LogicalImagerRule {
33
34 @Expose(serialize = true)
35 private final Boolean shouldAlert;
36 @Expose(serialize = true)
37 private final Boolean shouldSave;
38 @Expose(serialize = true)
39 private final String name;
40 @Expose(serialize = true)
41 private final String description;
42 @Expose(serialize = true)
43 private List<String> extensions = new ArrayList<>();
44 @SerializedName("file-names")
45 @Expose(serialize = true)
46 private List<String> filenames = new ArrayList<>();
47 @SerializedName("folder-names")
48 @Expose(serialize = true)
49 private List<String> paths = new ArrayList<>();
50 @SerializedName("full-paths")
51 @Expose(serialize = true)
52 private List<String> fullPaths = new ArrayList<>();
53 @SerializedName("size-range")
54 @Expose(serialize = true)
55 final private Map<String, Long> sizeRange = new HashMap<>();
56 @SerializedName("date-range")
57 @Expose(serialize = true)
58 final private Map<String, Integer> dateRange = new HashMap<>();
59
60 // The following fields should not be serialized, internal use only
61 @Expose(serialize = false)
62 private Long minFileSize;
63 @Expose(serialize = false)
64 private Long maxFileSize;
65 @Expose(serialize = false)
66 private Integer minDays;
67 @Expose(serialize = false)
68 private Integer minDate;
69 @Expose(serialize = false)
70 private Integer maxDate;
71
72 private LogicalImagerRule(Boolean shouldAlert, Boolean shouldSave, String name, String description,
73 List<String> extensions,
74 List<String> filenames,
75 List<String> paths,
76 List<String> fullPaths,
77 Long minFileSize,
78 Long maxFileSize,
79 Integer minDays,
80 Integer minDate,
81 Integer maxDate
82 ) {
83 this.shouldAlert = shouldAlert;
84 this.shouldSave = shouldSave;
85 this.name = name;
86 this.description = description;
87 this.extensions = extensions;
88 this.filenames = filenames;
89 this.paths = paths;
90 this.fullPaths = fullPaths;
91
92 this.sizeRange.put("min", minFileSize); // NON-NLS
93 this.minFileSize = minFileSize;
94 this.sizeRange.put("max", maxFileSize); // NON-NLS
95 this.maxFileSize = maxFileSize;
96 this.dateRange.put("min-days", minDays); // NON-NLS
97 this.minDays = minDays;
98 this.dateRange.put("min-date", minDate); // NON-NLS
99 this.minDate = minDate;
100 this.dateRange.put("max-date", maxDate); // NON-NLS
101 this.maxDate = maxDate;
102 }
103
104 LogicalImagerRule() {
105 this.shouldAlert = false; // default
106 this.shouldSave = true; // default
107 this.description = null;
108 this.name = null;
109 }
110
111 Boolean isShouldAlert() {
112 return shouldAlert;
113 }
114
115 Boolean isShouldSave() {
116 return shouldSave;
117 }
118
119 String getName() {
120 return name;
121 }
122
123 String getDescription() {
124 return description;
125 }
126
127 List<String> getExtensions() {
128 return extensions;
129 }
130
131 List<String> getFilenames() {
132 return filenames;
133 }
134
135 List<String> getPaths() {
136 return paths;
137 }
138
139 List<String> getFullPaths() {
140 return fullPaths;
141 }
142
143 Long getMinFileSize() {
144 return minFileSize;
145 }
146
147 Long getMaxFileSize() {
148 return maxFileSize;
149 }
150
151 Integer getMinDays() {
152 return minDays;
153 }
154
155 Integer getMinDate() {
156 return minDate;
157 }
158
159 Integer getMaxDate() {
160 return maxDate;
161 }
162
166 static class Builder {
167
168 private Boolean shouldAlert = null;
169 private Boolean shouldSave = null;
170 private String name = null;
171 private String description = null;
172 private List<String> extensions = null;
173 private List<String> filenames = null;
174 private List<String> paths = null;
175 private List<String> fullPaths = null;
176 private Long minFileSize = null;
177 private Long maxFileSize = null;
178 private Integer minDays = null;
179 private Integer minDate = null;
180 private Integer maxDate = null;
181
182 Builder getShouldAlert(boolean shouldAlert) {
183 this.shouldAlert = shouldAlert;
184 return this;
185 }
186
187 Builder getShouldSave(boolean shouldSave) {
188 this.shouldSave = shouldSave;
189 return this;
190 }
191
192 Builder getName(String name) {
193 this.name = name;
194 return this;
195 }
196
197 Builder getDescription(String description) {
198 this.description = description;
199 return this;
200 }
201
202 Builder getExtensions(List<String> extensions) {
203 this.extensions = extensions;
204 return this;
205 }
206
207 Builder getFilenames(List<String> filenames) {
208 this.filenames = filenames;
209 return this;
210 }
211
212 Builder getPaths(List<String> paths) {
213 this.paths = paths;
214 return this;
215 }
216
217 Builder getFullPaths(List<String> fullPaths) {
218 this.fullPaths = fullPaths;
219 return this;
220 }
221
222 Builder getMinFileSize(Long minFileSize) {
223 this.minFileSize = minFileSize;
224 return this;
225 }
226
227 Builder getMaxFileSize(Long maxFileSize) {
228 this.maxFileSize = maxFileSize;
229 return this;
230 }
231
232 Builder getMinDays(Integer minDays) {
233 this.minDays = minDays;
234 return this;
235 }
236
237 Builder getMinDate(Integer minDate) {
238 this.minDate = minDate;
239 return this;
240 }
241
242 Builder getMaxDate(Integer maxDate) {
243 this.maxDate = maxDate;
244 return this;
245 }
246
247 LogicalImagerRule build() {
248 return new LogicalImagerRule(shouldAlert, shouldSave, name, description,
249 extensions, filenames, paths, fullPaths,
250 minFileSize, maxFileSize,
251 minDays, minDate, maxDate
252 );
253 }
254 }
255}

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