Last active
September 26, 2023 07:46
-
-
Save hackgnar/c9fd9bbf5a96fdd0d43f9f3a8c4e7aeb to your computer and use it in GitHub Desktop.
Ghetto Gatttool Bleah Output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run with the following syntax: | |
# ./ghetto_bleah.sh 11:22:33:44:55:66 | |
mac=$1 ; | |
while read i; | |
do | |
printf "%s " $(echo -n $i|awk '{printf "%s : ", $1'}); | |
printf "%s " $(echo -n $i|awk '{printf "%s : ", $3'}); | |
#printf "%s : " $(echo -n $i|awk '{printf "%s", $2'}); | |
j=$(printf "%.8d" $(echo "obase=2; ibase=12; $(echo -n $i|awk '{printf "%s", toupper($2)'}|cut -b3-)"|bc)); | |
#printf "%s : " $j; | |
if [ $(echo -n $j |cut -b7) == "1" ]; then printf "READ "; else printf " "; fi; | |
if [ $(echo -n $j |cut -b5) == "1" ] || [ $(echo -n $j |cut -b6) == "1" ] ; then printf "WRITE "; else printf " "; fi; | |
if [ $(echo -n $j |cut -b4) == "1" ]; then printf "NOTIFY "; else printf " "; fi; | |
if [ $(echo -n $j |cut -b3) == "1" ]; then printf "INDICATE "; else printf " "; fi; | |
printf ": " | |
gatttool --char-read -b $mac -a $(echo -n $i|awk '{printf "%s : ", $1'}) |awk -F':' '{print $2}'|tr -d ' '|xxd -r -p; printf '\n' ; | |
done < <(sudo gatttool -b $mac --characteristics |awk '{print $12, $7, $15}' |tr -d ',') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to run, just copy this to a bash script and pass the mac address you want to scan as an argument. Example run looks as follows:
./ghetto_bleah.sh 11:22:33:44:55:66
Output will look as follows: