Sken IP adres na UBNT: Porovnání verzí
Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
Bez shrnutí editace |
Bez shrnutí editace |
||
Řádek 47: | Řádek 47: | ||
do | do | ||
wget -qO- http://$address$i:$port >/dev/null 2>&1 && echo $address$i; | wget -qO- http://$address$i:$port >/dev/null 2>&1 && echo $address$i; | ||
done | |||
= Skript vše v jednom = | |||
# rozsah lokalnich IP adres | |||
address="192.168.1." | |||
# cislo prvni IP adresy | |||
start=1 | |||
# cislo posledni IP adresy | |||
end=254 | |||
# porty HTTP ke skenovani | |||
ports="80 8080" | |||
iface=`ip addr | grep $address | awk '{print $NF}'`; | |||
for i in `seq $start $end`; | |||
do | |||
ip=$address$i | |||
echo -n "$ip: " | |||
ping -q -c1 -W1 $ip >/dev/null && echo -n "ping "; | |||
arping -q -c1 -w1 -I $iface $ip >/dev/null && echo -n "arping "; | |||
for port in $ports; | |||
do | |||
wget -qO- http://$ip:$port >/dev/null 2>&1 && echo -n "port $port "; | |||
done | |||
echo "" | |||
done | done |
Verze z 6. 10. 2022, 14:37
Přes SSH v konzoli, vždy upravte proměnné:
address = rozsah lokálních IP adres
start = číslo počáteční IP adresy
end = číslo koncové IP adresy
port = port, na kterém běží webové rozhraní (pouze HTTP)
ping
address="192.168.1."; start=1; end=254; for i in `seq $start $end`; do up=`ping -c1 -W1 $address$i | grep "1 packets received" | wc -l`; if [ "$up" -eq 1 ]; then echo $address$i; fi; done
arping
address="192.168.1."; start=1; end=254; iface=`ip addr | grep $address | awk '{print $NF}'`; for i in `seq $start $end`; do up=`arping -c1 -w1 -I $iface $address$i | grep "Received 1 replies" | wc -l`; if [ "$up" -eq 1 ]; then echo $address$i; fi; done
wget
address="192.168.1."; start=1; end=254; port=80; for i in `seq $start $end`; do wget -qO- http://$address$i:$port >/dev/null 2>&1 && echo $address$i; done
Skript vše v jednom
# rozsah lokalnich IP adres address="192.168.1." # cislo prvni IP adresy start=1 # cislo posledni IP adresy end=254 # porty HTTP ke skenovani ports="80 8080" iface=`ip addr | grep $address | awk '{print $NF}'`; for i in `seq $start $end`; do ip=$address$i echo -n "$ip: " ping -q -c1 -W1 $ip >/dev/null && echo -n "ping "; arping -q -c1 -w1 -I $iface $ip >/dev/null && echo -n "arping "; for port in $ports; do wget -qO- http://$ip:$port >/dev/null 2>&1 && echo -n "port $port "; done echo "" done