SMS2Shell
A script that receives SMS messages on a device with Termux on Android and executes the commands contained in their content.
release date: 2025-12-08
about
SMS2Shell — pronounced SMS to Shell — is a tool that allows you to execute commands of your choice in Termux on your Android device remotely – via received SMS messages.
Every several seconds, the script analyzes your list of received SMS messages, extracts commands from them, and... sends their response back to the SMS sender!
Every several seconds, the script analyzes your list of received SMS messages, extracts commands from them, and... sends their response back to the SMS sender!
features
Once started, the script runs continuously, scanning received SMS messages (the last few dozen), looking for those that start with '>>', and then begins parsing their remaining content.
The script includes several useful predefined commands — BATTERY, which replies with the current battery status; LOCATION, which sends back the device's current location; CALC, which works as a mobile calculator via SMS; options for changing the volume levels of individual audio channels; and more.
Each received message is analyzed and saved to a cache file to prevent it from being executed again during the next scan.
You can use this if you leave your phone with Termux running as an HTTP server at home, if you have no direct access to battery status, or if you lose your phone — you can easily retrieve its location! Clever, right?
The script includes several useful predefined commands — BATTERY, which replies with the current battery status; LOCATION, which sends back the device's current location; CALC, which works as a mobile calculator via SMS; options for changing the volume levels of individual audio channels; and more.
Each received message is analyzed and saved to a cache file to prevent it from being executed again during the next scan.
You can use this if you leave your phone with Termux running as an HTTP server at home, if you have no direct access to battery status, or if you lose your phone — you can easily retrieve its location! Clever, right?
compatibility
The script is compatible with all current new versions of Termux and Termux:API with configured permissions and installed packages in Termux such as jq, bc, and other basic tools.
However, Termux:API in its latest versions, when failing to retrieve location, send messages, or perform similar actions, tends to crash instead of gracefully failing, which can break the script and is very difficult to fix. Therefore, make sure that your device has access to SMS messages and that you use the location sending feature in an area where GPS signal is available.
However, Termux:API in its latest versions, when failing to retrieve location, send messages, or perform similar actions, tends to crash instead of gracefully failing, which can break the script and is very difficult to fix. Therefore, make sure that your device has access to SMS messages and that you use the location sending feature in an area where GPS signal is available.