mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
HTML report broken up from single try/catch to multiple.
Signed-off-by: Alex Ebadirad <aebadirad@42six.com>
This commit is contained in:
parent
695911b9a6
commit
ce96a91ce1
@ -34,13 +34,10 @@ import java.util.Map.Entry;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.*;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
|
||||||
import org.sleuthkit.datamodel.FsContent;
|
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
|
||||||
import org.sleuthkit.datamodel.TskData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -55,6 +52,8 @@ public class ReportHTML implements ReportModule {
|
|||||||
private static String htmlPath = "";
|
private static String htmlPath = "";
|
||||||
private ReportConfiguration config;
|
private ReportConfiguration config;
|
||||||
private static ReportHTML instance = null;
|
private static ReportHTML instance = null;
|
||||||
|
private Case currentCase = Case.getCurrentCase(); // get the most updated case
|
||||||
|
private SleuthkitCase skCase = currentCase.getSleuthkitCase();
|
||||||
|
|
||||||
ReportHTML() {
|
ReportHTML() {
|
||||||
}
|
}
|
||||||
@ -128,14 +127,22 @@ public class ReportHTML implements ReportModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
String ingestwarning = "<h2 style=\"color: red;\">Warning, this report was run before ingest services completed!</h2>";
|
String ingestwarning = "<h2 style=\"color: red;\">Warning, this report was run before ingest services completed!</h2>";
|
||||||
Case currentCase = Case.getCurrentCase(); // get the most updated case
|
|
||||||
SleuthkitCase skCase = currentCase.getSleuthkitCase();
|
|
||||||
String caseName = currentCase.getName();
|
String caseName = currentCase.getName();
|
||||||
Integer imagecount = currentCase.getImageIDs().length;
|
Integer imagecount = currentCase.getImageIDs().length;
|
||||||
Integer totalfiles = skCase.countFsContentType(TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG);
|
Integer totalfiles = 0;
|
||||||
Integer totaldirs = skCase.countFsContentType(TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR);
|
Integer totaldirs = 0;
|
||||||
|
try {
|
||||||
|
totaldirs = skCase.countFsContentType(TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR);
|
||||||
|
totalfiles = skCase.countFsContentType(TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG);
|
||||||
|
} catch (TskException ex) {
|
||||||
|
Logger.getLogger(ReportHTML.class.getName()).log(Level.SEVERE, "Could not get FsContentType counts from TSK ", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int reportsize = report.size();
|
int reportsize = report.size();
|
||||||
Integer filesystemcount = currentCase.getRootObjectsCount();
|
Integer filesystemcount = currentCase.getRootObjectsCount();
|
||||||
DateFormat datetimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
DateFormat datetimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
@ -250,7 +257,12 @@ public class ReportHTML implements ReportModule {
|
|||||||
StringBuilder artifact = new StringBuilder("");
|
StringBuilder artifact = new StringBuilder("");
|
||||||
Long objId = entry.getKey().getObjectID();
|
Long objId = entry.getKey().getObjectID();
|
||||||
//Content file = skCase.getContentById(objId);
|
//Content file = skCase.getContentById(objId);
|
||||||
FsContent file = skCase.getFsContentById(objId);
|
FsContent file = null;
|
||||||
|
try {
|
||||||
|
file = skCase.getFsContentById(objId);
|
||||||
|
} catch (TskException ex) {
|
||||||
|
Logger.getLogger(ReportHTML.class.getName()).log(Level.SEVERE, "Could not get FsContent from TSK ", ex);
|
||||||
|
}
|
||||||
|
|
||||||
Long filesize = file.getSize();
|
Long filesize = file.getSize();
|
||||||
|
|
||||||
@ -417,12 +429,13 @@ public class ReportHTML implements ReportModule {
|
|||||||
formatted_Report.append("</div></div></body></html>");
|
formatted_Report.append("</div></div></body></html>");
|
||||||
formatted_header.append(formatted_Report);
|
formatted_header.append(formatted_Report);
|
||||||
// unformatted_header.append(formatted_Report);
|
// unformatted_header.append(formatted_Report);
|
||||||
|
try {
|
||||||
htmlPath = currentCase.getCaseDirectory() + "/Reports/" + caseName + "-" + datenotime + ".html";
|
htmlPath = currentCase.getCaseDirectory() + "/Reports/" + caseName + "-" + datenotime + ".html";
|
||||||
this.save(htmlPath);
|
this.save(htmlPath);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
Logger.getLogger(ReportHTML.class.getName()).log(Level.WARNING, "Exception occurred", e);
|
Logger.getLogger(ReportHTML.class.getName()).log(Level.SEVERE, "Could not write out HTML report! ", e);
|
||||||
}
|
}
|
||||||
return htmlPath;
|
return htmlPath;
|
||||||
}
|
}
|
||||||
@ -451,6 +464,7 @@ public class ReportHTML implements ReportModule {
|
|||||||
String type = "HTML";
|
String type = "HTML";
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getExtension() {
|
public String getExtension() {
|
||||||
String ext = ".html";
|
String ext = ".html";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user