Discussion:
[Openvas-plugins] get_http function
margaus M.
2017-04-12 08:26:44 UTC
Permalink
Hello!

I have read that this function get_http_port(default) reads the KB item
“Services/www”, verifies that the port is open, that there is an HTTP
server behind it, and returns it. My questions are:

1. Does this function verifies HTTPS server (that the port 443 is open)?
2. If I want this function to return server behind it and I don't know
the port, should I write just "port = get_http_port(default)" and its done?
Or should I indicate first of all port 80 and if "if
(!get_port_state(port))" then indicate port 443 and so...?
3. If I don't have any dependencies of other plugins and at the begining
I do a port = get_http_port(default: 80); why is that it works? What is in
the KB at this moment if I haven't write in it anything? How does this
exactly works?

Thank you very much for your time
Christian Fischer
2017-04-12 16:25:27 UTC
Permalink
Hi,
Post by margaus M.
1. Does this function verifies HTTPS server (that the port 443 is open)?
this function (any most other HTTP based functions) doesn't care about
HTTP vs. HTTPS. This is internally handled by the scanner via the
find_service.nasl.
Post by margaus M.
2. If I want this function to return server behind it and I don't know
the port, should I write just "port = get_http_port(default)" and
its done? Or should I indicate first of all port 80 and if "if
(!get_port_state(port))" then indicate port 443 and so...?
3. If I don't have any dependencies of other plugins and at the
begining I do a port = get_http_port(default: 80); why is that it
works? What is in the KB at this moment if I haven't write in it
anything? How does this exactly works?
Those are better explained with examples:

Example 1:
Portlist: All TCP
Webservers at ports 8080, 8443 and 60000 on target
unscanned_closed = yes in your scan config

get_http_port(default:80) will fork and return 8080, 8443 and 60000 to
the NVT calling this function (no matter if they are running on HTTP or
HTTPS)

Example 2:
Portlist: 1-25/tcp
No Webservers, only port 25 open on target
unscanned_closed = yes in your scan config

get_http_port(default:80) will exit the NVT as no webserver was
identified and unscanned_closed is set to yes

Example 3:
Portlist: 1-25/tcp
No Webservers, only port 25 open on target
unscanned_closed = no in your scan config

get_http_port(default:80) will fork and return 80 to the NVT calling
this function

Regards,

Loading...