SMSCON
SMSCON provides complete control of your N900 by sending SMS commands to it. This is particularly handy in case you cannot find your phone, for example if it has been lost or even stolen.
SMSCON is a two part Python script running in command-line; smscon
and smscon_daemon
. smscon
is the command-line control part and smscon_daemon
is the daemon (running in the background) part. The configuration file for all the user settings is in the smscon_config
file.
SMSCON will also auto-load silently at boot, waiting for a special SMS command message in case you phone is lost (or even stolen).
SMSCON can't guarantee that you will find your phone again, but it will provide the maximum chance to recover it. If this application ever helps you to recover your phone please tell the story on Maemo.org! The best way is of course to never lose your phone or let it get stolen...
SMSCON Editor is a GUI helper application for SMSCON to set/edit user settings & control SMSCON.
Contents |
Functionality
SMSCON can:
- autoload at boot (this is default set at install of smscon package); when device reboots it loads
smscon_daemon
silent in the background. - creates a log file (on the device).
- detect SIM card change and sends new SIM card phonenumber, IMSI code & telecom operator name to other known mobile number (returns SMS message); if somebody has stolen your phone and put his/hers own SIM card in it.
- send current GPS location coordinates (returns SMS message or EMAIL with GoogleMaps picture with your phone's location on it).
- reboot the phone; only works if your SIM card hasn't a lock code.
- shutdown the phone.
- open a (reverse-)SSH connection to your own (home-)server (GPRS connection); control the phone at command-line level from your own home.
- email a frontcam picture to your email address (GPRS connection); to maybe see where your phone is or who is using it.
- send the current remaining battery charge (returns SMS message).
- make the phone call you; you can listen where your phone is (returns phonecall)
- lock the phone; nobody can use your phone anymore.
- detect keyboardslider use; when somebody has found your phone and uses the keyboard. (only after one of the valid SMS commands is send to you phone) (returns SMS message)
- send all valid SMS commands to you if you forgotten it (returns one or more SMS message)
- run a predefined shell script to start other programs, delete files etc.
- run directly shell command through SMS message sending. /* NEW IN 0.7-1 */
- turn the phone silent when SMSCON is set active with a SMS command. /* NEW IN 0.7-1 */
- send automatically SMS messages about the current battery status when SMSCON is set active with a SMS command. /* NEW IN 0.7-1 */
- use multiple SIM cards (the IMSI numbers are stored in
smscon_code
file) /* NEW IN 0.7-1 */
Installation
SMSCON & SMSCON Editor can be found in the Extra-devel/Extra-testing repository (only if enabled on your phone).
Always install the latest version on your phone, previous version can have bugs and have less functionallity!
SMSCON is writen in Python and needs the following packages, besides python2.5, being installed on your device to install and run:
python-crypto /* NEW: NEEDED IN VERSION 0.5-5 and higher */ python-gobject python-location python-dbus pexpect gstreamer-tools openssh-client openssh-server
The files smscon
and smscon_daemon
are placed by the installer in the /opt/smscon
directory. /* changed in version 0.5-5 and higher */
The installer will also generate a smscon_boot
file in /etc/event.d
for autoloading at boot of the device.
Finally SMSCON generates a default settings template file (smscon_config
) with all the user settings of SMSCON. It also creates a smscon_code
file (for storing the current IMSI number of your inserted SIM card) and a smscon_script
file (for running a custom user shell script).
It's essential that the smscon_config
file *must* be edited by SMSCON Editor or with commandline commands before use of SMSCON!
Finally: if you want to use the SSH connection feature of SMSCON ('Remoteon' / 'Remoteoff' command), you also need a fixed IP address on your preconfigured remote server for the SSH (default port 22) connection.
Usage
SMSCON is triggered by a SMS message with a predefined known command and then will execute the task in the background. If so it will send a reply SMS or email with the information.
Commands
The (default) predefined commands are:
Nokia-N900:~# smscon -sms COM_CHECK = 'Check' COM_REBOOT = 'Reboot' COM_POWEROFF = 'Poweroff' COM_POWER = 'Power' COM_LOCATION = 'Location' COM_REMOTEON = 'Remoteon' COM_REMOTEOFF = 'Remoteoff' COM_CAMERA = 'Camera' COM_CALL = 'Call' COM_LOCK = 'Lock' COM_UNLOCK = 'Unlock' COM_TRACKON = 'Trackon' COM_TRACKOFF = 'Trackoff' COM_CUSTOM = 'Script' /* NEW: IN VERSION 0.5-9 */ COM_SHELL = 'uptime >> /tmp/shell_log' '''/* NEW: IN VERSION 0.7-1 */'''
NOTE: These commands can be changed using the SMSCON Editor and from release v0.5-6 (and higher) also at the command-line with the smscon -set
command (see SMSCON command-line options).
- When sending 'Check' to you phone it sends one or more SMS messages with all the available SMSCON commands.
- Sending 'Reboot' it will reboot your phone.
- Sending 'Poweroff' is will shutdown your phone.
- Sending 'Location' is will send it's current position by SMS or EMAIL (or both).
- Sending 'Remoteon' it will enable the SSH connection to your (home-)server. 'Remoteoff' will kill the connection.
- Sending 'Camera' will send a frontcam picture by email.
- Sending 'Call' will call you.
- Sending 'Lock' will lock the device, so nobody can use your phone. 'Unlock' will remove the device lock.
- Sending 'Trackon' will continiously send SMS or email (or both) with location of the device & 'Trackoff' will disable this.
- Sending 'Script' will run a predefined by user shell script (
/opt/smscon/smscon_script
). - Sending 'uptime >> /tmp/shell_log' (an example shell command) will exectute the shell command on your phone (no checks & output are returned!) /* NEW: IN VERSION 0.7-1 */
USAGE EXAMPLE:
- To trigger any of the commands the phone should receive an SMS having in the subject its defined name. E.g. to trigger the
COM_LOCATION
command the phone should receive:Location
. - The commands can use spaces in them and can be altered in a command only you know what it is and what it means.
The user editable settings of the smscon_config
file:
# smscon user settings (v0.7-1) # (DO NOT edit the encrypted user settings below, use SMSCON-editor!) # SMS settings SENDERNUMBER = '+XXXXXXXXXXX' # SMS commands COM_CHECK = 'Check' COM_REBOOT = 'Reboot' COM_POWEROFF = 'Poweroff' COM_POWER = 'Power' COM_LOCATION = 'Location' COM_REMOTEON = 'Remoteon' COM_REMOTEOFF = 'Remoteoff' COM_CAMERA = 'Camera' COM_CALL = 'Call' COM_LOCK = 'Lock' COM_UNLOCK = 'Unlock' COM_TRACKON = 'Trackon' COM_TRACKOFF = 'Trackoff' COM_CUSTOM = 'Script' /* NEW: IN VERSION 0.5-9 */ COM_SHELL = 'uptime >> /tmp/commandlog' /* NEW: IN VERSION 0.7-1 */ # Email settings EMAILADDRESS = 'XXXXX@XXXXXXXXXXX.XX' USER = '<ENCRYPTED STRING>' PASSWORD = '<ENCRYPTED STRING>' EMAILFROM = 'XXXXXXXX@XXXXXX.XX' MAILSERVER = 'XXXX.XXXXXX.XX' MAILPORT = XXX # SSH settings REMOTEHOST = 'XXXXXXXXXXX.XX' REMOTEPORT = 22 REMOTEUSER = '<ENCRYPTED STRING>' REMOTEPASSWORD = '<ENCRYPTED STRING>' # Disable SMS sending # (WARNING: this will disable ALL SMS sending in SMSCON: 'yes' / 'no' DISABLESMS = 'no' /* NEW: IN VERSION 0.7-1 */ # Send acknowledge SMS # (send acknowledge SMS after receiving valid SMS command: 'yes' / 'no') COMMANDREPLY = 'yes' # Detect keyboard use # (send acknowledge SMS if keyboard is slided: 'yes' / 'no') KEYBOARDDETECT = 'no' # Device lock # (lock device after receiving valid SMS command: 'yes' / 'no') AUTODEVICELOCK = 'yes' # Auto battery status SMS report # (sends SMS when SMSCON is set active with a SMS command & battery is depleting: 'yes' / 'no') AUTOBATREPORT = 'no' /* NEW: IN VERSION 0.7-1 */ # Auto device unlock # (unlocks device when new SIM is inserted; 'yes' / 'no') SIMUNLOCK = 'no' /* NEW: IN VERSION 0.7-1 */ # Silence the phone # (disable all phone sounds when SMSCON is set active with a SMS command: 'yes' / 'no') SILENCEDEVICE = 'no' /* NEW: IN VERSION 0.7-1 */ # GPS setings # (if no GPS coordinates acquired after 600 seconds then stop) GPSTIMEOUT = 600 # (number of GPS coordinates to acquire and use the most accurate in "Location"-mode) GPSPOLLING = 3 # (time between sending coordinate sms in "Trackon"-mode: 10 / 20 / 30 / 60 / 120) GPSINTERVAL = 60 # (method to send GPS coordinates: 'email' / 'sms' / 'both') GPSSEND = 'both'
Options
The available command-line options for SMSCON are:
Nokia-N900:~# smscon == smscon v0.7-1 - Nokia N900 remote control utility == Options: -start : start smscon_daemon -stop : stop smscon_daemon -status : get smscon_daemon status -log : show log file -del log : erase log file -sms : show SMS commands -set name "value" : set user setting (name = "value") -config : show config file -script : show script file -boot : start smscon_daemon at device boot -unboot : remove start of smscon_daemon at device boot -add imsi : add current IMSI code to code file -remove imsi : remove current IMSI code from code file -help : this help menu Special options (normally not needed!): -reset : factory default (delete boot, config, code & script file) -imsi : show IMSI code file -del imsi : delete code file -init : create default config & script file -del config : delete config file -del script : delete script file
SMSCON is intended for people who have Python programming / Linux experience so you can adjust the script to their own needs.
After installation
After installation smscon
will generate a new configuration file (/opt/smscon/smscon_config
) which you *must* edit to your own needs (i.e. change all xxxxxxx's). To edit this use SMSCON Editor, which will assist in the configuration setup, or use the command-line smscon -set
option (available from 0.5-6 and higher).
Also a shell script file will be generated (/opt/smscon/smscon_script
) were the user can predefine shell commands to run other programs, delete files etc (available from 0.5-9 and higher).
SMSCON will also be installed to autoload at boot, this can be disabled with the command-line command smscon -unboot
and re-enabled by smscon -boot
or with SMSCON Editor.
The first time you start SMSCON (smscon -start
) it loads the configured user settings file and is now active. smscon_daemon
then stores your valid IMSI code in a file (/opt/smscon/smscon_code
) if the file doesn't exist.
When later a new SIM card is inserted the new IMSI code is verified with the code in the stored smscon_code
file. This is how the "SIM card change" will be detected.
Nokia-N900:~# smscon -start smscon_daemon started.
All user action and behavior of smscon_daemon
will be logged in the log file (at /tmp/smscon.log
):
Nokia-N900:~# smscon -log SMSCON INFO: smscon_daemon is running (XX-XX-XXXX XX:XX:XX) DAEMON INFO: successfully loaded "smscon_config" file DAEMON INFO: COM_CALL = [Call] DAEMON INFO: COM_CAMERA = [Cam] DAEMON INFO: COM_CHECK = [Sms] DAEMON INFO: COM_CUSTOM = [Script] /* NEW in 0.5-9 */ DAEMON INFO: COM_LOCATION = [Gps] DAEMON INFO: COM_LOCK = [Lock] DAEMON INFO: COM_POWER = [Bat] DAEMON INFO: COM_POWEROFF = [Poweroff] DAEMON INFO: COM_REBOOT = [Reboot] DAEMON INFO: COM_REMOTEOFF = [Ssh off] DAEMON INFO: COM_REMOTEON = [Ssh on] DAEMON INFO: COM_SHELL = [uptime >> /tmp/shell_log] /* NEW in 0.7-1 */ DAEMON INFO: COM_TRACKOFF = [Gps off] DAEMON INFO: COM_TRACKON = [Gps on] DAEMON INFO: COM_UNLOCK = [Unlock] DAEMON INFO: reading 1 valid IMSI code from "smscon_code" file /* NEW in 0.7-1 */ DAEMON INFO: authorized IMSI code found DAEMON INFO: smscon auto-loads at boot
When having trouble with SMSCON always check the smscon_log
file!
Remote SSH connection
When the (reverse-)SSH connection is made (default command 'Remoteon' / 'Remoteoff') you can from the server side (your own server) connect to your Nokia device with the following command:
ssh -p 8080 localhost -l root
Current version v0.7-1
Completely remove previous version (v0.6) from your Nokia phone before using v0.7 or higher!
(reason: due to change in settings of smscon_config
file)!
- NEW: multiple IMSI codes are allowed in smscon_code file; use new option "smscon -add imsi" to store current IMSI code in smscon_code file.
- NEW: added new user option (DISABLESMS); WARNING: disables ALL SMS sending in smscon program.
- NEW: added new smscon command (COM_SHELL); run directly shell commands. (no check & feedback from command!).
- NEW: added new user option (SIMUNLOCK); auto unlock phone after new SIM is inserted (to fool a possible thief of your phone).
- NEW: added new user option (SILENCEDEVICE); disable all phone sounds (email alert, IM alert, ringing alert & SMS alert) in current active profile, if smscon is activated. All volume levels are set to zero.
- NEW/CHANGE: new user option (AUTOBATREPORT); user can enable/disable sending automatically a SMS message when smscon is activated & device battery is depleting.
- CHANGE: when initializing a new smscon_config file all user settings wil be set default to 'no'.
- REFACTORING: some parts in both scripts.
- FIX: better number handeling in SMSrecieve() routine (thanks to maemo.org user!).
- FIX: small bug in GSMmodem() in smscon_daemon script.
- FIX: small text bug in smscon script.
- EXPERIMENTAL/CHANGE: when smscon fails to send SMS message (no cell reception) it will retry after 900 seconds.
- EXPERIMENTAL/FIX: change in getting the right GPRS connections; MMS & WAP will be discarded in available GPRS network list.
Previous version v0.5-9:
- NEW: added new smscon command: COM_CUSTOM to run a user configurable shell script (/opt/smscon/smscon_script)
- NEW: if user setting REMOTEUSER, REMOTEPASSWORD is empty, "Remoteon" & "Remoteoff" function is disabled in smscon.
- NEW: smscon will send automatically a SMS message when smscon is activated & device battery is depleting.
- NEW: added new options in smscon menu.
- NEW/EXPERIMENTAL: when smscon fails to send SMS message (no cell reception) it will retry after 900 seconds.
- CHANGE: improved the way smscon reads user settings from smscon_config file.
- FIX/EXPERIMENTAL: change in getting the right GPRS connections; MMS & WAP will be discarded in available GPRS network list. (thanks to Zimon)
- FIX: added time notation in GPS email & SMS messages.
- FIX: picture of frontcam & GoogleMap image are named wrong & placed therefore in wrong directory.
- FIX: smscon fails to send SMS message when message is too long (> 160 chars.)
Previous version v0.5-7:
- FIX: activation of the current active/available GPRS connection could fail in specific cases (bug in acquiring the name).
- FIX: better logging/behaviour when locking/unlocking of device.
Previous version v0.5-6:
- NEW: added new command-line option for smscon to set user settings (encrypted & non-encrypted) in smscon_config file.
- NEW: added package icon
- NEW / FIX: added time & date of frontcam picture taken in email.
- REFACTORING: parts of script code.
- CHANGE: improved user setting reading from smscon_config file.
- CHANGE: cosmetic changes in logging.
- CHANGE / FIX: (UNTESTED) if USER & PASSWORD setting is empty, email sending to smtp server is done without user & password authentication.
- FIX: smscon can send to wrong phone number when activated & receives hereafter a non-SMSCON command SMS message from another phone number.
Previous version v0.5-5:
- NEW: in reply SMS from COM_LOCATION command is http link added to GoogleMaps.
- NEW/CHANGE: optification of SMSCON; new install path of package is now /opt/smscon.
- REFACTORING: improved the way SMS is send (more stable & controlled).
- REFACTORING/FIX: execption in email sending code failed.
- CHANGE: in SMSCON test modes usage of WLAN connection only if already connected, otherwise usage of GPRS connection.
- CHANGE: in SMSCON test modes if usage of GPRS connection, previous connection is saved & re-enabled after GPRS connection usage.
- CHANGE: if usage of GPRS connection, force Internet connections to GPRS connection (needed for keeping the connection alive/stable).
- CHANGE: new SMSCON icon (meets requirements of maemo package)
- CHANGE: new package description (meets requirements of maemo Extra-testing package)
- FIX: internal fixes (better consistency in logging).
- FIX: email attachment (camera picture or Google map) is displayed completely wrong (alt text was wrong/mixed etc.)
- FIX: remove unused variable in ConfigVars list.
- FIX: syntax bug fixed which could crash SMSCON.
Known Issues
v0.7-1
- Bug in RestoreNetwork(); will be fixed in v0.7-2. (confirmed; thanks to Saturn)
- Bug in CheckArguments(); will be fixed in v0.7-2. (confirmed; thanks to Saturn)
- Please test & report on SMSCON thread on forum [1].
v0.5-9
- Use 0.7-1 for testing (new options & bug fixes)!
v0.5-7
- Several issues, see above.
v0.5-6
- Smscon can fail, in specific circumstances, in aquiring the name of GPRS data connection. (confirmed by creator)
v0.5-5
- Smscon can send to wrong phone number when activated & receives hereafter a non-SMSCON command SMS message from another phone number. (confirmed by creator)
v0.4.4-6
- Email attachment (camera picture or Google map) is displayed wrong. (confirmed by creator)
v0.4.4-5
- COM_REBOOT & COM_POWEROFF command fail when used. (confirmed by creator)
- Alt text of email image in email is wrong.
v0.4.4-4
- COM_REBOOT & COM_POWEROFF fails if changed. (confirmed by creator)
- COM_CALL fails. (confirmed by creator)
v0.4.4-3
- If default COM_REBOOT & COM_POWEROFF commands are changed command fails to execute (confirmed by Saturn) Fix in 0.4.4-4.
v0.4.4-2
- Dependancy list of SMSCON installer is incorrect (confirmed by creator)
v0.4.4-1
REMOVE PREVIOUS VERSION FROM NOKIA BEFORE USING 0.4.4-1 or higher
(reason: major change in smscon_config
file)!
- Smscon won't autoload at boot (confirmed by creator). Fix in 0.4.4-2.
v0.4.3
- Command "Trackon" is reported not to work (confirmed by creator)
-
smscon_daemon
does not start at boot when requested (confirmed by creator) - SMS commands cannot accept spaces (confirmed by creator)
- Smscon doesn't load at boot. (confirmed by creator)
- "Trackon" (& "Trackoff") command doesn't work. (confirmed by creator)
- Bug in selecting the right GPS mode if GPRS data network is available (usage of AGPS (faster) or GPS (slower)). (confirmed by creator)
- When using command "Location" GPRS data network is not automatically enabled.
- GPSTIMEOUT routine doesn't work as expected/intended. (confirmed by creator)
- When "Location" & "Trackon" commands are used, internal smscon events are discarted/hold until GPS is finished. (confirmed by creator)
- Discovered a initial GPS control design flaw in smscon. (confirmed by creator)
v0.4.2
- The default number is replaced by every mail received and not only those requesting a command. (confirmed & fixed in version 0.4.3)
v0.4.1
- Command "Trackon" is reported not to work (confirmed)
- Reply command sends duplicates (unconfirmed)
v0.4.0
- Will not work due to a typo in variable name (confirmed and fixed in version 0.4.1)
Future release
- CHANGE: for encryption of user settings in
smscon_config
file, now secret code key is based on device serial number (no more predefined key in script); this enhances security.
Future development ideas
Feel free to add requests below.
- saving all
smscon_config
user variables in gconf database. No need forsmscon_config
file anymore. (WONT IMPLEMENT) - add setting for user's country mobile number prefix.
- add setting for alternative number (where alternative is a number sent a command and does not match the default) and option to choose where reply should be send, i.e. default number, alternative or both. Default number should not be replaced.
- add setting to choose the default internet connection (WLAN, GPRS, or ANY). At the moment hardcoded to GPRS. (WONT FIX)
- when the "Camera" command is sent, the process should wait for keyboard action to capture a picture and send the mail. In that way, there will be more chances to get better face portrait of the "new" user.
- Add the ability to run custom commands (very useful, but especially needed to delete sensitive data from the phone). (IMPLEMENTED IN 0.5-9 / 0.7-1)
- Add the ability to turn silent mode on. (IMPLEMENTED IN 0.7-1)
Testers needed
Please test this software, I like to hear if it works for you or not. Please post on forum. I only can test the software with two Vodafone SIM cards from The Netherlands, I want to know if it also works with other cards and networks in other countries...
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 only.
Disclaimer
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.