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

Ospd-openvas is able to run a scan. #6

Merged
merged 12 commits into from
Jun 29, 2018

Conversation

jjnicola
Copy link
Member

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.

@jjnicola jjnicola requested review from wiegandm and janowagner June 28, 2018 10:29
Copy link
Member

@wiegandm wiegandm left a 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.

xml_timeout.text = timeout
preferences.append(xml_timeout)

if len(resp) > 0:
Copy link
Member

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

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:
Copy link
Member

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.

""" Create a string representation of the XML object from the
custom data object.

The custom XML object which is returned will be embedded
Copy link
Member

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.
@jjnicola jjnicola merged commit d3113a2 into greenbone:master Jun 29, 2018
@jjnicola jjnicola deleted the start-stop-scan branch June 29, 2018 06:43
ArnoStiefvater pushed a commit to ArnoStiefvater/ospd-openvas that referenced this pull request Oct 25, 2021
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