Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logic for generating valid and existing cpes #5

Closed
mrl5 opened this issue Dec 5, 2020 · 2 comments
Closed

logic for generating valid and existing cpes #5

mrl5 opened this issue Dec 5, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@mrl5
Copy link
Owner

mrl5 commented Dec 5, 2020

  1. use cpe match feed (see json schema) or NVD API for CPE Retrieval
  2. some requirements:
  • cpe_product - strip -bin from package name
  • cpe_version exclude 9999
  • cpe_update should be _p2 part
  • strip -r1 parts

see also:
Official CPE Dictionary
cpe python lib
nvdtools

@mrl5
Copy link
Owner Author

mrl5 commented Dec 6, 2020

PoC for checking if in cpe registry:

dummy_cpe='microsoft:internet_explorer:11'

wget https://nvd.nist.gov/feeds/json/cpematch/1.0/nvdcpematch-1.0.json.gz &&
    zcat nvdcpematch-1.0.json | jq -c --stream | grep $dummy_cpe

@mrl5
Copy link
Owner Author

mrl5 commented Dec 6, 2020

PoC generating valid cpe:

package=busybox

versions=`ego query versions $package |
    grep -E [0-9] |
    cut -d '|' -f1 |
    grep -v 9999 |
    sed -E 's/ +//g' |
    sed 's/*//g'`

searchterms=`for v in $versions; do
    echo "$package:$v" | tr A-Z a-z
done`

for st in $searchterms; do
    zcat nvdcpematch-1.0.json | grep $st | sort -u | sed -E 's/ +//g' | cut -d':' -f2- | sed 's/"//g'
done

@mrl5 mrl5 changed the title worker for generating cpes from metarepo json worker for generating valid and existing cpes Dec 6, 2020
@mrl5 mrl5 changed the title worker for generating valid and existing cpes logic for generating valid and existing cpes Dec 6, 2020
@mrl5 mrl5 mentioned this issue Dec 6, 2020
@mrl5 mrl5 closed this as completed Dec 6, 2020
mrl5 added a commit that referenced this issue Dec 7, 2020
mrl5 added a commit that referenced this issue Dec 7, 2020
mrl5 added a commit that referenced this issue Dec 7, 2020
mrl5 added a commit that referenced this issue Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant