Skip to content

Commit

Permalink
Merge pull request #171 from jjnicola/send-msg
Browse files Browse the repository at this point in the history
Send messages generated by the scanner main process.
  • Loading branch information
jjnicola authored Dec 3, 2019
2 parents 3b4b8fb + 3d836e7 commit da43af1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Check the vt's preference value for type 'file'. [#130](https://github.com/greenbone/ospd-openvas/pull/130).
- Check for malformed credentials. [#160](https://github.com/greenbone/ospd-openvas/pull/160).
- Send messages generated by the scannner main process. [#171](https://github.com/greenbone/ospd-openvas/pull/171).

### Changed
- Less strict checks for the nvti cache version.
Expand Down
7 changes: 4 additions & 3 deletions ospd_openvas/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,13 +925,13 @@ def get_openvas_result(self, scan_id, current_host):
res = self.openvas_db.get_result()
while res:
msg = res.split('|||')
roid = msg[3]
roid = msg[3].strip()
rqod = ''
rname = ''
rhostname = msg[1] if msg[1] else ''
rhostname = msg[1].strip() if msg[1] else ''
host_is_dead = "Host dead" in msg[4]

if not host_is_dead:
if roid and not host_is_dead:
if self.vts[roid].get('qod_type'):
qod_t = self.vts[roid].get('qod_type')
rqod = self.nvti.QOD_TYPES[qod_t]
Expand Down Expand Up @@ -1507,6 +1507,7 @@ def exec_scan(self, scan_id, target):

ctx = self.openvas_db.kb_connect(self.main_kbindex)
self.openvas_db.set_redisctx(ctx)
self.get_openvas_result(scan_id, "")
dbs = self.openvas_db.get_list_item('internal/dbindex')
for i in list(dbs):
if i == self.main_kbindex:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,11 @@ def test_get_openvas_result(self, mock_ospd, mock_nvti, mock_db):
mock_ospd.assert_called_with(
'123-456',
host='localhost',
hostname=' ',
hostname='',
name='',
port='general/Host_Details',
qod='',
test_id=' ',
test_id='',
value='Host dead',
)

Expand Down

0 comments on commit da43af1

Please sign in to comment.