Closed oodgaard closed 10 years ago
It would be great to get some feed back on this. The app I'm using it for requires a method to retrieve the report hosts.
It looks fine at a quick glance, but I would like to test the PR first. I also need to check in detail the need for the hostObjectToArray()
function.
I'll let you know asap thanks!
The hostObjectToArray method was just to save duplication.
Ok I have had a look at this now, and have some quick questions if you don't mind?
Consider the below response from the API for /report/hosts
{
"reply": {
"seq": "2752",
"status": "OK",
"contents": {
"hostlist": {
"host": [
{
"hostname": "[redact]",
"severity": "13",
"severitycount": {
"item": [
{
"severitylevel": "0",
"count": "0"
},
{
"severitylevel": "1",
"count": "13"
},
{
"severitylevel": "2",
"count": "0"
},
{
"severitylevel": "3",
"count": "0"
}
]
},
"scanprogresscurrent": "60164",
"scanprogresstotal": "60164",
"numchecksconsidered": "66392",
"totalchecksconsidered": "66392"
},
{
"hostname": "[redact]",
"severity": "26",
"severitycount": {
"item": [
{
"severitylevel": "0",
"count": "0"
},
{
"severitylevel": "1",
"count": "25"
},
{
"severitylevel": "2",
"count": "1"
},
{
"severitylevel": "3",
"count": "0"
}
]
},
"scanprogresscurrent": "4966",
"scanprogresstotal": "4966",
"numchecksconsidered": "66392",
"totalchecksconsidered": "66392"
},
[...]
Why do we have to do the is_array()
and is_object()
checks? Can't we simply check if hostlist
is set and that it contains more than 0 entries, and then loop populating the return array? I think if I understand this it will explain the need for the hostObjectToArray()
function.
Thanks for the contribution :)
Oh yes. Before I forget, we also need to add the required testing to NessusTesting.php
for this new function.
If one host is returned, then:
hostlist": { "host": { ... } }
When more than one host:
hostlist": { "host": [ {...}, {...} ] }
Aha ok now I understand. Thanks for the explanation. :)
I'll admit I don't really like the dangling hostObjectToArray()
function, but for now it will be fine.
If we can get the test for this function completed too then a new release can be pushed too.
Thanks! :+1:
Not sure if you were planning on implementing this feature. I found it handy to report scan progress just like the Nessus control panel.