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

Add methods for adding VTs to the redis cache. #337

Merged
merged 5 commits into from
Sep 29, 2020

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Sep 16, 2020

What:
Add methods for adding VTs to the redis cache.

Why:
Currently there isn't a method to add elements under a key in redis with the same value, since the methods are being added as set, which does not allow duplicated entries.

How:

from ospd_openvas import db
from ospd_openvas import nvticache

db_c = db.MainDB()
cache = nvticache.NVTICache(db_c)

nt_list = ['some_file.csv', '', '', '', '', '', '', "cvss_base_vector=AV:N/AC:L/Au:N/C:P/I:N/A:N|last_modification=1600178364|creation_date=1600178364|summary=The remote host is missing an update for package(s) announced advisory.|vuldetect=Checks if a vulnerable package version is present on the target host.|insight=Some insight (CVE-1234)|affected=affected|solution=Please install the updated package(s).|solution_type=VendorFix|qod_type=package", 'CVE-1234', '', 'URL:https://developer.com', '3', '0', 'Some family', 'Some vt name)']

cache.add_vt_to_cache(vt_id='1234', vt=nt_list)

Checklist:

An existing key is replaced, and duplicated values under the are allowed.
@jjnicola jjnicola changed the title Add vt Add methods for adding VTs to the redis cache. Sep 16, 2020
@codecov
Copy link

codecov bot commented Sep 16, 2020

Codecov Report

Merging #337 into master will decrease coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #337      +/-   ##
==========================================
- Coverage   84.33%   84.16%   -0.18%     
==========================================
  Files           9        9              
  Lines        1449     1471      +22     
==========================================
+ Hits         1222     1238      +16     
- Misses        227      233       +6     
Impacted Files Coverage Δ
ospd_openvas/db.py 97.76% <ø> (-1.07%) ⬇️
ospd_openvas/nvticache.py 95.90% <ø> (-2.32%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 232d04e...3c2253e. Read the comment docs.

@jjnicola jjnicola marked this pull request as ready for review September 16, 2020 11:47
@jjnicola jjnicola merged commit 1dd774f into greenbone:master Sep 29, 2020
@jjnicola jjnicola deleted the add-vt branch September 29, 2020 15:03
ArnoStiefvater pushed a commit to ArnoStiefvater/ospd-openvas that referenced this pull request Oct 25, 2021
Update version number to a dev version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants