reports: force new generator logo, do not dislpay raw tool output in report, change alignment to left instead of center for HTML

This commit is contained in:
Brian Carrier 2014-10-28 18:15:45 -04:00
parent ea27a41691
commit 341962fd8b
5 changed files with 19 additions and 27 deletions

View File

@ -212,6 +212,7 @@ public class PlatformUtil {
* @param resourceClass class in the same package as the resourceFile to
* extract
* @param resourceFile resource file name to extract
* @param overWrite true to overwrite an existing resource
* @return true if extracted, false otherwise (if file already exists)
* @throws IOException exception thrown if extract the file failed for IO
* reasons
@ -224,6 +225,8 @@ public class PlatformUtil {
return false;
}
resourceFileF.getParentFile().mkdirs();
InputStream inputStream = resourceClass.getResourceAsStream(resourceFile);
OutputStream out = null;

View File

@ -67,7 +67,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT); // output is too unstructured for table review.
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();
artifacts.removeAll(doNotReport);

View File

@ -19,15 +19,10 @@
package org.sleuthkit.autopsy.report;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.filesystems.FileUtil;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@ -41,7 +36,6 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil;
public final class ReportBranding implements ReportBrandingProviderI {
//property names
private static final String GENERATOR_LOGO_PATH_PROP = "GeneratorLogoPath"; //NON-NLS
private static final String AGENCY_LOGO_PATH_PROP = "AgencyLogoPath"; //NON-NLS
private static final String REPORT_TITLE_PROP = "ReportTitle"; //NON-NLS
private static final String REPORT_FOOTER_PROP = "ReportFooter"; //NON-NLS
@ -54,6 +48,7 @@ public final class ReportBranding implements ReportBrandingProviderI {
private String reportsBrandingDir; //dir with extracted reports branding resources
private static final String MODULE_NAME = ReportBranding.class.getSimpleName();
private static final Logger logger = Logger.getLogger(ReportBranding.class.getName());
private static String generatorLogoPath;
public ReportBranding() {
@ -69,7 +64,7 @@ public final class ReportBranding implements ReportBrandingProviderI {
//TODO use defaults
}
}
getGeneratorLogoPath();
extractGeneratorLogo();
getAgencyLogoPath();
getReportTitle();
}
@ -79,30 +74,23 @@ public final class ReportBranding implements ReportBrandingProviderI {
return reportsBrandingDir;
}
@Override
public String getGeneratorLogoPath() {
String curPath = null;
private void extractGeneratorLogo() {
try {
curPath = ModuleSettings.getConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP);
if (curPath == null || (!curPath.isEmpty() && !new File(curPath).canRead() ) ) {
//use default
logger.log(Level.INFO, "Using default report branding for generator logo"); //NON-NLS
curPath = reportsBrandingDir + File.separator + "logo.png"; //NON-NLS
InputStream in = getClass().getResourceAsStream(DEFAULT_GENERATOR_LOGO);
OutputStream output = new FileOutputStream(new File(curPath));
FileUtil.copy(in, output);
ModuleSettings.setConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP, curPath);
PlatformUtil.extractResourceToUserConfigDir(getClass(), DEFAULT_GENERATOR_LOGO, true);
} catch (IOException ex) {
logger.log(Level.SEVERE, "Error extracting report branding resource for generator logo ", ex); //NON-NLS
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error extracting report branding resources for generator logo", e); //NON-NLS
generatorLogoPath = PlatformUtil.getUserConfigDirectory() + File.separator + DEFAULT_GENERATOR_LOGO;
}
return curPath;
@Override
public String getGeneratorLogoPath() {
return generatorLogoPath;
}
@Override
public void setGeneratorLogoPath(String path) {
ModuleSettings.setConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP, path);
}
@Override

View File

@ -792,7 +792,7 @@ import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
"table th {white-space:nowrap; display: table-cell; text-align: center; padding: 2px 4px; background: #e5e5e5; color: #777; font-size: 11px; text-shadow: #e9f9fd 0 1px 0; border-top: 1px solid #dedede; border-bottom: 2px solid #e5e5e5;}\n" + //NON-NLS
"table .left_align_cell{display: table-cell; padding: 2px 4px; font: 13px/20px Arial, Helvetica, sans-serif; min-width: 125px; overflow: auto; text-align: left; }\n" + //NON-NLS
"table .right_align_cell{display: table-cell; padding: 2px 4px; font: 13px/20px Arial, Helvetica, sans-serif; min-width: 125px; overflow: auto; text-align: right; }\n" + //NON-NLS
"table td {white-space:nowrap; display: table-cell; padding: 2px 3px; font: 13px/20px Arial, Helvetica, sans-serif; min-width: 125px; overflow: auto; text-align:center; }\n" + //NON-NLS
"table td {white-space:nowrap; display: table-cell; padding: 2px 3px; font: 13px/20px Arial, Helvetica, sans-serif; min-width: 125px; overflow: auto; text-align:left; }\n" + //NON-NLS
"table tr:nth-child(even) td {background: #f3f3f3;}"; //NON-NLS
cssOut.write(css);
} catch (FileNotFoundException ex) {

View File

@ -110,6 +110,7 @@ final class ReportVisualPanel2 extends JPanel {
try {
ArrayList<BlackboardArtifact.ARTIFACT_TYPE> doNotReport = new ArrayList<>();
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO);
doNotReport.add(BlackboardArtifact.ARTIFACT_TYPE.TSK_TOOL_OUTPUT); // output is too unstructured for table review
artifacts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTypesInUse();