metalx1000

ADB Shell Make phone call

Oct 14th, 2020 (edited)
446
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2020  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #uses ADB to make a phone call on your Android device
  7. #script tries to unlock your screen if it is off and locked
  8.  
  9. #This program is free software: you can redistribute it and/or modify
  10. #it under the terms of the GNU General Public License as published by
  11. #the Free Software Foundation, either version 3 of the License, or
  12. #(at your option) any later version.
  13.  
  14. #This program is distributed in the hope that it will be useful,
  15. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. #GNU General Public License for more details.
  18.  
  19. #You should have received a copy of the GNU General Public License
  20. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  21. ######################################################################
  22.  
  23. function unlock(){
  24.   read -p "Your lock screen code: " code
  25.   adb shell input swipe 1000 200 200 200
  26.   adb shell input swipe 1000 200 200 200
  27.   adb shell input text "$code"
  28.   adb shell input keyevent 66
  29. }
  30.  
  31. locked="$(adb shell dumpsys power | grep 'mHoldingWakeLockSuspendBlocker'|cut -d\= -f2)"
  32.  
  33. read -p "Number to call (with area code): " number
  34.  
  35. #unlock screen
  36. screen="$(adb shell dumpsys power | grep 'mHoldingDisplaySuspendBlocker'|cut -d\= -f2)"
  37. [[ "$locked" == "false" ]] && adb shell input keyevent 26
  38. #is screen on
  39. [[ "$screen" == "false" ]] && unlock
  40. adb shell service call phone 1 s16 "+$number"
  41. adb shell input keyevent 66
  42.  
RAW Paste Data