nmap helper functions
This commit is contained in:
parent
be686a621b
commit
1a78780561
|
@ -7,8 +7,6 @@ if type htop >/dev/null; then
|
|||
fi
|
||||
|
||||
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 drun-it="docker run -it"
|
||||
|
|
|
@ -7,3 +7,25 @@ vifunction() {
|
|||
$EDITOR $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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue