1
0
Fork 0

nmap helper functions

This commit is contained in:
Massaki Archambault 2018-03-23 11:27:34 -04:00
parent be686a621b
commit 1a78780561
2 changed files with 22 additions and 2 deletions

View File

@ -7,8 +7,6 @@ if type htop >/dev/null; then
fi fi
alias http-server="python -m http.server" alias http-server="python -m http.server"
alias nmap-libvirt="nmap 192.168.122.0/24"
alias xsel="xsel -b"
alias rename="perl-rename" alias rename="perl-rename"
alias drun-it="docker run -it" alias drun-it="docker run -it"

View File

@ -7,3 +7,25 @@ vifunction() {
$EDITOR $ZSH_CUSTOM/101-function.zsh $EDITOR $ZSH_CUSTOM/101-function.zsh
source $ZSH_CUSTOM/101-function.zsh source $ZSH_CUSTOM/101-function.zsh
} }
nmap-libvirt() {
local addr_list=""
for link in $(ip link show up | grep -Eo 'virbr[0-9]+'); do
for addr in $(ip addr show $link | grep -oP '(?<=inet )([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}'); do
addr_list="$addr_list $addr"
done
done
echo "Scanning $addr_list"
nmap $@ $addr_list
}
nmap-local() {
local addr_list=""
for link in $(ip link show up | grep -Eo '(eth|wlan)[0-9]+'); do
for addr in $(ip addr show $link | grep -oP '(?<=inet )([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}'); do
addr_list="$addr_list $addr"
done
done
echo "Scanning $addr_list"
nmap $@ $addr_list
}