Created
January 7, 2020 11:51
-
-
Save s0md3v/86a1617ed795c44d344cabb94799892e to your computer and use it in GitHub Desktop.
Dump vuln CPEs from NVD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
deep AS( | |
WITH | |
nested AS( | |
SELECT | |
configurations.nodes AS arr | |
FROM | |
`red-team-project.bq_nvd.nvd` | |
WHERE | |
EXISTS ( | |
SELECT | |
nodes.children | |
FROM | |
UNNEST(configurations.nodes) AS nodes | |
WHERE | |
EXISTS ( | |
SELECT | |
cpe_match.cpe23Uri | |
FROM | |
UNNEST(nodes.cpe_match) AS cpe_match | |
WHERE | |
cpe_match.vulnerable = TRUE)) ) | |
SELECT | |
a.cpe_match AS one | |
FROM | |
nested | |
CROSS JOIN | |
UNNEST(arr) a ) | |
SELECT | |
b.cpe23Uri | |
FROM | |
deep | |
CROSS JOIN | |
UNNEST(one) AS b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment