Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. Short version :
  2.  
  3. Android 5 and older (here android 4):
  4.  
  5. adb shell service call isms 5 s16 "com.android.mms" s16 "+01234567890" s16 "+01SMSCNUMBER" s16 "Hello world !" i32 0 i32 0
  6. Android 5 and later (here android 9):
  7.  
  8. adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+1234567890" s16 "null" s16 "Hey\ you\ !" s16 "null" s16 "null"
  9. Isms method number (5 and 7 above) may change with the android version . Read full explanation to understand it.
  10.  
  11. Full explanation for all android version :
  12.  
  13. Yes it exists ! but not with this command, because these input events are blocked in sleep mode. This solution depends on your android version, so I'm going to explain you for almost all version ...
  14.  
  15. 1st, check if you have the service isms by running :
  16.  
  17. adb shell service check isms
  18. Service isms: found
  19. The answer is found, good, keep moving. The service isms have various "options" the syntax is :
  20.  
  21. service call name_service option args
  22. The service name can be found by typing :
  23.  
  24. adb shell service list
  25. It will display a lot of services avaible, but the interesting line is :
  26.  
  27. 5 isms: [com.android.internal.telephony.ISms]
  28. You can see com.android.internal.telephony.Isms, so on this link choose your android version (by changing branch), then navigate to : telephony/java/com/android/internal/telephony and open Isms.aidl
  29.  
  30. For the rest I will take the android Pie (android 9) file (link).
  31.  
  32. On the line 185 we have :
  33.  
  34. void sendTextForSubscriberWithSelfPermissions(...)
  35.  
  36. Note : before android 5 the method is named sendText(...).
  37.  
  38. It is the 7th declaration in the interface ISMS . So our option to send a sms is the number 7. On the top of the declaratio there is the explanation of the arguments. Here a short version:
  39.  
  40. subId : after android 5, the SIM card you want to use 0, 1 or 2 depending of your android version (ex 0-1 for android 9 and 1-2 for android 8)
  41. callingPkg : the name of the package that will send your sms (I explain how to find it later)
  42. destinationAdress : the phone number of the message recipient
  43. scAddress : your smsc is only need in android 5 and lower (explained after)
  44. parts : your message !
  45. sendIntends and deliveryIntents : you don't care
  46. -> Find your package name : Explore your app file or download Package Name Viewer on google play, find your message application and copy the name (com.android...)
  47.  
  48. -> Find your smsc : In your application -> settings -> SMSC or Service Center or Message Center etc, copy the number display (DON'T CHANGE IT)
  49.  
  50. Just before finishing, in services the strings are declared by s16 and integers and PendingIntent with i32.
  51.  
  52. So for my example we have :
  53.  
  54. subId : 0
  55. callingPkg : com.android.mms
  56. target number : +01234567890
  57. SMSC : +01000000000
  58. My text : Hello world !
  59. sendIntends and deliveryIntents we don't care so we put 0 to set it to default value.
  60. Finally :
  61.  
  62. Android 5 and older (here android 4):
  63.  
  64. adb shell service call isms 5 s16 "com.android.mms" s16 "+01234567890" s16 "+01000000000" s16 "Hello world !" i32 0 i32 0
  65. Android 5 and later (here android 9):
  66.  
  67. adb shell service call isms 7 i32 0 s16 "com.android.mms.service" s16 "+1234567890" s16 "null" s16 "Hey\ you\ !" s16 "null" s16 "null"
  68. -> An example in a batch file :
  69.  
  70. The send.bat for android 4 :
  71.  
  72. echo off
  73. set num=%1
  74. shift
  75. for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
  76. echo %ALL_BUT_FIRST%
  77. adb shell service call isms 5 s16 "com.android.mms" s16 "%num%" s16 "+01000000000" s16 "%ALL_BUT_FIRST%" i32 0 i32 0
  78. run with :
  79.  
  80. send.bat +01234567890 Hey you !
  81. Now tell me if it works with your android version :)
  82.  
  83. Edit : Corrected with information given by Alex P.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement