Nmap Development mailing list archives

Re: map ports to hostnames in output xml


From: Aidy Lewis via dev <dev () nmap org>
Date: Tue, 02 Oct 2018 11:00:50 +0100


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" <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

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: