Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ResultDomain.java
Go to the documentation of this file.
1 /*
2  * Autopsy
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  */
19 package org.sleuthkit.autopsy.discovery.search;
20 
21 import java.util.Set;
22 import java.util.HashSet;
23 import org.apache.commons.lang3.StringUtils;
24 import org.openide.util.NbBundle;
25 import org.sleuthkit.datamodel.Content;
26 import org.sleuthkit.datamodel.TskData;
27 
31 public class ResultDomain extends Result {
32 
33  private final String domain;
34  private final Long activityStart;
35  private final Long activityEnd;
36  private final Long totalPageViews;
37  private final Long pageViewsInLast60;
38  private final Long filesDownloaded;
39  private final Long countOfKnownAccountTypes;
40  private final String accountTypes;
41  private final Set<String> webCategories = new HashSet<>();
42 
43  private final Content dataSource;
44  private final long dataSourceId;
45 
51  ResultDomain(String domain, Long activityStart, Long activityEnd, Long totalPageViews,
52  Long pageViewsInLast60, Long filesDownloaded, Long countOfKnownAccountTypes, String accountTypes, Content dataSource) {
53  this.domain = domain;
54  this.dataSource = dataSource;
55  this.dataSourceId = dataSource.getId();
56  this.activityStart = activityStart;
57  this.activityEnd = activityEnd;
58  this.totalPageViews = totalPageViews;
59  this.pageViewsInLast60 = pageViewsInLast60;
60  this.filesDownloaded = filesDownloaded;
61  this.countOfKnownAccountTypes = countOfKnownAccountTypes;
62  this.accountTypes = accountTypes;
63  }
64 
70  ResultDomain(ResultDomain resultDomain) {
71  this.domain = resultDomain.getDomain();
72  this.dataSource = resultDomain.getDataSource();
73  this.dataSourceId = resultDomain.getDataSourceObjectId();
74  this.activityStart = resultDomain.getActivityStart();
75  this.activityEnd = resultDomain.getActivityEnd();
76  this.totalPageViews = resultDomain.getTotalPageViews();
77  this.pageViewsInLast60 = resultDomain.getPageViewsInLast60Days();
78  this.filesDownloaded = resultDomain.getFilesDownloaded();
79  this.countOfKnownAccountTypes = resultDomain.getCountOfKnownAccountTypes();
80  this.accountTypes = resultDomain.getAccountTypes();
81  }
82 
88  public String getDomain() {
89  return this.domain;
90  }
91 
97  public Long getActivityStart() {
98  return activityStart;
99  }
100 
106  public Long getActivityEnd() {
107  return activityEnd;
108  }
109 
116  public Long getTotalPageViews() {
117  return totalPageViews;
118  }
119 
127  public Long getPageViewsInLast60Days() {
128  return pageViewsInLast60;
129  }
130 
136  public Long getFilesDownloaded() {
137  return filesDownloaded;
138  }
139 
143  @NbBundle.Messages({
144  "ResultDomain_getDefaultCategory=Uncategorized"
145  })
146  public Set<String> getWebCategories() {
147  Set<String> returnList = new HashSet<>();
148  if (webCategories.isEmpty()) {
149  returnList.add(Bundle.ResultDomain_getDefaultCategory());
150  } else {
151  returnList.addAll(webCategories);
152  }
153  return returnList;
154  }
155 
160  public void addWebCategories(Set<String> categories) {
161  if (categories != null && !categories.isEmpty()) {
162  this.webCategories.addAll(categories);
163  }
164  }
165 
170  public boolean hasKnownAccountType() {
171  return getCountOfKnownAccountTypes() != null
172  && getCountOfKnownAccountTypes() > 0;
173  }
174 
182  @NbBundle.Messages({
183  "ResultDomain_noAccountTypes=Unknown"
184  })
185  public String getAccountTypes() {
186  if (StringUtils.isBlank(accountTypes)) {
187  return Bundle.ResultDomain_noAccountTypes();
188  }
189  return accountTypes;
190  }
191 
192  @Override
193  public long getDataSourceObjectId() {
194  return this.dataSourceId;
195  }
196 
197  @Override
198  public Content getDataSource() {
199  return this.dataSource;
200  }
201 
202  @Override
203  public TskData.FileKnown getKnown() {
204  return TskData.FileKnown.UNKNOWN;
205  }
206 
207  @Override
209  return SearchData.Type.DOMAIN;
210  }
211 
212  @Override
213  public String toString() {
214  return "[domain=" + this.domain + ", data_source=" + this.dataSourceId + ", start="
215  + this.activityStart + ", end=" + this.activityEnd + ", totalVisits=" + this.totalPageViews + ", visitsLast60="
216  + this.pageViewsInLast60 + ", downloads=" + this.filesDownloaded + ", frequency="
217  + this.getFrequency() + "]";
218  }
219 
223  Long getCountOfKnownAccountTypes() {
225  }
226 }

Copyright © 2012-2021 Basis Technology. Generated on: Thu Sep 30 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.