-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnmap-visualize.sh
More file actions
30 lines (25 loc) · 872 Bytes
/
Copy pathnmap-visualize.sh
File metadata and controls
30 lines (25 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
## 1. Take input XML file path argument
## 2. Output visualized HTML file into input file's directory
## 3. Open chromium new tab (can be changed to any browser in the script)
### Requires readlink, basename, dirname (pre-installed in most Linux distros) and xsltproc
### wget https://raw.githubusercontent.com/honze-net/nmap-bootstrap-xsl/master/nmap-bootstrap.xsl -O /opt/others/
XSL=/opt/others/nmap-bootstrap.xsl ### Change this path
if [ "$#" -ne 1 ]; then
echo "[*] Usage: $0 <input XML file>"
exit 1
fi
if [[ -f $1 ]]; then
INPUT_FILE=$(readlink -f $1)
INPUT_NAME=$(basename $1)
OUTPUT_DIR=$(dirname $1)
OUTPUT_NAME="${INPUT_NAME%.*}"
OUTPUT_FILE=$OUTPUT_DIR/$OUTPUT_NAME.html
if [[ ! -f $OUTPUT_FILE ]]; then
xsltproc -o $OUTPUT_FILE $XSL $INPUT_FILE
fi
chromium &> /dev/null $OUTPUT_FILE
else
echo "[*] File does not exist!"
exit 1
fi