Skip to content

Commit

Permalink
Create reporting.md
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Messing <[email protected]>
  • Loading branch information
timmyteo authored Jun 11, 2024
1 parent 4e8ab1d commit 6f50e5c
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions contrib/reporting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Vulnerability DB Reporting and Metrics

Loading the populated SQLite vulnerability database into a tool like [qStudio](https://github.com/timeseries/qstudio) can allow for running metrics around specific aspects. The SQLite database can be found in the following location:
- Macintosh: `\Users\<user>\Library\Application Support\vdb\data.vdb`

The following are some interesting examples and example queries.

### Bar Chart for viewing counts of CVE

Get count of CVE per namespace, for a given year (2018 in this example)
```
SELECT namespace AS Namespace, count(namespace) AS Count FROM cve_data WHERE cve_id LIKE "CVE-2018%" AND namespace IS NOT NULL GROUP BY namespace LIMIT 10
```
![image](Picture1.png)


Get count of CVE per name, for a given year (2018 in this example)
```
SELECT name AS Name, count(name) AS Count FROM cve_data WHERE cve_id LIKE "CVE-2018%" AND name IS NOT NULL GROUP BY name LIMIT 10
```
![image](Picture2.png)


Get count of CVE per PURL, for a given year (2018 in this example)
```
SELECT purl_prefix AS PURL, count(purl_prefix) AS Count FROM cve_data WHERE cve_id LIKE "CVE-2018%" AND namespace IS NOT NULL GROUP BY purl_prefix LIMIT 10
```
![image](Picture3.png)


### Line Chart for viewing trends of CVE counts per year

Show trend of CVE count per year, for a given namespace (this example shows namespace of debian)
```
SELECT substr(cve_id, 5, 4) AS Year, count(cve_id) AS Count FROM cve_data WHERE namespace = "debian" AND cve_id LIKE "CVE-%" GROUP BY Year
```
![image](Picture4.png)


Show trend of CVE count per year, for a given name (this example shows name of .net_core)
```
SELECT substr(cve_id, 5, 4) AS Year, count(cve_id) AS Count FROM cve_data WHERE name = ".net_core" AND cve_id LIKE "CVE-%" GROUP BY Year
```
![image](Picture5.png)


Show trend of of CVE count per year, for a given PURL (this example shows purl of pkg:alpm/arch/apache)
```
SELECT substr(cve_id, 5, 4) AS Year, count(cve_id) AS Count FROM cve_data WHERE purl_prefix = "pkg:alpm/arch/apache" AND cve_id LIKE "CVE-%" GROUP BY Year
```
![image](Picture6.png)

0 comments on commit 6f50e5c

Please sign in to comment.