From cfbddc569cb1e96bd0a38a37cd81eee4a4b87802 Mon Sep 17 00:00:00 2001 From: Alex Ebadirad Date: Tue, 1 May 2012 13:36:16 -0700 Subject: [PATCH] removal of hardcode artifact ids in reports. Note: attribute ids are still hardcoded, need to get a lookup method like we have for artifacts to match --- .../sleuthkit/autopsy/report/reportHTML.java | 44 +++++++++--------- .../sleuthkit/autopsy/report/reportXLS.java | 46 +++++++++---------- .../sleuthkit/autopsy/report/reportXML.java | 22 ++++----- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Report/src/org/sleuthkit/autopsy/report/reportHTML.java b/Report/src/org/sleuthkit/autopsy/report/reportHTML.java index e9702bb635..7f25a5fcec 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportHTML.java +++ b/Report/src/org/sleuthkit/autopsy/report/reportHTML.java @@ -73,39 +73,39 @@ public reportHTML (HashMap> re int countHash = 0; int countDevice = 0; for (Entry> entry : report.entrySet()) { - if(entry.getKey().getArtifactTypeID() == 1){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID()){ countGen++; } - if(entry.getKey().getArtifactTypeID() == 2){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()){ countWebBookmark++; } - if(entry.getKey().getArtifactTypeID() == 3){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()){ countWebCookie++; } - if(entry.getKey().getArtifactTypeID() == 4){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()){ countWebHistory++; } - if(entry.getKey().getArtifactTypeID() == 5){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()){ countWebDownload++; } - if(entry.getKey().getArtifactTypeID() == 6){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()){ countRecentObjects++; } - if(entry.getKey().getArtifactTypeID() == 7){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_TRACKPOINT.getTypeID()){ countTrackPoint++; } - if(entry.getKey().getArtifactTypeID() == 8){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()){ countInstalled++; } - if(entry.getKey().getArtifactTypeID() == 9){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()){ countKeyword++; } - if(entry.getKey().getArtifactTypeID() == 10){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()){ countHash++; } - if(entry.getKey().getArtifactTypeID() == 11){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()){ countDevice++; } } @@ -275,19 +275,19 @@ public reportHTML (HashMap> re } - if(entry.getKey().getArtifactTypeID() == 1){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID()){ artifact.append(""); nodeGen.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 2){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()){ artifact.append("").append(attributes.get(1)).append(""); artifact.append("").append(attributes.get(3)).append(""); artifact.append("").append(attributes.get(4)).append(""); artifact.append(""); nodeWebBookmark.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 3){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()){ artifact.append("").append(attributes.get(1)).append(""); artifact.append("").append(attributes.get(2)).append(""); artifact.append("").append(attributes.get(3)).append(""); @@ -296,7 +296,7 @@ public reportHTML (HashMap> re artifact.append(""); nodeWebCookie.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 4){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()){ artifact.append("").append(attributes.get(1)).append(""); artifact.append("").append(attributes.get(33)).append(""); artifact.append("").append(attributes.get(32)).append(""); @@ -305,7 +305,7 @@ public reportHTML (HashMap> re artifact.append(""); nodeWebHistory.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 5){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()){ artifact.append("").append(attributes.get(8)).append(""); artifact.append("").append(attributes.get(1)).append(""); artifact.append("").append(attributes.get(33)).append(""); @@ -313,7 +313,7 @@ public reportHTML (HashMap> re artifact.append(""); nodeWebDownload.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 6){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()){ //artifact.append("").append(objId.toString()); artifact.append("").append(attributes.get(3)).append(""); artifact.append("").append(attributes.get(8)).append(""); @@ -321,27 +321,27 @@ public reportHTML (HashMap> re artifact.append(""); nodeRecentObjects.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 7){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_TRACKPOINT.getTypeID()){ artifact.append("").append(objId.toString()); artifact.append("").append(file.getName().toString()).append(""); artifact.append("").append(filesize.toString()).append(""); artifact.append(""); nodeTrackPoint.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 8){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()){ artifact.append("").append(attributes.get(4)).append(""); artifact.append("").append(attributes.get(2)).append(""); artifact.append(""); nodeInstalled.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 9){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()){ // artifact.append(""); // artifact.append("
Artifact IDNameSize
"); // nodeKeyword.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 10){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()){ // artifact.append("").append(objId.toString()); artifact.append("").append(file.getName().toString()).append(""); artifact.append("").append(filesize.toString()).append(""); @@ -350,7 +350,7 @@ public reportHTML (HashMap> re artifact.append(""); nodeHash.append(artifact); } - if(entry.getKey().getArtifactTypeID() == 11){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()){ artifact.append("").append(attributes.get(18)).append(""); artifact.append("").append(attributes.get(20)).append(""); artifact.append("").append(attributes.get(2)).append(""); diff --git a/Report/src/org/sleuthkit/autopsy/report/reportXLS.java b/Report/src/org/sleuthkit/autopsy/report/reportXLS.java index 3137a6eeca..050cf64df1 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportXLS.java +++ b/Report/src/org/sleuthkit/autopsy/report/reportXLS.java @@ -56,39 +56,39 @@ public class reportXLS { int countHash = 0; int countDevice = 0; for (Entry> entry : report.entrySet()) { - if(entry.getKey().getArtifactTypeID() == 1){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID()){ countGen++; } - if(entry.getKey().getArtifactTypeID() == 2){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()){ countBookmark++; } - if(entry.getKey().getArtifactTypeID() == 3){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()){ countCookie++; } - if(entry.getKey().getArtifactTypeID() == 4){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()){ countHistory++; } - if(entry.getKey().getArtifactTypeID() == 5){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()){ countDownload++; } - if(entry.getKey().getArtifactTypeID() == 6){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()){ countRecentObjects++; } - if(entry.getKey().getArtifactTypeID() == 7){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_TRACKPOINT.getTypeID()){ countTrackPoint++; } - if(entry.getKey().getArtifactTypeID() == 8){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()){ countInstalled++; } - if(entry.getKey().getArtifactTypeID() == 9){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()){ countKeyword++; } - if(entry.getKey().getArtifactTypeID() == 10){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()){ countHash++; } - if(entry.getKey().getArtifactTypeID() == 11){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()){ countDevice++; } } @@ -260,7 +260,7 @@ public class reportXLS { if(tempatt.getValueString() == null || "null".equals(tempatt.getValueString())){ } - else if(type == 2){ + else if(type== 2 || type == 33){ value = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date ((tempatt.getValueLong())*1000)); } else @@ -273,19 +273,19 @@ public class reportXLS { } - if(entry.getKey().getArtifactTypeID() == 1){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID()){ countedGen++; // Row temp = sheetGen.getRow(countedGen); } - if(entry.getKey().getArtifactTypeID() == 2){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()){ countedBookmark++; Row temp = sheetBookmark.createRow(countedBookmark); temp.createCell(0).setCellValue(attributes.get(1)); temp.createCell(1).setCellValue(attributes.get(3)); temp.createCell(2).setCellValue(attributes.get(4)); } - if(entry.getKey().getArtifactTypeID() == 3){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()){ countedCookie++; Row temp = sheetCookie.createRow(countedCookie); temp.createCell(0).setCellValue(attributes.get(1)); @@ -294,7 +294,7 @@ public class reportXLS { temp.createCell(3).setCellValue(attributes.get(6)); temp.createCell(4).setCellValue(attributes.get(4)); } - if(entry.getKey().getArtifactTypeID() == 4){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()){ countedHistory++; Row temp = sheetHistory.createRow(countedHistory); temp.createCell(0).setCellValue(attributes.get(1)); @@ -303,7 +303,7 @@ public class reportXLS { temp.createCell(3).setCellValue(attributes.get(3)); temp.createCell(4).setCellValue(attributes.get(4)); } - if(entry.getKey().getArtifactTypeID() == 5){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()){ countedDownload++; Row temp = sheetDownload.createRow(countedDownload); temp.createCell(0).setCellValue(attributes.get(8)); @@ -311,7 +311,7 @@ public class reportXLS { temp.createCell(2).setCellValue(attributes.get(33)); temp.createCell(3).setCellValue(attributes.get(4)); } - if(entry.getKey().getArtifactTypeID() == 6){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()){ countedRecentObjects++; Row temp = sheetRecent.createRow(countedRecentObjects); temp.createCell(0).setCellValue(attributes.get(3)); @@ -319,16 +319,16 @@ public class reportXLS { temp.createCell(2).setCellValue(file.getName()); temp.createCell(3).setCellValue(attributes.get(4)); } - if(entry.getKey().getArtifactTypeID() == 7){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_TRACKPOINT.getTypeID()){ // sheetTrackpoint.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 8){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()){ countedInstalled++; Row temp = sheetInstalled.createRow(countedInstalled); temp.createCell(0).setCellValue(attributes.get(4)); temp.createCell(1).setCellValue(attributes.get(2)); } - if(entry.getKey().getArtifactTypeID() == 9){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()){ countedKeyword++; Row temp = sheetKeyword.createRow(countedKeyword); temp.createCell(0).setCellValue(attributes.get(10)); @@ -336,14 +336,14 @@ public class reportXLS { temp.createCell(2).setCellValue(attributes.get(12)); temp.createCell(3).setCellValue(attributes.get(13)); } - if(entry.getKey().getArtifactTypeID() == 10){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()){ countedHash++; Row temp = sheetHash.createRow(countedHash); temp.createCell(0).setCellValue(file.getName().toString()); temp.createCell(1).setCellValue(filesize.toString()); temp.createCell(2).setCellValue(attributes.get(30)); } - if(entry.getKey().getArtifactTypeID() == 11){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()){ countedDevice++; Row temp = sheetDevice.createRow(countedDevice); temp.createCell(0).setCellValue(attributes.get(18)); diff --git a/Report/src/org/sleuthkit/autopsy/report/reportXML.java b/Report/src/org/sleuthkit/autopsy/report/reportXML.java index 8bd6562f75..027eaa7c04 100644 --- a/Report/src/org/sleuthkit/autopsy/report/reportXML.java +++ b/Report/src/org/sleuthkit/autopsy/report/reportXML.java @@ -123,44 +123,44 @@ public class reportXML { cc++; } - if(entry.getKey().getArtifactTypeID() == 1){ + if(entry.getKey().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO.getTypeID()){ //while (entry.getValue().iterator().hasNext()) // { // } nodeGen.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 2){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()){ nodeWebBookmark.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 3){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()){ nodeWebCookie.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 4){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()){ nodeWebHistory.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 5){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()){ nodeWebDownload.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 6){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()){ nodeRecentObjects.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 7){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_TRACKPOINT.getTypeID()){ nodeTrackPoint.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 8){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()){ nodeInstalled.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 9){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()){ nodeKeyword.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 10){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()){ nodeHash.addContent(artifact); } - if(entry.getKey().getArtifactTypeID() == 11){ + if(entry.getKey().getArtifactTypeID()== BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()){ nodeDevice.addContent(artifact); } cc++;