nessrest icon indicating copy to clipboard operation
nessrest copied to clipboard

scan_details pulls nothing

Open Kocrachon opened this issue 9 years ago • 0 comments

Trying to use scan_details to try to pull the UUIDs of already existing scans. However, I pull nothing. Since I don't get an error from incorrect name (which I did when there was a typo) it tells me that the scan is being detect and accessed, but nothing reports out. The scan is there, and has results in it, so not sure if I am not using it properly or if there is a different way for me to get the UUID from al already existing scan.

In [8]: test_scan = scan.scan_details('Scan 1 - Test') In [9]: print db_scan None In [10]: test_scan? Type: NoneType String form: None Docstring:

EDIT: After doing some digging, I have noticed that the JSON outputs like this.

u,'Scan1-Test'

Here, I am able to get working uuids

In [19]: for scans in scan.res["scans"]: ...: print scans["uuid"]

But the minute I do this, it breaks.

In [22]: for scans in scan.res["scans"]: ...: if scans["name"] == 'Scan1-Test': ...: print scans["uuid"]

And I get what I need, partially, with a trick like this.

In [24]: for scans in scan.res["scans"]: ...: if '1' in scans["name"]: ...: print scans["uuid"] ...: else: ...: print 'nothing' ...: 41235231e-6b53-8f24-1ac4-ef08c2ertewrert436336db2312a4

So potential problem with the JSON unicoding?

Kocrachon avatar Dec 07 '16 17:12 Kocrachon