-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDependencyTracker-report.sh
25 lines (22 loc) · 1.04 KB
/
DependencyTracker-report.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Set variables
URL="http://192.168.1.1:8081"
Token="X-Api-Key: $YOURTOKEN"
uuid="$YOURUUID"
current_date=$(date +%F)
# Use variables in curl command
curl -H "$Token" -X GET "$URL/api/v1/finding/project/$uuid/export" -o result.json
# Generate CSV file from JSON response, sorted by severity
jq -r '[
"alternateIdentifier", "attributedOn", "referenceUrl", "group",
"latestVersion", "name", "project", "purl", "version", "description",
"epssPercentile", "epssScore", "severity", "severityRank", "source", "vulnId"
],
(.findings | sort_by(.vulnerability.severity)[] | [
.attribution.alternateIdentifier,
.attribution.attributedOn, .attribution.referenceUrl, .component.group, .component.latestVersion,
.component.name, .component.project, .component.purl, .component.version,
.vulnerability.description, .vulnerability.epssPercentile,
.vulnerability.epssScore, .vulnerability.severity, .vulnerability.severityRank, .vulnerability.source,
.vulnerability.vulnId
]) | @csv' result.json > "dt-result-${current_date}.csv"