19 package org.sleuthkit.autopsy.communications.snapshot;
21 import java.util.List;
22 import java.awt.image.BufferedImage;
23 import java.io.IOException;
24 import java.nio.file.Path;
25 import java.text.SimpleDateFormat;
26 import java.time.Instant;
27 import java.util.ArrayList;
28 import java.util.Collection;
29 import java.util.Date;
30 import java.util.HashMap;
32 import javax.imageio.ImageIO;
37 import org.
sleuthkit.datamodel.CommunicationsFilter.AccountTypeFilter;
38 import org.
sleuthkit.datamodel.CommunicationsFilter.DateRangeFilter;
39 import org.
sleuthkit.datamodel.CommunicationsFilter.DeviceFilter;
40 import org.
sleuthkit.datamodel.CommunicationsFilter.SubFilter;
50 private final BufferedImage
image;
51 private final CommunicationsFilter
filter;
66 super(currentCase, reportFolderPath, reportName, generationDate);
68 this.image = snapshot;
81 SimpleDateFormat formatter =
new SimpleDateFormat(
"MMMMM dd, yyyy");
86 HashMap<String, Object> snapShotContext =
new HashMap<>();
89 List<SubFilter> filters = filter.getAndFilters();
91 for (SubFilter filter : filters) {
92 if (filter instanceof DateRangeFilter) {
93 long startDate = ((DateRangeFilter) filter).getStartDate();
94 long endDate = ((DateRangeFilter) filter).getEndDate();
98 snapShotContext.put(
"startTime", formatter.format(
new Date((Instant.ofEpochSecond(startDate)).toEpochMilli())));
102 snapShotContext.put(
"endTime", formatter.format(
new Date((Instant.ofEpochSecond(endDate)).toEpochMilli())));
104 }
else if (filter instanceof AccountTypeFilter) {
106 Set<Account.Type> selectedAccounts = ((AccountTypeFilter) filter).getAccountTypes();
107 ArrayList<ReportWriterHelper> fullAccountList =
new ArrayList<>();
108 for (Account.Type type : Account.Type.PREDEFINED_ACCOUNT_TYPES) {
109 if (type == Account.Type.CREDIT_CARD) {
113 fullAccountList.add(
new ReportWriterHelper(type.getDisplayName(), selectedAccounts.contains(type)));
116 snapShotContext.put(
"accounts", fullAccountList);
117 }
else if (filter instanceof DeviceFilter) {
118 Collection<String> ids = ((DeviceFilter) filter).getDevices();
119 ArrayList<ReportWriterHelper> list =
new ArrayList<>();
122 for (DataSource dataSource : sleuthkitCase.getDataSources()) {
123 boolean selected = ids.contains(dataSource.getDeviceId());
124 String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
127 }
catch (TskCoreException ex) {
131 snapShotContext.put(
"devices", list);
Path getReportFolderPath()
final CommunicationsFilter filter
void writeSnapShotHTMLFile()
final BufferedImage image
SleuthkitCase getSleuthkitCase()
void fillTemplateAndWrite(final String templateLocation, final String templateName, Object context, final Path outPutFile)
final Path reportFolderPath
CommSnapShotReportWriter(Case currentCase, Path reportFolderPath, String reportName, Date generationDate, BufferedImage snapshot, CommunicationsFilter filter)