Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
SnapShotReportWriter.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2016 - 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  */
19 package org.sleuthkit.autopsy.timeline.snapshot;
20 
21 import java.awt.image.BufferedImage;
22 import java.io.IOException;
23 import java.nio.file.Path;
24 import java.util.Date;
25 import java.util.HashMap;
26 import javax.imageio.ImageIO;
27 import org.joda.time.format.DateTimeFormat;
31 
36 
38  private final BufferedImage image;
39 
52  public SnapShotReportWriter(Case currentCase, Path reportFolderPath, String reportName, EventsModelParams zoomState, Date generationDate, BufferedImage snapshot) {
53  super(currentCase, reportFolderPath, reportName, generationDate);
54  this.zoomState = zoomState;
55  this.image = snapshot;
56  }
57 
63  @Override
64  protected void writeSnapShotHTMLFile() throws IOException {
65  //save the snapshot in the report directory
66  ImageIO.write(image, "png", getReportFolderPath().resolve("snapshot.png").toFile()); //NON-NLS
67 
68  //make a map of context objects to resolve template paramaters against
69  HashMap<String, Object> snapShotContext = new HashMap<>();
70  snapShotContext.put("reportTitle", getReportName()); //NON-NLS
71  snapShotContext.put("startTime", zoomState.getTimeRange().getStart().toString(DateTimeFormat.fullDateTime())); //NON-NLS
72  snapShotContext.put("endTime", zoomState.getTimeRange().getEnd().toString(DateTimeFormat.fullDateTime())); //NON-NLS
73  snapShotContext.put("zoomState", zoomState); //NON-NLS
74 
75  fillTemplateAndWrite("/org/sleuthkit/autopsy/timeline/snapshot/snapshot_template.html", "Snapshot", snapShotContext, getReportFolderPath().resolve("snapshot.html")); //NON-NLS
76  }
77 }
void fillTemplateAndWrite(final String templateLocation, final String templateName, Object context, final Path outPutFile)
SnapShotReportWriter(Case currentCase, Path reportFolderPath, String reportName, EventsModelParams zoomState, Date generationDate, BufferedImage snapshot)

Copyright © 2012-2022 Basis Technology. Generated on: Tue Oct 4 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.