Skip to content

Commit c2cb32b

Browse files
added simple by hostname
1 parent 9d075c3 commit c2cb32b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
#title :nmap-open-ports-simple-by-hostname.sh
4+
#description :Extract Hostname:Port from Nmap XML output
5+
#author :Brandon Scholet @brandonscholet [email protected]
6+
#date :20230725
7+
#version :1.0
8+
#usage :nmap-open-ports-simple-by-hostname.sh nmap-results.xml
9+
#repository :https://github.com/RedSiege/rstools
10+
#notes :Install xmlstarlet. Based on https://gist.github.com/erikvip/7a8972a4571ccb6639a2
11+
12+
if [ -z "$1" ]; then
13+
echo "You must supply an Nmap xml file"
14+
exit
15+
fi
16+
17+
xmlstarlet sel -t -m '//port/state[@state="open"]/parent::port' -v 'ancestor::host/hostnames/hostname[@type="user"]/@name' -o : -v './@portid' -n "$1"
18+

0 commit comments

Comments
 (0)