Skip to content

Instantly share code, notes, and snippets.

@s0md3v
Created January 7, 2020 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s0md3v/86a1617ed795c44d344cabb94799892e to your computer and use it in GitHub Desktop.
Save s0md3v/86a1617ed795c44d344cabb94799892e to your computer and use it in GitHub Desktop.
Dump vuln CPEs from NVD
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