As picture showed above, since mtr can only traceroute one host once, how can I "scan" the whole network (172.16.0.0/16) and find all the hosts which only got 2 hops, with a script? Thank you.
Asked
Active
Viewed 1,560 times
2 Answers
1
#!/bin/bash
touch result
for ip in 172.16.{35..254}.{1..254}
do
echo "Trying $ip ... "
hops=$( mtr -c 5 -r -n4 -T $ip | wc -l )
if [[ "$hops" == 4 ]]; then
echo "Yes!"
echo $ip >> result
fi
done

Brandon
- 61
- 1
- 7
-2

user1150125
- 93
- 6
-
2Maybe you should copy/paste text instead of showing scripts as an image -> downvoting. – Marki Mar 11 '19 at 16:46