{"id":13588921,"url":"https://github.com/ernw/nmap-parse-output","last_synced_at":"2026-02-21T17:36:54.003Z","repository":{"id":37525902,"uuid":"145396478","full_name":"ernw/nmap-parse-output","owner":"ernw","description":"Converts/manipulates/extracts data from a Nmap scan output.","archived":false,"fork":false,"pushed_at":"2024-04-29T13:23:43.000Z","size":870,"stargazers_count":541,"open_issues_count":7,"forks_count":77,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-10-22T06:37:01.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"XSLT","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ernw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-20T09:30:51.000Z","updated_at":"2025-10-16T04:41:20.000Z","dependencies_parsed_at":"2024-11-06T08:34:22.323Z","dependency_job_id":"a3dd81d5-bb3a-4f39-bc33-26cefbab52cb","html_url":"https://github.com/ernw/nmap-parse-output","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":0.08333333333333337,"last_synced_commit":"6405abf1afcee7b3b120a37af574db1eba770691"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ernw/nmap-parse-output","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernw%2Fnmap-parse-output","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernw%2Fnmap-parse-output/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernw%2Fnmap-parse-output/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernw%2Fnmap-parse-output/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ernw","download_url":"https://codeload.github.com/ernw/nmap-parse-output/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernw%2Fnmap-parse-output/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:07:01.444Z","updated_at":"2026-02-21T17:36:53.958Z","avatar_url":"https://github.com/ernw.png","language":"XSLT","funding_links":[],"categories":["XSLT"],"sub_categories":[],"readme":"# nmap-parse-output\n\nConverts/manipulates/extracts data from a nmap scan output.\n\nNeeds [xsltproc](http://xmlsoft.org/XSLT/xsltproc.html) as dependency.\n\n**Demo**\n\n![Demo](demo.gif)\n\n**Table of Contents**\n- [nmap-parse-output](#nmap-parse-output)\n  - [Examples](#examples)\n  - [Usage](#usage)\n  - [Changelog](#changelog)\n  - [Contribute](#contribute)\n    - [Adding new Commands](#adding-new-commands)\n  - [Installation](#installation)\n    - [Bash Completion](#bash-completion)\n    - [ZSH Completion](#zsh-completion)\n    - [Distro package](#distro-prackage)\n\n## Examples\n\nWrite HTML output to scan.html:\n\n    $ ./nmap-parse-output scan.xml html \u003e scan.html\n\nGenerates a list of all HTTP(s) ports:\n\n    $ ./nmap-parse-output scan.xml http-ports   \n    http://192.168.0.1:8081\n    https://192.168.0.1:8443\n\nList all names of detected services and get a list of hosts with the port for the service http-proxy:\n\n    $ ./nmap-parse-output scan.xml service-names\n    http\n    https\n    http-proxy\n    ms-wbt-server\n    smtp\n    $ ./nmap-parse-output scan.xml service http-proxy\n    192.168.0.24:8085\n    192.168.0.25:9000\n\nExclude some hosts from a scan and generate a list of ports:\n\n    $ ./nmap-parse-output scan.xml exclude '192.168.1.1,192.168.1.20' | nmap-parse-output - ports\n    22,80,443,8080\n\nFilter `scan-all.xml` to include only hosts scanned in `scan-subnet.xml` and write the output to `filtered-scan.xml`:\n\n    $ ./nmap-parse-output scan-all.xml include $(./nmap-parse-output.sh scan-subnet.xml hosts | tr \"\\n\" \",\") \u003e filtered-scan.xml\n\nGenerate a subreport with results only from the networks 10.0.1.0/24 and 10.80.0.0/24 from `big-scan-result.xml`:\n\n    $ ./nmap-parse-output big-scan-result.xml \\\n      include $(nmap -Pn -n -sL 10.0.1.0/24 10.80.0.0/24 -oX - | nmap-parse-output - all-hosts | tr \"\\n\" ',') \\\n      \u003e networks-10.0.1.0-24-and-10.80.0.0-24.xml\n\nAdd comments to a scan, mark specific ports red, and generate a HTML report with the annotations:\n\n    $ ./nmap-parse-output scan.xml comment-ports '8080,10.0.20.4:443' 'this port should be filtered'\n      | ./nmap-parse-output - mark-ports '8080,10.0.20.4:443' red\n      | ./nmap-parse-output - comment-hosts '10.0.20.1' 'look further into this host'\n      | ./nmap-parse-output - html \u003e test.html\n\nRemove all ports found in `scan-before.xml` from `scan-after.xml` and write the output to `filtered-scan.xml`:\n\n    $ ./nmap-parse-output scan-after.xml exclude-ports $(./nmap-parse-output.sh scan-before.xml host-ports | tr \"\\n\" \",\") \u003e filtered-scan.xml\n\nGroup hosts by open TCP ports:\n\n    $ ./nmap-parse-output scan.xml group-by-ports\n    - Open TCP ports 22,443 on:\n      - 192.168.1.73 (web.local)\n      - 192.168.1.74 (web2.local)\n    - Open TCP ports 8080 on:\n      - 192.168.1.135\n    - No open TCP ports on:\n      - 192.168.1.71 (db.local)\n      - 192.168.1.81\n\nRerun TCP scan for all alive hosts but only scan open ports found in the previous scan:\n\n      $ for host in ./nmap-parse-output scan.xml hosts; do nmap -sSVC -p $(./nmap-parse-output scan.xml include $host | nmap-parse-output - ports) -oA $host.xml -vv -Pn; done\n\n## Usage\n\n      Usage: ./nmap-parse-output [options]... \u003cnmap-xml-output\u003e \u003ccommand\u003e [command-parameters]...\n      \n      Converts/manipulates/extracts data from nmap scan XML output.\n      \n      Options:\n        -u, --unfinished-scan\t\t\t try to read an unfinished scan output\n      \n      Extract Data Commands:\n        all-hosts \n              Generates a line break separated list of all hosts. Can be used to perform an additional scan on this hosts.\n              Can be useful to generate a list of IPs for masscan with nmap (masscan has a more limited support for IP lists):\n                nmap -Pn -n -sL -iL input.lst -oX all-ips.xml; nmap-parse-output all-ips.xml all-hosts\n      \n        banner [service-name]\n              Extracts a list of all ports with a specific service (e.g. http, ms-wbt-server, smtp) in host:port format.\n              Note: This command is intended for the masscan XML output only.\n      \n        blocked-ports \n              Extracts all ports in host:port format, which either admin-prohibited or tcpwrapped.\n      \n        group-by-ports \n              Groups hosts by open TCP ports and generates a human-readable list in the markdown format.\n      \n        group-by-product \n              Groups open ports by product name and generates a human-readable list in the markdown format. The command ignores ports with empty product name.\n      \n        group-by-service \n              Groups open ports by service name and generates a human-readable list in the markdown format.\n      \n        host-ports-protocol \n              Extracts a list of all *open* ports in host:port format and marks the protocol type (tcp, udp)\n      \n        host-ports \n              Extracts a list of all *open* ports in host:port format.\n      \n        hosts-to-port [port]\n              Extracts a list of all hosts that have the given port open in 'host (hostname)' format.\n      \n        hosts \n              Generates a line break separated list of all hosts with open ports. Can be used to perform an additional scan on this hosts.\n      \n        http-info \n              Extracts a list of extra information about the HTTP ports from a script scan in the following format:\n              host:port   service-name    service-tunnel  product  http-server-header  http-title   redirect_url\n      \n        http-ports \n              Generates a line separated list of all HTTP(s) ports. Script scan output is recommended.\n              Currently, the following services are detected as HTTP: http, https, http-alt, https-alt, http-proxy, sip, rtsp, soap, vnc-http, caldav (potentially incomplete) and to get a more reliable result all ports which which have output in the http-methods script. \n              On ports where HTTPs and HTTP is responding, the HTTPs port is preferred.\n      \n        http-title \n              Extracts a list of HTTP HTML titles in the following format:\n              host:port\tHTML title\n      \n        nmap-cmdline \n              Shows the parameters passed to nmap of the runned scan\n      \n        port-info [port]\n              Extracts a list of extra information about the given port in the following format:\n              port;service-name;http-server-header;http title\n      \n        ports-reachable \n              Generates a comma-separated list of all reachable ports (open and closed, unfiltered). Can be used to verify if ports reachable from another host or generate port lists for specific environments.\n      \n        ports \n              Generates a comma-separated list of all open ports. Can be used to verify if open ports reachable from another host or generate port lists for specific environments. Closed/filtered ports are not shown in the list.\n      \n        product \n              Extracts all detected product names.\n      \n        search-product \n              Search in product names (case sensitive).\n      \n        service-names \n              Extracts all detected service names (on open ports).\n      \n        service [service-name]\n              Extracts a list of all *open* ports with a specific service (e.g. http, ms-wbt-server, smtp) in host:port format.\n      \n        show-comments \n              Shows comments added by the comment-* commands.\n      \n        ssl-common-name \n              Extracts a list of TLS/SSL ports with the commonName and Subject Alternative Name in the following format:\n              host:port\tcommonName\tX509v3 Subject Alternative Name\n      \n        tls-ports \n              Extracts a list of all TLS ports in host:port format. Works only reliable after a script scan. Can be used to do a testssl.sh scan.\n              Example testssl.sh command (generates a text and HTML report for each host):\n                  for f in `cat ~/ssl-hosts.txt`; do ./testssl.sh --logfile ~/testssl.sh-results/$f.log --htmlfile ~/testssl.sh-results/$f.html $f; done\n      \n      \n      Manipulate Scan Commands:\n        comment-hosts [hosts] [comment]\n              Comments a list of hosts in scan result. Expects a comma-separated list as input. The comment will be displayed in the HTML report.\n              Example:\n                  nmap-parse-output scan.xml comment-hosts '10.0.0.1,192.168.10.1' 'allowed services' | nmap-parse-output - html \u0026gt; report.html\n              You can comment hosts from another scan, too:\n                  nmap-parse-output scan.xml comment-hosts $(./nmap-parse-output.sh scan-subnet.xml hosts | tr \"\\n\" \",\") 'this host was scanned in subnet, too.'\n      \n        comment-ports [ports] [comment]\n              Comments a list of ports or hosts with port (in address:port format) in scan result. Expects a comma-separated list as input. The comment will be displayed in the HTML report.\n              Example:\n                  nmap-parse-output scan.xml comment-ports '80,10.0.0.1:8080' 'allowed services' | nmap-parse-output - html \u0026gt; report.html\n              You can comment services, too:\n                  nmap-parse-output scan.xml comment-ports $(./nmap-parse-output.sh scan.xml service http | tr \"\\n\" \",\") 'this is a http port'\n      \n        exclude-ports [ports]\n              Excludes a list of ports or ports of a specific host (in address:port format) from a scan result. Expects a comma-separated list as input.\n              You can pipe the output, for instance:\n                  nmap-parse-output scan.xml exclude '80,443,192.168.0.2:80' | nmap-parse-output - service-names\n      \n        exclude [hosts]\n              Excludes a list of hosts from scan result by its IP address. Expects a comma-separated list as input.\n              You can pipe the output, for instance:\n                  nmap-parse-output scan.xml exclude '192.168.1.1,192.168.1.20' | nmap-parse-output - service-names\n      \n        include-ports [ports]\n              Filter a scan by a list of ports or ports of a specific host (in address:port format) so that only the specified ports are in the output. Expects a comma-separated list as input.\n              You can pipe the output, for instance:\n                  nmap-parse-output scan.xml include-ports '80,443,192.168.0.2:8080' | nmap-parse-output - http-title\n      \n        include [hosts]\n              Filter a scan by a list of hosts so that only the specified hosts are in the output.\n              Filter a list of hosts from scan result by its IP address. Expects a comma-separated list as input.\n              You can pipe the output, for instance:\n                  nmap-parse-output scan.xml include '192.168.1.1,192.168.1.20' | nmap-parse-output - service-names\n      \n        mark-ports [ports] [color]\n              Marks a list of ports or hosts with port (in address:port format) with the given color in scan result. Expects a comma-separated list as input. The comment will be displayed in the HTML report.\n              Example:\n                  nmap-parse-output scan.xml mark-ports '80,10.0.0.1:8080' red | nmap-parse-output - html \u0026gt; report.html\n      \n        reachable \n              Removes all hosts where all ports a filtered. Can be used to generate a smaller HTML report.\n              Example usage to generate HTML report:\n                  nmap-parse-output scan.xml reachable | nmap-parse-output - html \u0026gt; scan.html\n      \n      \n      Convert Scan Commands:\n        html-bootstrap \n              Converts the XML output into a fancy HTML report based on Bootstrap.\n              Note: This HTML report requests JS/CSS libs from CDNs. However, the generated file uses the no-referrer meta tag and subresource integrity to protect the confidentiality.\n      \n        html \n              Converts a XML output into a HTML report\n      \n        to-json \n              Converts a nmap scan output to JSON\n      \n      \n      Misc Commands:\n      \n      [v1.5.1]\n\n## Changelog\n\n* v1.5.1\n  * More reliable SSL/TLS detection\n  * More reliable HTTP(s) port detection\n  * Added group-by-service command\n  * Added group-by-product command\n  * Added http-info command\n  * Added http-server-header to port-info command\n  * Added hostname to group-by-ports command\n* v1.4.6\n  * Added search-product command\n  * Added group-by-ports command\n  * Added examples for generating subreports, group-by-ports command, and rerun scans\n* v1.4.5\n  * Show only service-names of open ports\n  * Splitted ports command in: ports and ports-reachable\n  * Added show-comments command\n* v1.4.4\n  * Fixed bug in [bash completion](_nmap-parse-output) when installed system-wide\n  * Improved documentation\n* v1.4.3\n  * Fixed bug in [include-ports command](nmap-parse-output-xslt/include-ports.xslt)\n* v1.4.2\n  * Added [nmap-bootstrap-xsl](https://github.com/honze-net/nmap-bootstrap-xsl) as [html-bootstrap command](nmap-parse-output-xslt/html-bootstrap.xslt)\n  * Added [nmap-cmdline command](nmap-parse-output-xslt/nmap-cmdline.xslt)\n  * Added [host-ports-protocol command](nmap-parse-output-xslt/host-ports-protocol.xslt)\n* v1.4.1\n  * Improved error handling\n  * Bugfix in ports command\n* v1.4.0\n  * Support for unfinished scans\n  * Commands are categorized as convert, manipulate, extract and misc now\n* v1.3.0\n  * First public release\n\n## Contribute\n\n### Adding new Commands\n\nCommands are written as [XSLT](https://en.wikipedia.org/wiki/XSLT). See [nmap-parse-output-xslt/](nmap-parse-output-xslt/) if you want to add new commands. A good way is mostly copying an existing script that does something similar.\n\nThe documentation printed in the help page can be written with the ``\u003ccomment\u003e`` tag (XML namespace: http://xmlns.sven.to/npo). A command can have one of the following categories: convert, manipulate or extract. You can set it with the ``\u003ccategory\u003e`` tag. It is not necessary to set a category, uncategorized commands are will be shown as a misc command in the help page. Commands with an invalid category will not be shown on the help page.\n\nParameters will be passed as variables named ``$param1``, ``$param2`` and so on. An post processing command can be added with the ``\u003cpost-processor\u003e`` tag.\n\nExample XSLT file:\n\n    \u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:npo=\"http://xmlns.sven.to/npo\"\u003e\n    \u003cnpo:comment\u003e\n            \u003c!-- Added documentation here --\u003e\n    \u003c/npo:comment\u003e\n    \u003cnpo:category\u003eextract\u003c/npo:category\u003e\n    \u003cnpo:post-processor\u003esort | uniq\u003c/npo:post-processor\u003e\n    \n    \u003cxsl:output method=\"text\" /\u003e\n    \u003cxsl:strip-space elements=\"*\" /\u003e\n    \n    \u003cxsl:template match=\"/nmaprun/host/ports/port\"\u003e\n        \u003c!-- add your template here --\u003e\n        \u003cxsl:if test=\"state/@state = $param1\"\u003e\n            \u003cxsl:value-of select=\"../../address/@addr\"/\u003e\n            \u003cxsl:text\u003e, \u003c/xsl:text\u003e\n        \u003c/xsl:if\u003e\n    \u003c/xsl:template\u003e\n    \n    \u003cxsl:template match=\"text()\" /\u003e\n    \u003c/xsl:stylesheet\u003e\n\nMore information about XSLT and writing new commands can be found here:\n- http://xmlsoft.org/XSLT/\n- http://www.w3.org/TR/xslt\n- http://www.exslt.org/\n- http://xmlsoft.org/XSLT/xsltproc.html\n\n## Installation\n\nRequierements:\n* bash\n* [xsltproc](http://xmlsoft.org/XSLT/xsltproc.html)\n\nCheck out the repository and run it:\n\n      git clone https://github.com/ernw/nmap-parse-output.git\n      cd nmap-parse-output\n      ./nmap-parse-output\n\nYou can create a link to the ``nmap-parse-output`` script in your local bin directory or add the directory into your path if you want to execute it directly. Add the following line into your ``~/.bash_profile`` or your ``~/.zshrc`` file:\n\n      export PATH=\"$PATH:$PATH_TO_YOUR_NMAP_PARSE_OUTPUT_DIR\"\n\n### Bash Completion\n\nBash completion can be enabled by adding the following line to your `~/.bash_profile` or `.bashrc`:\n\n    source ~/path/to/nmap-parse-output/_nmap-parse-output\n\n### ZSH Completion\n\nZSH completion can be enabled by adding the following line to your `~/.zshrc`:\n\n    autoload bashcompinit \u0026\u0026 bashcompinit \u0026\u0026 source ~/path/to/nmap-parse-output/_nmap-parse-output\n\n### Distro Packages\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/nmap-parse-output.svg)](https://repology.org/project/nmap-parse-output/versions)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernw%2Fnmap-parse-output","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fernw%2Fnmap-parse-output","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernw%2Fnmap-parse-output/lists"}