My personal dotfiles
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.

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. ARESET="\e[0m"
  3. ABOLD="\e[1m"
  4. AGREEN="\e[32m"
  5. ARED="\e[91m"
  6. # Default timeout of 0.25
  7. if [ "$#" -gt 1 ]; then
  8. echo "Usage: $0 [timeout]"
  9. exit 1
  10. elif [ "$#" -eq 0 ]; then
  11. TO=0.5
  12. else
  13. TO=$1
  14. fi
  15. for room in "2020" "2026"; do
  16. echo -e $ABOLD"DH$room"$ARESET
  17. for i in $(seq -w 0 30); do
  18. if timeout --preserve-status $TO nmap -p22 -Pn dh"$room"pc"$i".utm.utoronto.ca -oG - | grep -q 22/open; then
  19. echo -en "$AGREEN""dh2020pc$i""\t"
  20. else
  21. echo -en "$ARED""dh2020pc$i""\t"
  22. fi
  23. if [ $((10#$((10#$i+1)) % 3)) == 0 ]; then
  24. echo ""
  25. fi
  26. done
  27. echo -e $ARESET
  28. done
  29. echo -e $ARESET