This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nmap-uphosts() { | |
FILE=`realpath $1` | |
echo " | |
from lxml import etree | |
t = etree.parse('$FILE') | |
if \"-Pn\" in t.xpath(\"string(@args)\"): # port scan | |
hosts = t.xpath(\"/*/host[ports/port/state[@state='open']]/address[@addrtype='ipv4']/@addr\") | |
else: # ping scan | |
hosts = t.xpath(\"/*/host[status[@state='up']]/address[@addrtype='ipv4']/@addr\") | |
print(' '.join(hosts)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# use none for unchanged color | |
# match groups appear to match in reverse order | |
# | |
# https://github.com/pengwynn/grc/blob/master/grcat | |
# | |
# ip address | |
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} | |
colours=bold yellow | |
====== |
NewerOlder