Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #301 from ArnoStiefvater/scanner-params
Browse files Browse the repository at this point in the history
Add attribute to <get_scanner_details> for showing all available parameters
  • Loading branch information
jjnicola committed Jul 23, 2020
2 parents 98d5bb3 + a509108 commit 44a2493
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#288](https://github.com/greenbone/ospd/pull/288)
[#289](https://github.com/greenbone/ospd/pull/289)
- Extend get_vts with attribute version_only and return the version [#291](https://github.com/greenbone/ospd/pull/291)
- Allow to set all openvas parameters which are not strict openvas only parameters via osp. [#301](https://github.com/greenbone/ospd/pull/301)

### Changes
- Modify __init__() method and use new syntax for super(). [#186](https://github.com/greenbone/ospd/pull/186)
Expand Down
8 changes: 7 additions & 1 deletion doc/OSP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
<command>
<name>get_scanner_details</name>
<summary>Return scanner description and parameters</summary>
<pattern/>
<pattern>
<attrib>
<name>list_all</name>
<summary>List all available scanner parameters. Not only those visible to the client.</summary>
<type>boolean</type>
</attrib>
</pattern>
<response>
<pattern>
<attrib>
Expand Down
11 changes: 11 additions & 0 deletions ospd/command/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,20 @@ def handle_xml(self, xml: Element) -> bytes:
@return: Response string for <get_scanner_details> command.
"""
list_all = xml.get('list_all')
list_all = True if list_all == '1' else False

desc_xml = Element('description')
desc_xml.text = self._daemon.get_scanner_description()
scanner_params = self._daemon.get_scanner_params()

if not list_all:
scanner_params = {
key: value
for (key, value) in scanner_params.items()
if value.get('visible_for_client')
}

details = [
desc_xml,
OspResponse.create_scanner_params_xml(scanner_params),
Expand Down

0 comments on commit 44a2493

Please sign in to comment.