Guest User

lint-16800-info.sh

a guest
Sep 3rd, 2018
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # lint-16800-info.sh -- Dump info from a potfile
  4. #
  5. # based on 16800-tail-n1-info.sh from diegodieguex
  6. # Changes:
  7. # - Iterate over file
  8. # - Cleaned up code
  9. # - Support for 2500 pots as well
  10. #
  11. # (C) 2018 Carlos Lint, licensed as MIT.
  12. #
  13.  
  14.  
  15. if [ -r "$1" ] ; then
  16. while read LINE ; do
  17. if [ `echo $LINE | grep -c \*` -gt 0 ]; then
  18. SEP=\*
  19. AST=1
  20. else
  21. SEP=\:
  22. AST=0
  23. fi
  24.  
  25. TMP2=`echo "$LINE" | cut -c 34-`
  26. BSSID=`echo "$TMP2" | cut -d "$SEP" -f1`
  27. PREC=`echo "$LINE" | cut -c 47-`
  28. CLIENT=`echo "$PREC" | cut -d "$SEP" -f1`
  29. TMP3=`echo "$TMP2" | cut -c 27-`
  30. ESSID=`echo "$TMP3" | cut -d ":" -f1`
  31. PSK=`echo $LINE | awk 'BEGIN { FS = ":" } ; { print $NF }'`
  32.  
  33. echo "VENDOR:\t"`whoismac -m "$BSSID"`
  34. echo "CLIENT:\t"`whoismac -m "$CLIENT"`
  35. if [ $AST = 0 ]; then
  36. echo "ESSID:\t$ESSID"
  37. else
  38. echo "ESSID:\t"`echo $ESSID | xxd -r -p`
  39. fi
  40. echo -n "PSK:\t"
  41. echo "$PSK" | awk 'BEGIN { FS = ":" } ; { print $NF }'
  42. echo -n "COUNT:\t"
  43. echo "$PSK" | awk '{t+=length($0)}END{print t}'
  44. echo
  45. echo
  46. done < "$1"
  47. else
  48. echo "Usage: $0 <potfile>"
  49. echo
  50. fi
Add Comment
Please, Sign In to add comment