_                _   _                 ____            _     _ 	
   / \   _ __   ___ | |_| |__   ___ _ __  |  _ \ _ __ ___ (_) __| |	
  / _ \ | '_ \ / _ \| __| '_ \ / _ \ '__| | | | | '__/ _ \| |/ _\` |	
 / ___ \| | | | (_) | |_| | | |  __/ |    | |_| | | | (_) | | (_| |	
/_/   \_\_| |_|\___/ \__|_| |_|\___|_|    |____/|_|  \___/|_|\__,_|	
                                                                bbs
  XQTRs lair...
Home // Blog // NULL emag. // Files // Docs // Tutors // GitHub repo
  Raspberries are little, neat Linux computers. Also, everyone today is having
an old smartphone with Android. Thankfully for us, we can use Linux and ADB
tools to connect and communicate with any, Android smartphone. We can use this
functionality, to send SMS messages from our BBS to any number.
                                                                           
  U can use this as a pager for SySoPS or notifications for any users activity
in the BBS. Its up to you to decide and imagine other uses for it. Lets see how
we can do it...
                                                                      
                        ///////   REQUIREMENTS   ///////
                                  
  First of all you need to install ADB Tools. For that, open a terminal window
and type:

                      sudo apt-get install android-tools-adb                 
                                                                             
  After that, type:
                      adb shell                                            
                                                                           
  If you get a prompt inside your device you are OK, else you have to figure
out whats wrong with the connection. THis is not a guide how to connect your
android phone.

  Make sure that the ADB utility is inside the /usb/bin directory or else find
its exact location. If you have installed LOCATE, use it to find adb location. 
Now lets go write a simple BASH script to send SMSs.
                                                                             

                                                                             
                        ///////   THE SCRIPT   ///////
                                                                           
  Copy/paste the following BASH script, into a file.                     

`+----- -- -- = -  -    -  - = -= - - - -__=- = - - - =  - -  - = - = =  =-- +'

#!/bin/bash
# Usage:
#    ./send.sh  
# Example
#    ./send.sh 9999999999 "Hello there."
# -

# Change this to the correct location of ADB
ADB=/usr/bin/adb

# Check if screen is off
if $ADB shell dumpsys input_method | grep -q mScreenOn=false; then
	$ADB shell input keyevent 26
	$ADB shell input swipe 250 650 1000 650
	sleep 1
fi

# Check if SMS app is running
test=$($ADB shell ps | grep com.android.mms | awk '{print $9}');
if [ ! -z $test  ]; then
        $ADB shell am force-stop com.android.mms
fi

# Wake up phone
$ADB shell input keyevent 3
# Fill SMS Stuff
$ADB shell am start -a android.intent.action.SENDTO -d sms:$1 /
--es sms_body "$2" --ez exit_on_sent true
# Wait for it...
sleep 5
# Send it...
$ADB shell input keyevent 22
# kabaam...
sleep 1
$ADB shell input keyevent 66

`+----- -- -- = -  -    -  - = -= - - - -__=- = - - - =  - -  - = - = =  =-- +'
 
    Make it executable with:
                            chmod +x send.sh                              
                                                                         
  That's it. Now you can use it at any Menu Command of your BBS software to
send SMS messages. The script will wake the phone, write the message and send 
it, to the phone number provided. Make sure to test it.       
                                                                       
  One important thing is that you have to have a simple unlocker for the phone,
like Slide it, so that the script can easily unlock the phone and send the sms.
It wont work with other type of lock screens.

  You can use it straight as a menu command or execute it through a BBS script,
to get any system variables you may need. Now go write some SySoP paging 
scripts... :]