├── LICENSE ├── README.md ├── app.py ├── message.txt └── numbers.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Adem Kouki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BulkSMSPython 2 | Send SMS to your list of numbers - using Android ADB 3 | 4 | ![](https://i.imgur.com/QnW8kDm.gif) 5 | 6 | ## Requirement 7 | 8 | 1. You must have Python - of course 😅 => [Download Python](https://www.python.org/downloads/) 9 | 2. You must have ADB installed => [Click Here to know more](https://www.xda-developers.com/install-adb-windows-macos-linux/) 10 | 3. You need to plug your phone to your Computer using usb cable 11 | 4. you phone must have "Developer Options" enabled! => [Click Here to know more](https://www.digitaltrends.com/mobile/how-to-get-developer-options-on-android/) 12 | 5. Your sim card must have enough credit to send SMS - of course 😅 13 | 14 | ## How to use it 15 | 16 | 17 | 1. Run : 18 | 19 | ``` 20 | $ git clone https://github.com/Ademking/BulkSMSPython 21 | $ cd BulkSMSPython 22 | ``` 23 | 24 | 2. Modify numbers.txt with your numbers 25 | 26 | 3. Modify message.txt with your message body 27 | 28 | 4. Run : 29 | 30 | ``` 31 | $ app.py 32 | ``` 33 | 34 | ## That's it 😉 Hope you like it 35 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | # BulkSMSPython v1.0 2 | # By: Adem Kouki 3 | # Github: https://github.com/Ademking/BulkSMSPython 4 | # FB: https://facebook.com/Ademkouki.Officiel 5 | # 15/10/2018 6 | 7 | import os 8 | import subprocess 9 | import sys 10 | import time 11 | import re 12 | 13 | 14 | # test if substring exists in string 15 | def found(text , substring): 16 | if text.find(substring) != -1 : 17 | return True 18 | else: 19 | return False 20 | 21 | 22 | # excute cmd and return response 23 | def cmd_res(cmd): 24 | a = os.popen(cmd).read() 25 | return a 26 | 27 | 28 | # excute cmd without return 29 | def cmd(cmd): 30 | os.system(cmd) 31 | 32 | 33 | # check if device connected 34 | def device_ready(): 35 | a = cmd_res('adb devices').count('device') 36 | if a == 2: 37 | # print('Device Ready') 38 | return True 39 | else: 40 | # print('No Device Found! Please plug your device') 41 | return False 42 | 43 | 44 | # check android version 45 | def android_version(): 46 | a = cmd_res('adb shell getprop ro.build.version.release') 47 | if found(a, "8."): 48 | return('Android Oreo') 49 | elif found(a, "7."): 50 | return('Android Nougat') 51 | elif found(a, "6."): 52 | return('Android Marshmallow') 53 | elif found(a, "5."): 54 | return('Android Lollipop') 55 | else: 56 | print('your device isn\'t compatible. Your device must be Android 5+') 57 | sys.exit() 58 | 59 | 60 | # Clear the screen 61 | def cls(): 62 | subprocess.call('cls', shell=True) 63 | 64 | 65 | # Read from txt file 66 | def readnumbers(): 67 | tel_array = [] 68 | try: 69 | with open('numbers.txt') as my_file: 70 | for line in my_file: 71 | tel_array.append(line.strip()) 72 | return tel_array 73 | except FileNotFoundError: 74 | print('numbers.txt Not Found!') 75 | sys.exit() 76 | 77 | 78 | # Get SMS Body from txt file 79 | def getSMSBody(): 80 | try: 81 | with open('message.txt', 'r') as myfile: 82 | data = open('message.txt', 'r').read() 83 | return data 84 | except FileNotFoundError: 85 | print('numbers.txt Not Found!') 86 | sys.exit() 87 | 88 | 89 | # Replace space with "\ " 90 | def formatSMS(SMS): 91 | newSMS = re.escape(SMS.replace("\n", " ")) 92 | return newSMS 93 | 94 | 95 | 96 | 97 | # Main 98 | def main(): 99 | 100 | cls() 101 | 102 | if device_ready(): 103 | 104 | print('=' * 60) 105 | print('Android SMS Sender') 106 | print('=' * 60) 107 | print('Your Android Version : ' + android_version()) 108 | print('=' * 60) 109 | time.sleep(2) 110 | 111 | # array of numbers 112 | numbers_arr = readnumbers() 113 | if len(numbers_arr) == 0: 114 | print('\n[Error] : Your list is empty ! Please check your list in numbers.txt') 115 | sys.exit() 116 | SMS = formatSMS(getSMSBody()) 117 | if SMS == '': 118 | print('\n[Error] : Your SMS Message is empty! Please check your message in message.txt') 119 | sys.exit() 120 | counter = 0 121 | for number in numbers_arr: 122 | if android_version() == 'Android Oreo' : 123 | counter += 1 124 | print('('+str(counter)+') Sending SMS to ' + number) 125 | a = cmd_res('adb shell service call isms 7 i32 0 s16 \"com.android.mms.service\" s16 \"'+number+'\" s16 \"null\" s16 \"'+SMS+'\" s16 \"null\" s16 \"null\"') 126 | time.sleep(2) 127 | elif android_version == 'Android Nougat': 128 | counter += 1 129 | print('('+str(counter)+') Sending SMS to ' + number) 130 | a = cmd_res('adb shell service call isms 7 i32 1 s16 \"com.android.mms\" s16 \"'+number+'\" s16 \"null\" s16 \"'+SMS+'\" s16 \"null\" s16 \"null\"') 131 | time.sleep(2) 132 | elif android_version == 'Android Marshmallow': 133 | counter += 1 134 | print('('+str(counter)+') Sending SMS to ' + number) 135 | a = cmd_res('adb shell service call isms 7 i32 1 s16 \"com.android.mms\" s16 \"'+number+'\" s16 \"null\" s16 \"'+SMS+'\" s16 \"null\" s16 \"null\"') 136 | time.sleep(2) 137 | elif android_version == 'Android Lollipop': 138 | counter += 1 139 | print('('+str(counter)+') Sending SMS to ' + number) 140 | a = cmd_res('adb shell service call isms 9 s16 \"com.android.mms\" s16 \"'+number+'\" s16 \"null\" s16 \"'+SMS+'\" s16 \"null\" s16 \"null\"') 141 | time.sleep(2) 142 | 143 | print('Sending Done Successfully!') 144 | sys.exit() 145 | 146 | 147 | else: 148 | print('\n[Error] : Please Plug Your Device.. or check if you have ADB Installed') 149 | 150 | 151 | ################################# 152 | ################################# 153 | 154 | 155 | if __name__ == "__main__": 156 | main() 157 | -------------------------------------------------------------------------------- /message.txt: -------------------------------------------------------------------------------- 1 | This is a test message. you can change it -------------------------------------------------------------------------------- /numbers.txt: -------------------------------------------------------------------------------- 1 | 123456789 2 | 000000000 3 | 112233445 --------------------------------------------------------------------------------