mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 17:19:30 +01:00
added a new vulnerability report
Former-commit-id: f36e328929921e4d278ee8fa5a7370d228bac299
This commit is contained in:
@@ -64,7 +64,11 @@ public class ReportGenerator {
|
|||||||
/**
|
/**
|
||||||
* Generate HTML report.
|
* Generate HTML report.
|
||||||
*/
|
*/
|
||||||
HTML
|
HTML,
|
||||||
|
/**
|
||||||
|
* Generate HTML Vulnerability report.
|
||||||
|
*/
|
||||||
|
VULN
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The Velocity Engine.
|
* The Velocity Engine.
|
||||||
@@ -139,6 +143,9 @@ public class ReportGenerator {
|
|||||||
if (format == Format.HTML || format == Format.ALL) {
|
if (format == Format.HTML || format == Format.ALL) {
|
||||||
generateReport("HtmlReport", outputDir + File.separator + "DependencyCheck-Report.html");
|
generateReport("HtmlReport", outputDir + File.separator + "DependencyCheck-Report.html");
|
||||||
}
|
}
|
||||||
|
if (format == Format.VULN || format == Format.ALL) {
|
||||||
|
generateReport("VulnerabilityReport", outputDir + File.separator + "DependencyCheck-Vulnerability.html");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,16 +158,22 @@ public class ReportGenerator {
|
|||||||
* reports.
|
* reports.
|
||||||
*/
|
*/
|
||||||
public void generateReports(String outputDir, String outputFormat) throws IOException, Exception {
|
public void generateReports(String outputDir, String outputFormat) throws IOException, Exception {
|
||||||
if ("XML".equalsIgnoreCase(outputFormat)) {
|
String format = outputFormat.toUpperCase();
|
||||||
|
if (format.matches("^(XML|HTML|VULN|ALL)$")) {
|
||||||
|
if ("XML".equalsIgnoreCase(format)) {
|
||||||
generateReports(outputDir, Format.XML);
|
generateReports(outputDir, Format.XML);
|
||||||
}
|
}
|
||||||
if ("HTML".equalsIgnoreCase(outputFormat)) {
|
if ("HTML".equalsIgnoreCase(format)) {
|
||||||
generateReports(outputDir, Format.HTML);
|
generateReports(outputDir, Format.HTML);
|
||||||
}
|
}
|
||||||
if ("ALL".equalsIgnoreCase(outputFormat)) {
|
if ("VULN".equalsIgnoreCase(format)) {
|
||||||
|
generateReports(outputDir, Format.VULN);
|
||||||
|
}
|
||||||
|
if ("ALL".equalsIgnoreCase(format)) {
|
||||||
generateReports(outputDir, Format.ALL);
|
generateReports(outputDir, Format.ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a report from a given Velocity Template. The template name
|
* Generates a report from a given Velocity Template. The template name
|
||||||
|
|||||||
@@ -109,8 +109,9 @@ public final class CliParser {
|
|||||||
final String format = line.getOptionValue(ArgumentName.OUTPUT_FORMAT);
|
final String format = line.getOptionValue(ArgumentName.OUTPUT_FORMAT);
|
||||||
if (!("ALL".equalsIgnoreCase(format)
|
if (!("ALL".equalsIgnoreCase(format)
|
||||||
|| "XML".equalsIgnoreCase(format)
|
|| "XML".equalsIgnoreCase(format)
|
||||||
|| "HTML".equalsIgnoreCase(format))) {
|
|| "HTML".equalsIgnoreCase(format)
|
||||||
throw new ParseException("Supported output formats are XML, HTML, or ALL");
|
|| "VULN".equalsIgnoreCase(format))) {
|
||||||
|
throw new ParseException("Supported output formats are XML, HTML, VULN, or ALL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,47 +158,47 @@ public final class CliParser {
|
|||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
private Options createCommandLineOptions() {
|
private Options createCommandLineOptions() {
|
||||||
final Option help = new Option(ArgumentName.HELP_SHORT, ArgumentName.HELP, false,
|
final Option help = new Option(ArgumentName.HELP_SHORT, ArgumentName.HELP, false,
|
||||||
"print this message.");
|
"Print this message.");
|
||||||
|
|
||||||
final Option deepScan = new Option(ArgumentName.PERFORM_DEEP_SCAN_SHORT, ArgumentName.PERFORM_DEEP_SCAN, false,
|
final Option deepScan = new Option(ArgumentName.PERFORM_DEEP_SCAN_SHORT, ArgumentName.PERFORM_DEEP_SCAN, false,
|
||||||
"extracts extra information from dependencies that may increase false positives, but also decrease false negatives.");
|
"Extracts extra information from dependencies that may increase false positives, but also decrease false negatives.");
|
||||||
|
|
||||||
final Option version = new Option(ArgumentName.VERSION_SHORT, ArgumentName.VERSION,
|
final Option version = new Option(ArgumentName.VERSION_SHORT, ArgumentName.VERSION,
|
||||||
false, "print the version information.");
|
false, "Print the version information.");
|
||||||
|
|
||||||
final Option noUpdate = new Option(ArgumentName.DISABLE_AUTO_UPDATE_SHORT, ArgumentName.DISABLE_AUTO_UPDATE,
|
final Option noUpdate = new Option(ArgumentName.DISABLE_AUTO_UPDATE_SHORT, ArgumentName.DISABLE_AUTO_UPDATE,
|
||||||
false, "disables the automatic updating of the CPE data.");
|
false, "Disables the automatic updating of the CPE data.");
|
||||||
|
|
||||||
final Option appName = OptionBuilder.withArgName("name").hasArg().withLongOpt(ArgumentName.APP_NAME)
|
final Option appName = OptionBuilder.withArgName("name").hasArg().withLongOpt(ArgumentName.APP_NAME)
|
||||||
.withDescription("the name of the application being scanned.")
|
.withDescription("The name of the application being scanned.")
|
||||||
.create(ArgumentName.APP_NAME_SHORT);
|
.create(ArgumentName.APP_NAME_SHORT);
|
||||||
|
|
||||||
final Option connectionTimeout = OptionBuilder.withArgName("timeout").hasArg().withLongOpt(ArgumentName.CONNECTION_TIMEOUT)
|
final Option connectionTimeout = OptionBuilder.withArgName("timeout").hasArg().withLongOpt(ArgumentName.CONNECTION_TIMEOUT)
|
||||||
.withDescription("the connection timeout (in milliseconds) to use when downloading resources.")
|
.withDescription("The connection timeout (in milliseconds) to use when downloading resources.")
|
||||||
.create(ArgumentName.CONNECTION_TIMEOUT_SHORT);
|
.create(ArgumentName.CONNECTION_TIMEOUT_SHORT);
|
||||||
|
|
||||||
final Option proxyUrl = OptionBuilder.withArgName("url").hasArg().withLongOpt(ArgumentName.PROXY_URL)
|
final Option proxyUrl = OptionBuilder.withArgName("url").hasArg().withLongOpt(ArgumentName.PROXY_URL)
|
||||||
.withDescription("the proxy url to use when downloading resources.")
|
.withDescription("The proxy url to use when downloading resources.")
|
||||||
.create(ArgumentName.PROXY_URL_SHORT);
|
.create(ArgumentName.PROXY_URL_SHORT);
|
||||||
|
|
||||||
final Option proxyPort = OptionBuilder.withArgName("port").hasArg().withLongOpt(ArgumentName.PROXY_PORT)
|
final Option proxyPort = OptionBuilder.withArgName("port").hasArg().withLongOpt(ArgumentName.PROXY_PORT)
|
||||||
.withDescription("the proxy port to use when downloading resources.")
|
.withDescription("The proxy port to use when downloading resources.")
|
||||||
.create(ArgumentName.PROXY_PORT_SHORT);
|
.create(ArgumentName.PROXY_PORT_SHORT);
|
||||||
|
|
||||||
final Option path = OptionBuilder.withArgName("path").hasArg().withLongOpt(ArgumentName.SCAN)
|
final Option path = OptionBuilder.withArgName("path").hasArg().withLongOpt(ArgumentName.SCAN)
|
||||||
.withDescription("the path to scan - this option can be specified multiple times.")
|
.withDescription("The path to scan - this option can be specified multiple times.")
|
||||||
.create(ArgumentName.SCAN_SHORT);
|
.create(ArgumentName.SCAN_SHORT);
|
||||||
|
|
||||||
final Option props = OptionBuilder.withArgName("file").hasArg().withLongOpt(ArgumentName.PROP)
|
final Option props = OptionBuilder.withArgName("file").hasArg().withLongOpt(ArgumentName.PROP)
|
||||||
.withDescription("a property file to load.")
|
.withDescription("A property file to load.")
|
||||||
.create(ArgumentName.PROP_SHORT);
|
.create(ArgumentName.PROP_SHORT);
|
||||||
|
|
||||||
final Option out = OptionBuilder.withArgName("folder").hasArg().withLongOpt(ArgumentName.OUT)
|
final Option out = OptionBuilder.withArgName("folder").hasArg().withLongOpt(ArgumentName.OUT)
|
||||||
.withDescription("the folder to write reports to.")
|
.withDescription("The folder to write reports to.")
|
||||||
.create(ArgumentName.OUT_SHORT);
|
.create(ArgumentName.OUT_SHORT);
|
||||||
|
|
||||||
final Option outputFormat = OptionBuilder.withArgName("format").hasArg().withLongOpt(ArgumentName.OUTPUT_FORMAT)
|
final Option outputFormat = OptionBuilder.withArgName("format").hasArg().withLongOpt(ArgumentName.OUTPUT_FORMAT)
|
||||||
.withDescription("the output format to write to (XML, HTML, ALL).")
|
.withDescription("The output format to write to (XML, HTML, VULN, ALL).")
|
||||||
.create(ArgumentName.OUTPUT_FORMAT_SHORT);
|
.create(ArgumentName.OUTPUT_FORMAT_SHORT);
|
||||||
|
|
||||||
final OptionGroup og = new OptionGroup();
|
final OptionGroup og = new OptionGroup();
|
||||||
|
|||||||
232
src/main/resources/templates/VulnerabilityReport.vsl
Normal file
232
src/main/resources/templates/VulnerabilityReport.vsl
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user