Skip to content

Instantly share code, notes, and snippets.

@heywoodlh
Created February 27, 2018 22:55
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heywoodlh/d920de672f091b0978468a15a9883f10 to your computer and use it in GitHub Desktop.
Save heywoodlh/d920de672f091b0978468a15a9883f10 to your computer and use it in GitHub Desktop.
ADB Scripts

adb-scripts

This repository consists of useful adb scripts/commands for the Samsung Galaxy S8.

Feel free to fork this repository and submit your own scripts.

#!/usr/bin/env bash
PHONE_NUMBER="$(adb shell service call iphonesubinfo 15 | awk '{print $NF}' | grep -o [0-9] | tr '\n' ' ')"
echo "${PHONE_NUMBER//[[:blank:]]/}"
3 - Home Button
4 - Back
5 - Call
6 - Screen sleep
7-16 - 0-9
17 - ‘*’
18 - ‘#’
19 - Jump to beginning of text
20 - Jump to end of text
21 - Move cursor back one letter in text
22 - Move cursor forward one letter in text
23 -
24 - Increase ringtone volume button
25 - Lower ringtone volume button
26 - Sleep button
27 - Camera
28 -
29 - 54 - Letters a through z
55 - ‘,’
56 - ‘.’
57 -
58 -
59 -
60 -
61 - Toggle deselect/select text
62 - Space
63 - Select Keyboard menu
64 - Open with other app
65 - Setup online account
66 - Enter/Return
67 - Backspace
68 - ‘`’
69 - ‘-’
70 - ‘=’
71 - ‘[’
72 - ‘]’
73 - ‘\’
74 - ‘;’
75 - ‘
76 - ‘/’
77 - ‘@’
78 -
79 -
80 -
81 - ‘+’
82 - App menu
83 -
84 - Search
85-95 - N/A
96 - Open keyboard
97 - Close keyboard
98 - Open keyboard
99 -
100 - Back
101 - Hide cursor
102-108 - N/A
109 - App menu
110 - App menu toggle
111 - Back
121 - Screenshot
#!/usr/bin/env bash
ADB=/usr/bin/adb
if [[ "$1" == '' ]] || [[ "$2" == '' ]]
then
echo "syntax: $0 18002223333 'message contents'"
exit 1
fi
"$ADB" shell am start -a android.intent.action.SENDTO -d sms:"$1"
while true
do
MESSAGE="$2"
"$ADB" shell input text $(echo "$MESSAGE" | sed -e 's/ /\%s/g')
"$ADB" shell input keyevent 61
"$ADB" shell input keyevent 62
test $? -gt 128 && break
done
#!/usr/bin/env bash
ADB=/usr/local/bin/adb
if [[ "$1" == '' ]] || [[ "$2" == '' ]]
then
echo "syntax: $0 18002223333 'message contents'"
exit 1
fi
MESSAGE="$2"
"$ADB" shell am start -a android.intent.action.SENDTO -d sms:"$1"
"$ADB" shell input text $(echo "$MESSAGE" | sed -e 's/ /\%s/g')
"$ADB" shell input keyevent 61
"$ADB" shell input keyevent 62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment