Discussion:
map ports to hostnames in output xml
Aidy Lewis via dev
2018-10-02 09:44:26 UTC
Permalink
Hi,

I am trying to create some reports from the output XML after a NSE
vulnerability scan. I have run from a file that contains a number of
hostnames. Is it possible to extract all the portids (for example)
from a hostname using xpath?

e.g.,


Aidy Lewis via dev
2018-10-02 10:00:50 UTC
Permalink
Hi,


Sorry to bother you again, but I have managed to achieve the below through an Elixir library.

import SweetXml

result =
doc
|> xpath(
~x"//nmaprun/host"l,
ip: ~x"./address/@addr",
port: ~x"./ports/port/@portid"l
)

Many Thanks

Aidy

On 10/2/2018 at 10:44 AM, "Aidy Lewis via dev" <***@nmap.org> wrote:Hi,

I am trying to create some reports from the output XML after a NSE vulnerability scan. I have run from a file that contains a number of hostnames. Is it possible to extract all the portids (for example) from a hostname using xpath?

e.g.,

<hostname name=“xxxx.xxxx.xxx.xxxx.xxxx” type="PTR"/>


<port protocol="tcp" portid="111"><state state="open"
<port protocol="tcp" portid="9091"><state state="open"

And the same for the subsequent hostnames?

Many Thanks

Aidy

Loading...