Advertisement
illwill

moo's oui lookup

Oct 22nd, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ ! -e oui.txt ];then
  4. echo "oui.txt not found. Grabbing current copy."
  5. curl -k http://linuxnet.ca/ieee/oui.txt -o ./oui.txt
  6. fi
  7.  
  8. if [ ! -e cow.txt ];then
  9. echo "Grabbing Banner"
  10. curl -k https://gist.githubusercontent.com/piratemoo/0caed777e210efc5a65a10574e8be0bd/raw/7d20aa7f8b02e0a0ec22373259e78b172e75cf84/cow.txt -o ./cow.txt
  11. fi
  12.  
  13. cat cow.txt && echo ""
  14.  
  15. options=(
  16. "Lookup by oui?"
  17. "Lookup by vendor?"
  18. "Update OUI?"
  19. "Quit"
  20. )
  21. select option in "${options[@]}"
  22. do
  23. case "$REPLY" in
  24. 1) echo "Enter first octet of oui (i.e. 34:A4):"
  25. read input;
  26. processed=$(echo $input | sed -e 's/:/-/g')
  27. cat oui.txt |grep $processed
  28. ;;
  29. 2) echo "Enter the vendor name:"
  30. read input;
  31. cat oui.txt | grep $input ;;
  32. 3) echo "Update OUI txt file"
  33. old=$(wc -c < oui.txt)
  34. new=$(curl -sI http://linuxnet.ca/ieee/oui.txt | awk '/Content-Length/ {sub("\r",""); print $2}')
  35. if [ $old != $new ]; then
  36. rm oui.txt
  37. curl -k http://linuxnet.ca/ieee/oui.txt -o ./oui.txt
  38. echo "It's lit fam"
  39. else
  40. echo "OUI is up to date fam."
  41. fi
  42. ;;
  43. 4) break ;;
  44. *) echo "Please select a valid option" ;;
  45. esac
  46. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement