You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
557 B

  1. #!/bin/bash
  2. probe () {
  3. ping -c1 -w5 $1 >&- 2>&- || touch /tmp/pingfail.$1
  4. }
  5. removePingFail () {
  6. rm /tmp/pingfail.* 2>&-
  7. }
  8. echo Pinging IPs...
  9. echo -ne '\n'
  10. echo -ne '########## . . . . . . . . . . (33%)\r'
  11. sleep 1
  12. echo -ne '#################### . . . . . (66%)\r'
  13. sleep 2
  14. echo -ne '############################## (100%)\n'
  15. echo -ne '\n'
  16. echo Loading IPs...
  17. removePingFail
  18. for i in $(seq 1 255); do
  19. probe 192.168.0.$i &
  20. done;
  21. wait
  22. for ip in /tmp/pingfail.*; do
  23. echo ${ip#*.}
  24. done | sort -nt. -k1,1 -k2,2 -k3,3 -k4,4
  25. removePingFail