Skip to content

Commit 5ab54f9

Browse files
committed
Update to version [v1.4.4]
1 parent 3b200e1 commit 5ab54f9

File tree

4 files changed

+76
-7
lines changed

4 files changed

+76
-7
lines changed

README.md

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ Converts/manipulates/extracts data from a nmap scan output.
44

55
Needs [xsltproc](http://xmlsoft.org/XSLT/xsltproc.html) as dependency.
66

7+
**Demo**
8+
9+
![Demo](demo.gif)
10+
11+
**Table of Contents**
12+
- [nmap-parse-output](#nmap-parse-output)
13+
- [Examples](#examples)
14+
- [Usage](#usage)
15+
- [Changelog](#changelog)
16+
- [Contribute](#contribute)
17+
- [Adding new Commands](#adding-new-commands)
18+
- [Installation](#installation)
19+
- [Bash Completion](#bash-completion)
20+
- [ZSH Completion](#zsh-completion)
21+
- [Arch Linux](#arch-linux)
22+
723
## Examples
824

925
Write HTML output to scan.html:
@@ -62,100 +78,131 @@ Remove all ports found in `scan-before.xml` from `scan-after.xml` and write the
6278
Generates a line break separated list of all hosts. Can be used to perform an additional scan on this hosts.
6379
Can be useful to generate a list of IPs for masscan with nmap (masscan has a more limited support for IP lists):
6480
nmap -Pn -n -sL -iL input.lst -oX all-ips.xml; nmap-parse-output all-ips.xml all-hosts
81+
6582
banner [service-name]
6683
Extracts a list of all ports with a specific service (e.g. http, ms-wbt-server, smtp) in host:port format.
6784
Note: This command is intended for the masscan XML output only.
85+
6886
blocked-ports
6987
Extracts all ports in host:port format, which either admin-prohibited or tcpwrapped.
88+
7089
host-ports-protocol
7190
Extracts a list of all *open* ports in host:port format and marks the protocol type (tcp, udp)
91+
7292
host-ports
7393
Extracts a list of all *open* ports in host:port format.
94+
7495
hosts-to-port [port]
7596
Extracts a list of all hosts that have the given port open in 'host (hostname)' format.
97+
7698
hosts
7799
Generates a line break separated list of all hosts with open ports. Can be used to perform an additional scan on this hosts.
100+
78101
http-ports
79102
Generates a line separated list of HTTP(s) all ports.
80103
Currently, the following services are detected as HTTP: http, https, http-alt, https-alt, http-proxy, sip, rtsp (potentially incomplete)
104+
81105
http-title
82106
Extracts a list of HTTP HTML titles in the following format:
83107
host:port HTML title
108+
84109
nmap-cmdline
85110
Shows the parameters passed to nmap of the runned scan
111+
86112
port-info [port]
87113
Extracts a list of extra information about the given port in the following format:
88114
port;service name;http title
115+
89116
ports
90117
Generates a comma-separated list of all ports. Can be used to verify if open/closed ports reachable from another host or generate port lists for specific environments. Filter closed/filtered ports.
118+
91119
product
92120
Extracts all detected product names.
121+
93122
service-names
94123
Extracts all detected service names.
124+
95125
service [service-name]
96126
Extracts a list of all *open* ports with a specific service (e.g. http, ms-wbt-server, smtp) in host:port format.
127+
97128
ssl-common-name
98129
Extracts a list of TLS/SSL ports with the commonName and Subject Alternative Name in the following format:
99130
host:port commonName X509v3 Subject Alternative Name
131+
100132
tls-ports
101133
Extracts a list of all TLS ports in host:port format. Works only after a script scan. Can be used to do a testssl.sh scan.
102134
Example testssl.sh command (generates a text and HTML report for each host):
103135
for f in `cat ~/ssl-hosts.txt`; do ./testssl.sh --logfile ~/testssl.sh-results/$f.log --htmlfile ~/testssl.sh-results/$f.html $f; done
104136
137+
105138
Manipulate Scan Commands:
106139
comment-hosts [hosts] [comment]
107140
Comments a list of hosts in scan result. Expects a comma-separated list as input. The comment will be displayed in the HTML report.
108141
Example:
109142
nmap-parse-output scan.xml comment-hosts '10.0.0.1,192.168.10.1' 'allowed services' | nmap-parse-output - html > report.html
110143
You can comment hosts from another scan, too:
111144
nmap-parse-output scan.xml comment-hosts $(./nmap-parse-output.sh scan-subnet.xml hosts | tr "\n" ",") 'this host was scanned in subnet, too.'
145+
112146
comment-ports [ports] [comment]
113147
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.
114148
Example:
115149
nmap-parse-output scan.xml comment-ports '80,10.0.0.1:8080' 'allowed services' | nmap-parse-output - html > report.html
116150
You can comment services, too:
117151
nmap-parse-output scan.xml comment-ports $(./nmap-parse-output.sh scan.xml service http | tr "\n" ",") 'this is a http port'
152+
118153
exclude-ports [ports]
119154
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.
120155
You can pipe the output, for instance:
121156
nmap-parse-output scan.xml exclude '80,443,192.168.0.2:80' | nmap-parse-output - service-names
157+
122158
exclude [hosts]
123159
Excludes a list of hosts from scan result by its IP address. Expects a comma-separated list as input.
124160
You can pipe the output, for instance:
125161
nmap-parse-output scan.xml exclude '192.168.1.1,192.168.1.20' | nmap-parse-output - service-names
162+
126163
include-ports [ports]
127164
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.
128165
You can pipe the output, for instance:
129166
nmap-parse-output scan.xml include-ports '80,443,192.168.0.2:8080' | nmap-parse-output - http-title
167+
130168
include [hosts]
131169
Filter a scan by a list of hosts so that only the specified hosts are in the output.
132170
Filter a list of hosts from scan result by its IP address. Expects a comma-separated list as input.
133171
You can pipe the output, for instance:
134172
nmap-parse-output scan.xml include '192.168.1.1,192.168.1.20' | nmap-parse-output - service-names
173+
135174
mark-ports [ports] [color]
136175
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.
137176
Example:
138177
nmap-parse-output scan.xml mark-ports '80,10.0.0.1:8080' red | nmap-parse-output - html > report.html
178+
139179
reachable
140180
Removes all hosts where all ports a filtered. Can be used to generate a smaller HTML report.
141181
Example usage to generate HTML report:
142182
nmap-parse-output scan.xml reachable | nmap-parse-output - html > scan.html
143183
184+
144185
Convert Scan Commands:
145186
html-bootstrap
146187
Converts the XML output into a fancy HTML report based on Bootstrap.
147188
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.
189+
148190
html
149191
Converts a XML output into a HTML report
192+
150193
to-json
151194
Converts a nmap scan output to JSON
152195
196+
153197
Misc Commands:
154198
155-
[v1.4.3]
199+
[v1.4.4]
156200

157201
## Changelog
158202

203+
* v1.4.4
204+
* Fixed bug in [bash completion](_nmap-parse-output) when installed system-wide
205+
* Improved documentation
159206
* v1.4.3
160207
* Fixed bug in [include-ports command](nmap-parse-output-xslt/include-ports.xslt)
161208
* v1.4.2
@@ -171,7 +218,9 @@ Remove all ports found in `scan-before.xml` from `scan-after.xml` and write the
171218
* v1.3.0
172219
* First public release
173220

174-
## Adding new Commands
221+
## Contribute
222+
223+
### Adding new Commands
175224

176225
Commands 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.
177226

@@ -208,14 +257,34 @@ More information about XSLT and writing new commands can be found here:
208257
- http://www.exslt.org/
209258
- http://xmlsoft.org/XSLT/xsltproc.html
210259

211-
## Bash Completion
260+
## Installation
261+
262+
Requierements:
263+
* bash
264+
* [xsltproc](http://xmlsoft.org/XSLT/xsltproc.html)
265+
266+
Check out the repository and run it:
267+
268+
git clone https://github.com/ernw/nmap-parse-output.git
269+
cd nmap-parse-output
270+
./nmap-parse-output
271+
272+
You 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:
273+
274+
export PATH="$PATH:$PATH_TO_YOUR_NMAP_PARSE_OUTPUT_DIR"
275+
276+
### Bash Completion
212277

213278
Bash completion can be enabled by adding the following line to your `~/.bash_profile` or `.bashrc`:
214279

215280
source ~/path/to/nmap-parse-output/_nmap-parse-output
216281

217-
## ZSH Completion
282+
### ZSH Completion
218283

219284
ZSH completion can be enabled by adding the following line to your `~/.zshrc`:
220285

221286
autoload bashcompinit && bashcompinit && source ~/path/to/nmap-parse-output/_nmap-parse-output
287+
288+
### Arch Linux
289+
290+
You can use the [AUR](https://aur.archlinux.org) package: https://aur.archlinux.org/packages/nmap-parse-output

_nmap-parse-output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
_nmap-parse-output_completions()
44
{
5-
local NPO_SCRIPT="$(whereis -b nmap-parse-output | cut -d ' ' -f 2-)"
5+
local NPO_SCRIPT="$(whereis -b nmap-parse-output | cut -d ' ' -f 2)"
66
if [ -h "$NPO_SCRIPT" ]; then
77
local NPO_SCRIPT="$(readlink "$NPO_SCRIPT")"
88
fi
@@ -29,4 +29,4 @@ _nmap-parse-output_completions()
2929
fi
3030
}
3131

32-
complete -F _nmap-parse-output_completions nmap-parse-output
32+
complete -F _nmap-parse-output_completions nmap-parse-output

demo.gif

942 KB
Loading

nmap-parse-output

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
NPO_VERSION=1.4.3
2+
NPO_VERSION=1.4.4
33

44
# get script path
55
SOURCE="${BASH_SOURCE[0]}"

0 commit comments

Comments
 (0)