SHARE
TWEET

flukeAP.sh

gibbsj87 Jun 28th, 2017 (edited) 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. WORKDIR=`pwd`
  4. /var/controller/bin/chantrysh -c "show ap" |awk '{print $2}' >inventory.tmp
  5. if [ "$1" = "export" ]
  6. then
  7. #clean up from incomplete run
  8. rm $WORKDIR/APNames_flukeAP.acl > /dev/null 2>&1
  9. rm $WORKDIR/APNames_flukeAP_temp.acl.tmp > /dev/null 2>&1
  10. rm $WORKDIR/APNames_flukeAP_temp.acl > /dev/null 2>&1
  11. echo
  12. echo "Please wait, it might take some time to export all AP's (10+ min)........."
  13. echo
  14. touch $WORKDIR/APNames_flukeAP.acl
  15. for APSERIAL in `/bin/cat inventory.tmp`
  16.         do
  17.             APNAME=`/var/controller/bin/chantrysh -c "show ap $APSERIAL"|sed -n 2p |sed -e 's/name //'`
  18.             APBSSID1=(`/var/controller/bin/chantrysh -c "show ap_inventory $APSERIAL" |grep "D8:84\|20:B3"`)
  19.             printf "${APBSSID1[3]} "authorized" $APNAME\n${APBSSID1[4]} "authorized" $APNAME\n${APBSSID1[5]} "authorized" $APNAME\n${APBSSID1[6]} "authorized" $APNAME\n" >> $WORKDIR/APNames_flukeAP_temp.acl
  20. #       printf '%s\n' "${APBSSID1[@]}"
  21.  
  22.         done
  23. sed '/D8:84\|20:B3/!d' APNames_flukeAP_temp.acl > APNames_flukeAP_temp.acl.tmp
  24. sed 's/://g' APNames_flukeAP_temp.acl.tmp > $WORKDIR/APNames_flukeAP.acl
  25. echo  #############################################################################
  26. echo "#          File is done being created.  $WORKDIR/APNames_flukeAP.acl         #"
  27. echo  #############################################################################
  28. echo "Removing Temporary Files..."
  29. rm $WORKDIR/APNames_flukeAP_temp.acl.tmp > /dev/null 2>&1
  30. rm $WORKDIR/APNames_flukeAP_temp.acl > /dev/null 2>&1
  31. echo "Done!"
  32. else
  33.     echo "Usage flukeAP.sh export - prints Fluke AirCheck compatable ACL for AP names."
  34.     echo "Calling flukeAP_ap.sh without export option generates inventory.tmp file,"
  35.     echo "that contains all AP serial numbers."
  36. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top