Using apache commons lang to escape html/xml from reports.

This commit is contained in:
Alex Ebadirad 2012-06-04 13:51:15 -07:00
parent c0cb9ae9d0
commit a8c03a3be3
2 changed files with 4 additions and 3 deletions

View File

@ -34,7 +34,7 @@ import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.*;
@ -292,7 +292,7 @@ public class ReportHTML implements ReportModule {
value = "";
}
value = ReportUtils.insertPeriodically(value, "<br>", 30);
attributes.put(type, StringUtils.replaceEach(value, new String[]{"&", "\"", "<", ">"}, new String[]{"&amp;", "&quot;", "&lt;", "&gt;"}));
attributes.put(type, StringEscapeUtils.escapeHtml(value));
}

View File

@ -33,6 +33,7 @@ import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.sleuthkit.autopsy.casemodule.Case;
@ -303,7 +304,7 @@ public class ReportXLS implements ReportModule {
value = tempatt.getValueString();
}
attributes.put(type, value);
attributes.put(type, StringEscapeUtils.escapeXml(value));
cc++;
}