mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 08:56:15 +00:00
Removed any exception catching and adding in some case-uco boilerplate code
This commit is contained in:
parent
c34aba3fd4
commit
82b5002b2a
@ -198,47 +198,53 @@ public final class CaseUcoFormatExporter {
|
|||||||
* @param progressPanel
|
* @param progressPanel
|
||||||
*/
|
*/
|
||||||
public static void export(List<TagName> tagTypes, List<String> interestingItemSets,
|
public static void export(List<TagName> tagTypes, List<String> interestingItemSets,
|
||||||
File caseReportFolder, ReportProgressPanel progressPanel) {
|
File caseReportFolder, ReportProgressPanel progressPanel) throws IOException, SQLException,
|
||||||
|
NoCurrentCaseException, TskCoreException {
|
||||||
|
|
||||||
try {
|
SleuthkitCase currentCase = Case.getCurrentCaseThrows().getSleuthkitCase();
|
||||||
File outputFolder = Paths.get(caseReportFolder.toString(), ReportCaseUco.getReportFileName()).toFile();
|
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
|
||||||
if(!outputFolder.mkdir()) {
|
|
||||||
//log
|
String reportFileName = ReportCaseUco.getReportFileName();
|
||||||
return;
|
File reportFile = Paths.get(caseReportFolder.toString(), reportFileName).toFile();
|
||||||
|
|
||||||
|
JsonGenerator jsonGenerator = createJsonGenerator(reportFile);
|
||||||
|
initializeJsonOutputFile(jsonGenerator);
|
||||||
|
String caseTraceId = saveCaseInfo(currentCase, jsonGenerator);
|
||||||
|
|
||||||
|
for(TagName tn : tagTypes) {
|
||||||
|
for(ContentTag ct : tagsManager.getContentTagsByTagName(tn)) {
|
||||||
|
//copy content tag
|
||||||
}
|
}
|
||||||
|
|
||||||
SleuthkitCase currentCase = Case.getCurrentCaseThrows().getSleuthkitCase();
|
for(BlackboardArtifactTag bat : tagsManager.getBlackboardArtifactTagsByTagName(tn)) {
|
||||||
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
|
//copy content
|
||||||
|
//copy associated content
|
||||||
for(TagName tn : tagTypes) {
|
|
||||||
for(ContentTag ct : tagsManager.getContentTagsByTagName(tn)) {
|
|
||||||
//copy content tag
|
|
||||||
}
|
|
||||||
|
|
||||||
for(BlackboardArtifactTag bat : tagsManager.getBlackboardArtifactTagsByTagName(tn)) {
|
|
||||||
//copy content
|
|
||||||
//copy associated content
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!interestingItemSets.isEmpty()) {
|
|
||||||
for(BlackboardArtifact bArt : currentCase.getBlackboardArtifacts(INTERESTING_FILE_HIT)) {
|
|
||||||
BlackboardAttribute setAttr = bArt.getAttribute(SET_NAME);
|
|
||||||
if (interestingItemSets.contains(setAttr.getValueString())) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(BlackboardArtifact bArt : currentCase.getBlackboardArtifacts(INTERESTING_ARTIFACT_HIT)) {
|
|
||||||
BlackboardAttribute setAttr = bArt.getAttribute(SET_NAME);
|
|
||||||
if (interestingItemSets.contains(setAttr.getValueString())) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException ex) {
|
|
||||||
//log oh no
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!interestingItemSets.isEmpty()) {
|
||||||
|
for(BlackboardArtifact bArt : currentCase.getBlackboardArtifacts(INTERESTING_FILE_HIT)) {
|
||||||
|
BlackboardAttribute setAttr = bArt.getAttribute(SET_NAME);
|
||||||
|
if (interestingItemSets.contains(setAttr.getValueString())) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(BlackboardArtifact bArt : currentCase.getBlackboardArtifacts(INTERESTING_ARTIFACT_HIT)) {
|
||||||
|
BlackboardAttribute setAttr = bArt.getAttribute(SET_NAME);
|
||||||
|
if (interestingItemSets.contains(setAttr.getValueString())) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JsonGenerator createJsonGenerator(File reportFile) throws IOException {
|
||||||
|
JsonFactory jsonGeneratorFactory = new JsonFactory();
|
||||||
|
JsonGenerator jsonGenerator = jsonGeneratorFactory.createGenerator(reportFile, JsonEncoding.UTF8);
|
||||||
|
// instert \n after each field for more readable formatting
|
||||||
|
jsonGenerator.setPrettyPrinter(new DefaultPrettyPrinter().withObjectIndenter(new DefaultIndenter(" ", "\n")));
|
||||||
|
return jsonGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initializeJsonOutputFile(JsonGenerator catalog) throws IOException {
|
private static void initializeJsonOutputFile(JsonGenerator catalog) throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user