sergio_educacionit

scanhosts.sh

Oct 6th, 2026
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. trap 'exit' INT
  4.  
  5. red="$1"
  6. base=$(echo "$red" | cut -d'.' -f1-3)
  7.  
  8. for ip in $(seq 1 254); do
  9. host="$base.$ip"
  10.  
  11. if ping -c 1 -W 1 "$host" > /dev/null 2>&1; then
  12. echo "$host ONLINE"
  13. else
  14. echo "$host OFFLINE"
  15. fi
  16. done
Advertisement
Add Comment
Please, Sign In to add comment