IsraelTorres

checksccmports.sh

Oct 18th, 2011
128
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Israel Torres
  3. # 2011/10/18
  4. # SCCM 2007 Port Connection Checker using nmap
  5.  
  6. #UDP
  7. function nmap_check_sccm_udp {
  8. IPADDRESS=$1
  9. sudo nmap -p53,67,68,69,135,137,138,500,636,2701,2702,4011,63000-64000 -sU -P0 $IPADDRESS 2> /dev/null | grep -E 'open|filtered|closed'
  10. }
  11. #TCP
  12. function nmap_check_sccm_tcp {
  13. IPADDRESS=$1
  14. sudo nmap -p80,135,139,389,443,445,636,1433,16992,16993,16995,1723,2701,2702,3268,3269,3389,8530,8531,9971 -sS -P0 $IPADDRESS 2> /dev/null | grep -E 'open|filtered|closed'
  15. }
  16.  
  17. function nmap_check_sccm_all {
  18. IPADDRESS=$1
  19. echo -e "#checking TCP SCCM ports on $IPADDRESS ..."
  20. nmap_check_sccm_tcp $IPADDRESS
  21. echo -e "\n#checking UPD SCCM ports on $IPADDRESS ..."
  22. nmap_check_sccm_udp $IPADDRESS
  23. }
  24.  
  25. if [ ! $# -lt 1 ]; then
  26. IPADDRESS=$1
  27. sudo echo "[SCCM 2007 Port Connection Checker]"
  28. nmap_check_sccm_all $IPADDRESS
  29. else
  30. echo "usage: $0 'TARGET(IP_ADDRESS|HOSTNAME)' "
  31. fi
  32.  
  33. #EOF
  34.  
RAW Paste Data