-
Notifications
You must be signed in to change notification settings - Fork 58
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
Ospd-openvas is able to run a scan. #6
Conversation
Functions related to the NVT information.
Import modules. Use 0 and 1 instead of 'no' and yes' for boolean in parameters.
Also improve code style.
Add some default scan results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at get_custom_vt_as_xml_str
, it does look not fully implemented to me.
ospd_openvas/nvticache.py
Outdated
xml_timeout.text = timeout | ||
preferences.append(xml_timeout) | ||
|
||
if len(resp) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make use of the fact that empty sequences are false and simplify this to if resp:
if you think it would improve readability, see https://www.python.org/dev/peps/pep-0008/#programming-recommendations
ospd_openvas/nvticache.py
Outdated
resp = ctx.lrange("nvt:%s" % oid, | ||
openvas_db.nvt_meta_fields.index("NVT_FILENAME_POS"), | ||
openvas_db.nvt_meta_fields.index("NVT_VERSION_POS")) | ||
if (isinstance(resp, list) and len(resp) > 0) is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above, len(resp) > 0
could be simplified to resp
if so desired -- or even reduce it to: if not isinstance(resp, list):
since isinstance(False, list)
is False
.
ospd_openvas/wrapper.py
Outdated
""" Create a string representation of the XML object from the | ||
custom data object. | ||
|
||
The custom XML object which is returned will be embedded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the function actually do what its docstring describes? As far as I can tell it merely returns its parameter custom
as-is.
Also, consider declaring this method a static method as it does not look like it modifies the instance.
Make method static and fix docstring.
Drop ChangeLog file.
Prepare the kb to run a scan.
Retrieve results from Redis.
When the scan finished, clean the redis kb.
If the scan is stopped with <stop_scan scan_id=...>, stop the scan cleanly and delete the redis kb.
Add custom NVTs metadata to the <get_vts/> response.