Editing SMSCON

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.

Warning: This page is 64 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
==Preface: Early Development/Release Info==
+
'''Please Note: Update for 0.9.16++ is in progress for this page. In particular section "Usage" still needs updates...'''. -- [[User:yablacky|yablacky]] 00:20, 24 January 2012 (UTC)
-
 
+
-
Info not yet present in regular part of this wiki:
+
-
[http://talk.maemo.org/showpost.php?p=1236734&postcount=1213 smscon 0.10.6-1].
+
-
 
+
-
Update for 0.9.19++ is in progress for this wiki. In particular section "Usage" still needs updates.
+
==Introduction==
==Introduction==
Line 37: Line 32:
* Looking for commands in received SMS messages.
* Looking for commands in received SMS messages.
-
* Asking a remote command server for commands. Details are [[ #Remote command server setup and use | here]].
+
* Asking a remote command server for commands (available only if you setup and maintain such a server).
* Sending notifications, responses and query results by SMS and/or by EMAIL.
* Sending notifications, responses and query results by SMS and/or by EMAIL.
-
* Send help about all currently recognized SMS commands. Details are [[ #List of known sms commands | here]].
+
* Send help about all currently recognized SMS commands, e.g. if you've forgotten them. This way you need just to remember the code of one single command (the COM_CHECK command).
* Supports use of multiple SIM cards.
* Supports use of multiple SIM cards.
-
* Detect SIM card change. Details are [[ #SIM card change detection | here]].
+
* Detect SIM card change. It will send a notification containing the new SIM card's phone number, IMSI code & telecom operator name. This scenario happens if your phone's finder or thief replaces your SIM by his/hers own SIM card.
-
* Detect SIM card removal. Details are [[ #SIM card removal detection | here]].
+
* Optionally turn the phone silent on receiving a known command.
* Optionally turn the phone silent on receiving a known command.
* Stores personal settings encrypted.
* Stores personal settings encrypted.
Line 51: Line 45:
* Track the phone's GPS location and location changes by let it automatically send repeated notifications in a selectable time interval.
* Track the phone's GPS location and location changes by let it automatically send repeated notifications in a selectable time interval.
* Let front camera take pictures and send them via email notification. With a some luck you may see where your phone is or who is using it.
* Let front camera take pictures and send them via email notification. With a some luck you may see where your phone is or who is using it.
-
* Send a live front camera video to a different computer on the internet on which is running a video viewer application [available since version 0.9.19].
 
* Let the phone make a voice call to your controlling phone. Once the call is established you can listen where your phone is.
* Let the phone make a voice call to your controlling phone. Once the call is established you can listen where your phone is.
* Play a pre- and user-defined sound file (only WAV supported). May be used instead of just let the phone ring and let it say a special message.
* Play a pre- and user-defined sound file (only WAV supported). May be used instead of just let the phone ring and let it say a special message.
Line 75: Line 68:
* Autoloads at boot. This ensures that SMSCON is active (that means is listening for commands) even after device (re)boot. Autoload is enabled by default during installation of a SMSCON package.
* Autoloads at boot. This ensures that SMSCON is active (that means is listening for commands) even after device (re)boot. Autoload is enabled by default during installation of a SMSCON package.
-
* Create and keep a log file on the device. The log file can be queried remotely by SMS command as well as locally via command line or [[SMSCON Editor]].
+
* Create and keep a log file on the device. The log file can be queried remotely by SMS command as well as locally via command line.
* Reboot the phone. Albeit this is possible it is not generally recommended if your SIM card has a PIN: If nobody enters the PIN correctly, the phone would boot but could not connect to GPRS network.
* Reboot the phone. Albeit this is possible it is not generally recommended if your SIM card has a PIN: If nobody enters the PIN correctly, the phone would boot but could not connect to GPRS network.
* Shutdown the phone. Also just possible but not generally recommended.
* Shutdown the phone. Also just possible but not generally recommended.
Line 177: Line 170:
All phone numbers should be entered with country prefix. Not only ensures this that SMS are send successfully regardless where your phone actually is located. It further is essential to make phone numbers comparable.
All phone numbers should be entered with country prefix. Not only ensures this that SMS are send successfully regardless where your phone actually is located. It further is essential to make phone numbers comparable.
-
 
-
Prevent common mistake: If you receive the same SMSCON reply messages twice on a controlling phone, then check and ensure the MASTERNUMBER you've defined starts with international country prefix.
 
===After installation===
===After installation===
Line 216: Line 207:
===List of known sms commands===
===List of known sms commands===
-
 
+
* 'COM_CHECK': Command to ask for help.
-
These settings define text to trigger the corresponding command. You're encouraged to set them to words which are easy to remember in your language. The text may be set to the empty string which completely disables the command. It's not allowed to set two commands to the same text (except empty string).
+
-
 
+
-
A SMS message actually sent must consist of the command text prefixed/suffixed with text defined by [[#Prefix.2Fsuffix_for_all_SMS_command_strings | SMS_COMPREFIX/SMS_COMSUFFIX]] settings respectively.
+
-
 
+
-
* 'COM_CHECK': Command to ask for help.<br/>You may forget all other commands but should keep this and the prefix/suffix in mind.
+
* 'COM_REBOOT': Command to reboot the phone.
* 'COM_REBOOT': Command to reboot the phone.
* 'COM_POWEROFF': Command to shutdown the phone.
* 'COM_POWEROFF': Command to shutdown the phone.
Line 228: Line 214:
* 'COM_REMOTEON': Command to start outgoing ssh connection.
* 'COM_REMOTEON': Command to start outgoing ssh connection.
* 'COM_REMOTEOFF': Command to stop outgoing ssh connection.
* 'COM_REMOTEOFF': Command to stop outgoing ssh connection.
-
* 'COM_CAMERA': Command to take a picture or a live video from front camera [video since 0.9.19]. The front camera is used because it has no cover that may be closed.
+
* 'COM_CAMERA': Command to take picture.
* 'COM_CALL': Command to start an outgoing call.
* 'COM_CALL': Command to start an outgoing call.
* 'COM_LOCK': Command to lock the phone.
* 'COM_LOCK': Command to lock the phone.
-
* 'COM_UNLOCK': Command to unlock the phone.
+
* 'COM_UNLOCK': Command to unlock the phone (encrypted).
* 'COM_TRACKON': Command to start GPS tracking.
* 'COM_TRACKON': Command to start GPS tracking.
* 'COM_TRACKOFF': Command to stop GPS tracking.
* 'COM_TRACKOFF': Command to stop GPS tracking.
-
* 'COM_CUSTOM': Command to run a predefined [[#Files intended to be edited by user directly | user script]]. The script runs asynchronously until it terminates itself.<br>Version 0.9.18 supports definition of command text that accepts one or more arbitrary text parts. This parts are extracted and passed to the user script. This indirectly adds support for multiple, unlimited number of user scripts. See [[#Variable text parts in command definitions | below]] for details.
+
* 'COM_CUSTOM': Command to run predefined user script.
-
* 'COM_CUSTOMLOG': Command to ask for output of last COM_CUSTOM command.
+
* 'COM_CUSTOMLOG': Command to ask for user script output.
-
* 'COM_SHELL': The command text must be a unix shell command. It is directly passed to a unix shell for execution. In contrast to COM_CUSTOM, the COM_SHELL command does not execute in background and its output is immediately returned as notification SMS and/or EMAIL. Due to synchronous execution, you should not call commands that run for unpredictable long time (like pure ping).<br>Version 0.9.18 supports the definition of command text that accepts one or more arbitrary text parts. This allows to modify the shell command on a per sms-basis. See [[#Variable text parts in command definitions | below]] for details.
+
* 'COM_SHELL': Command to execute that shell command. Returns output as notification.
-
* 'COM_ALARM': Command to play once a predefined [[#Files intended to be edited by user directly | sound file]]. Alarm duration depends on sound file content; there is no command to stop playing the alarm sound.
+
* 'COM_ALARM': Command to play once the predefined <tt>alarm.wav</tt> sound file. Alarm duration depends on <tt>alarm.wav</tt> content; there is no command to stop playing the alarm sound.
* 'COM_RESTART': Command to restart the daemon.
* 'COM_RESTART': Command to restart the daemon.
-
* 'COM_LOG': Command to ask for application log.
+
* 'COM_LOG': Command to ask for application log (encrypted).
-
 
+
-
====Variable text parts in command definitions====
+
-
 
+
-
The COM_CUSTOM and COM_SHELL commands allow to define one or more arbitrary text parts. Each of these parts is simply written as a * character (star). Each * is a placeholder for zero or any number of characters as long there is a match with the sms message. In the command definition, the stars of two placeholders must not be consecutive. They must be delimited by at least one (or more) different character. Otherwise it would be completely impossible to say which placeholder covers how many chars of the incoming message.
+
-
 
+
-
Should there still be two (or more) consecutive stars in the command definition (like ** or ***), they act as '''one''' placeholder even though. The difference to a single star is, that ** defines an ''optional'' placeholder: All placeholders from the first (leftmost) ** up to the last (rightmost, no matter if this is a * or **) are optional. If they are omitted in the sms-message, their delimiting characters must also be omitted.
+
-
 
+
-
Usually the character used to delimit two placeholder can't be part of a placeholders value and there is no way to escape a character from being used as a delimiter. Should this ever become a problem, consider to define a COM_CUSTOM command using one placeholder only and parse the string in the user script.
+
-
 
+
-
'''Restriction''': In commands via CHECKHOST it is (currently) not possible to specify values for placeholders. In this case parameter values will be the stars from the command definition.
+
-
 
+
-
Examples:
+
-
<pre>
+
-
If COM_CUSTOM = mycmd(*/*/*)
+
-
then message    mycmd(there/are 3/arguments)
+
-
calls smscon_script with 3 parameters: "there" "are 3" "arguments"
+
-
 
+
-
      message    mycmd(watch / the / blanks! )
+
-
calls smscon_script with 3 parameters: "watch " " the " " blanks! "
+
-
 
+
-
      message    mycmd(more/2/3/4/parameters)
+
-
calls smscon_script with 3 parameters: "more" "2" "3/4/parameters"
+
-
 
+
-
      message    mycmd(less/parameters)
+
-
is not recognized (no match for 2nd /)
+
-
 
+
-
If COM_CUSTOM = mycmd(**/*/*)
+
-
then message    mycmd(less/parameters)
+
-
calls smscon_script with 3 parameters: "less" "parameters" ""
+
-
 
+
-
      message    mycmd(less/)
+
-
calls smscon_script with 3 parameters: "less" "" ""
+
-
 
+
-
      message    mycmd(less)
+
-
calls smscon_script with 3 parameters: "less" "" ""
+
-
 
+
-
      message    mycmd()
+
-
calls smscon_script with 3 parameters: "" "" ""
+
-
 
+
-
      message    mycmd(**/*/*)
+
-
calls smscon_script with 3 parameters: "**" "*" "*"
+
-
</pre>
+
-
 
+
-
You may also use commas or any other chars or combination of chars, even blanks to delimit placeholders:
+
-
<pre>
+
-
If COM_CUSTOM = P1=*, P2=**, P3=*
+
-
then message    P1=micky, P2=mouse
+
-
calls smscon_script with 3 parameters: "micky" "mouse" ""
+
-
 
+
-
      message    P1=micky, P2=mouse, P3
+
-
calls smscon_script with 3 parameters: "micky" "mouse, P3" ""
+
-
 
+
-
      message    P1=micky, P2=mouse, P3=
+
-
calls smscon_script with 3 parameters: "micky" "mouse" ""
+
-
 
+
-
      message    P1=micky,P2=nope
+
-
is not recognized (no match for blank behind comma)
+
-
 
+
-
</pre>
+
-
 
+
-
For COM_SHELL the assignment of message chars to placeholders is not important. Placeholder just indicate variable parts of the message here. The unix command being executed consist of the complete message anyway (after message prefix/suffix was stripped away).
+
-
 
+
-
====An example user script for COM_CUSTOM====
+
-
 
+
-
The smscon_script below demonstrates how to manage multiple user scripts. It is an example that may serve as a basis for your own dispatching script. Note that it does not depend on how COM_CUSTOM is actually defined (unless it has at least 3 placeholders):
+
-
<pre>
+
-
#!/bin/sh
+
-
# @abstract A smscon_script that uses new COM_CUSTOM command features.
+
-
# @see SMSCON application, N900, Nokia
+
-
# @author yablacky <schwarz.ware@gmx.de>, 2012-05-12
+
-
# A smscon_script example that makes use of new COM_CUSTOM command features.
+
-
# They allow to define placeholder in the sms-command that accept arbitrary
+
-
# text. This text is extracted placeholder by placeholder and is passed to
+
-
# this script as positional parameters $1, $2, ...
+
-
# This example script checks the first parameter and performs different actions.
+
-
trim() { local -; set -f; echo $1; }
+
-
CMD=$(trim "${1:-default}")
+
-
test $# -gt 0 && shift
+
-
echo "Processing '$CMD' from $SMSCON_SENDERNUMBER via $SMSCON_COMMANDORIGIN on $(date)"
+
-
case "$CMD" in
+
-
""|"*"|"default")
+
-
# A common case getting here is when COM_CUSTOM command is detected by CHECKHOST
+
-
# because (currently) CHECKHOST is not able to specify parameters.
+
-
echo Process list on $(date):
+
-
ps
+
-
echo netstat:
+
-
netstat -tean
+
-
;;
+
-
ps) ps
+
-
;;
+
-
netstat)
+
-
netstat -tean
+
-
;;
+
-
smsconset)
+
-
# Set SMSCON settings remotely!
+
-
smscon -set "$@"
+
-
;;
+
-
usercmd)
+
-
# Execute any command which is given in remaining parameters.
+
-
# *************************************************************************
+
-
# WARNING: THIS IS VERY POWERFUL BUT IT IS FINALLY A BACKDOOR TO THE DEVICE.
+
-
# *************************************************************************
+
-
# To limit possible desaster, create and change to a temporary directory
+
-
# and execute the command in the context of user rather than root:
+
-
D=/tmp/smscon_script
+
-
test -d "$D" || mkdir "$D" || test -d "$D" || exit
+
-
chmod 777 "$D"
+
-
cd "$D"
+
-
echo Executing: "$*"
+
-
echo "$*" | su user
+
-
cd ..
+
-
rm -fr "$D"
+
-
;;
+
-
purge-the-phone)
+
-
# Call a script that removes all private data from the phone.
+
-
# May be called if phone is lost without chance to get it back.
+
-
remove_sensible_private_data.sh "$@"
+
-
;;
+
-
do-something-else)
+
-
do_something_else.sh "$@"
+
-
;;
+
-
*)
+
-
echo "Unknown command '$CMD'"
+
-
;;
+
-
esac
+
-
 
+
-
</pre>
+
-
 
+
-
====A powerful but dangerous example for COM_SHELL====
+
-
 
+
-
Since version 0.9.18 it is possible to define the command text for COM_SHELL as
+
-
sh -c "*"
+
-
'''SECURITY NOTE''': Don't do that if you haven't any shadow of what this means. For those who know and are crazy enough to do, it offers amazing possibilities to control the phone via SMS. You should have SMS_COMPREFIX and SMS_COMSUFFIX defined to some reasonable long text.
+
-
 
+
-
'''ECONOMY NOTE''': The COM_SHELL command immediately replies by sending SMS messages containing the command output. Be careful with long-time-running commands and/or hugh-output-producing commands.
+
-
 
+
-
====COM_CAMERA: How to select picture or video====
+
-
 
+
-
The COM_CAMERA command activates the front camera for taking a single picture or a live video stream [video since version 0.9.19]. Once started, a live video stream is continuously sent until explicitly stopped by another COM_CAMERA command. A picture requires only one command per picture.
+
-
 
+
-
To select picture or video, the COM_CAMERA command does now accept up to 3 parameters. To specify them in a SMS, you have to define the COM_CAMERA command on your phone to contain at least three (recommended optional) [[ #Variable text parts in command definitions | placeholders]]. The corresponding parameter's meaning is as follows:
+
-
 
+
-
$1: Select picture or live stream (case insensitive):
+
-
    (empty), P, PIC or IMG: Take single shot image and send it by mail as usual.
+
-
    off, 0 or - (minus): Turn live stream off.
+
-
    (any other value): Turn live stream on with parameters $2 and $3 as follows:
+
-
$2: If live stream on: Hostname or IP where to send the live stream to.
+
-
$3: If live stream on: Port number where the given host is listening (default 5000).
+
-
 
+
-
Previously COM_CAMERA commands work as before and will take a picture (unless you've defined it containing a * already). You have to change your COM_CAMERA definition to enable live videos. For example,you may set it to
+
-
 
+
-
Camera**,*:*
+
-
 
+
-
Then SMSCON would accept the following SMS messages (prefix/suffix omitted for simplification):
+
-
 
+
-
Camera                          --> request to take a picture
+
-
CameraPIC                        --> ditto
+
-
CameraVID,your-computer.com:4321 --> request to start video being sent to
+
-
                                      host your-computer.com on port 4321
+
-
CameraON,your-computer.com:4321  --> ditto
+
-
Camera1,your-computer.com:4321  --> ditto (the 1 behind Camera is a 'one')
+
-
Camera1,your-computer.com        --> ditto, but uses default port 5000
+
-
Camera0,your-computer.com        --> request to stop video (the 0 behind Camera is a 'zero')
+
-
Camera0                          --> ditto
+
-
CameraOFF                        --> ditto
+
-
 
+
-
On a successful camera activation (picture as well as video) SMSCON sends a notification email. For pictures, this email has attached the picture taken.
+
-
 
+
-
For video is attached a viewer application that can be started to receive and watch the live stream. The viewer application is designed to run on linux systems for now. It requires the gstreamer application which is free. And you need, of course, run the viewer on the host that you specified in the preceding COM_CAMERA command. The usage of viewer application is:
+
-
 
+
-
usage: live-viewer.sh [--help] [port-number]
+
-
  --help              This help.
+
-
  port-number        Port on this host where to listen for incoming
+
-
                      live stream. Default port number is 5000.
+
-
 
+
-
If the video receiving computer is in a LAN behind a (DSL-)router (and the phone isn't) then you need to configure the router to forward the port for the UDP protocol.
+
-
 
+
-
By design SMSCON does not support a pre-configured video receiving host. It must be specified in each COM_CAMERA command explicitly. This gives you a wide range of possible computers where to watch the video.
+
-
 
+
-
SMSCON is not able to deliver picture and live video at the same time. A picture request also terminates a running live video (and does not restart it). Surprisingly SMSCON stop/start/restart does not terminate a live video. Reboot does.
+
-
 
+
-
'''Beware of network traffic caused by live video!''' If the phone is currently connected via WLAN then the traffic is about 40 kB/second. If a 2G or 3G connection is detected then a smaller image is sent which causes about 10 kB/second. The frame rate is about 15 fps in any case.
+
===Prefix/suffix for all SMS command strings===
===Prefix/suffix for all SMS command strings===
Line 567: Line 371:
</pre>
</pre>
-
These commands can be changed using [[SMSCON Editor]] or in Xterm at the unix command-line with the <code>smscon -set </code> command (see [[#SMSCON command line options | SMSCON command line options]]). Set them to words in your language or something cryptic where only you know what it means, might be a good idea.
+
These commands can be changed using the [[SMSCON Editor]] and also at the command-line with the <code>smscon -set </code> command (see SMSCON command-line options).
-
For now assume above definitions and empty SMS prefix/suffix (SMS_COMPREFIX and SMS_COMSUFFIX settings). Then when you send a SMS message to the phone which is exactly:
+
* 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 (<code>/opt/smscon/smscon_script</code>). 
 +
* Sending 'uptime' (an example shell command) will execute the shell command on your phone and returns the output.
 +
* Sending 'Alarm' will play once a user selectable file (only WAV format and must be named <code>alarm.wav</code> in <code>/opt/smscon</code> directory)  '''NEW IN 0.8.1''' 
 +
* Sending 'Restart' will kill the smscon_daemon and restart it.  '''NEW IN 0.8.1''' 
-
* 'Check' it replies by sending one or more SMS messages back to you with all the available SMSCON commands.
+
USAGE EXAMPLE:
-
* 'Reboot' will reboot your phone.
+
* To trigger any of the commands the phone should receive an SMS having in the subject its defined name. E.g. to trigger the <code>'''COM_LOCATION'''</code> command the phone should receive: <code>'''Location'''</code>.  
-
* 'Poweroff' will shutdown your phone.
+
* The commands can use spaces in them and can be altered in a command only you know what it is and what it means.
-
* 'Location' will send the phone's current position by SMS or EMAIL (or both).
+
* the alarm audio file (only WAV format and must be named <code>alarm.wav</code>) must be placed, if the option is used, in <code>/opt/smscon</code>.   '''NEW IN 0.8.1'''
-
* 'Remoteon' will enable the SSH connection to your (home-)server.
+
-
* 'Remoteoff' will terminate the SSH connection.
+
-
* 'Camera' will take a front camera picture an send it by email.
+
-
* 'Call' will issue an outgoing call to you.
+
-
* 'Lock' will lock the device, so nobody can use your phone.
+
-
* 'Unlock' will remove the device lock.
+
-
* 'Trackon' will continuously send SMS or email (or both) with GPS location of the device.
+
-
* 'Trackoff' will disable sending GPS locations.
+
-
* 'Script' will run a predefined [[#Files intended to be edited by user directly | user shell script]].
+
-
* 'uptime' will execute the shell 'uptime' command on your phone and returns the output.
+
-
* 'Alarm' will play once a [[#Files intended to be edited by user directly | user defined sound]].
+
-
* 'Restart' will stop and start again the smscon_daemon.
+
-
===Remote command server setup and use===
+
===Remote command server===
-
 
+
-
To use this functionality you need a file that is accessible via internet and you must be able to change the content of that file somehow. A private or company homepage that allows you to serve a small extra file in some inconsiderable subdirectory might be all you need.
+
-
 
+
-
Find out the URL to retrieve the file and test the URL in a web-browser. Then setup SMSCON to query your remote command server as follows:
+
-
 
+
-
smscon -set CHECKHOST "http://my-homepage.example.com/privat/phone/control.txt"
+
-
smscon -set CHECKTIME 15                  # minutes
+
-
smscon -set ENABLECHECKHOST yes
+
-
 
+
-
Once done, you can trigger any SMS commands by changing the content of the control.txt file (the file referred to by above URL which is an example only).
+
-
The file only must contain one of the following codes from 00, 01 to 19 or -1:
+
To trigger any of the commands by a remote file on your own server (when option ENABLECHECKHOST is enabled), the file only must contain one of the following values from 00, 01 to 19 or -1:  
<pre>
<pre>
Line 625: Line 419:
19 = COM_LOG
19 = COM_LOG
</pre>
</pre>
-
This two character code must be contained in the first two characters of the file. Further data is simply ignored but may be transferred with each query. So better keep the file small.
+
This two character code must be contained in the first two characters of the file. Further data is simply ignored but may be tranferred with each query. So better keep the file small.
-
 
+
-
Note that it currently is not possible to specify values for placeholders that may be defined in a sms command (e.g. COM_CAMERA command etc).
+
-
 
+
-
SMSCON checks the content of the file and executes the corresponding command if the content '''changed''' since last check. This prevents repeated command execution. On the other hand, to give the same command again explicitly, you have to switch to a "no comand" in between, which has code 00. Don't change the command codes too early. Wait for at least CHECKTIME minutes.
+
-
 
+
-
If the phone has problems when reading the file from your server via the http protocol (or the protocol you set), then check the log for ''CHECKHOST'' errors.
+
-
 
+
-
The default CHECKTIME is 15 minutes but can be changed via CHECKTIME setting. Note that after giving a command via remote command server, it can take up to CHECKTIME minutes to detect and execute the command.
+
-
 
+
-
===SIM card change detection===
+
-
 
+
-
The first time an unknown SIM is detected, SMSCON will send a notification. It contains the new SIM card's phone number, IMSI code & telecom operator name. This scenario happens if your phone's finder or thief replaces your SIM by his/hers own SIM card.
+
-
 
+
-
An unknown SIM is then entered to the SIM card database and will no longer generate a SIM card change notification.
+
-
 
+
-
===SIM card removal detection===
+
-
 
+
-
[since version 0.9.19] Each time the phone boots without a SIM card inserted, SMSCON tries to send an email notification (SMS is not possible without SIM). Email might work if the phone has somehow connected to an already known WLAN. The send retry option applies.
+
-
 
+
-
If email could be sent without SIM, there is a chance to control the phone at least via remote command server.
+
-
'''Note:''' On device boot it is possible to simply skip the SIM-card PIN-code question. To SMSCON this appears the same as SIM card removal. Consequently the email subject sent is "No or skipped SIM".
+
It is of course necessary that the file on your server can be read by your N900 via the http protocol (or the protocol you set). Otherwise it won't work. If it don't work, check the log for ''CHECKHOST'' errors.
-
'''Hint:''' Some user complained about being notified that they use their N900 albeit they use it without SIM in a home WLAN. Well, its not a bug, its a feature. Previously SMSCON versions throw away all possibilities being controlled by terminating itself. Should you use your phone this way and don't want any notifications et all, then do the same thing and stop SMSCON explicitly.
+
The default CHECKTIME is 15 minutes but can be changed via CHECKTIME setting. Note that after giving a command via remote command server, it can take up to CHECKTIME minutes to execute the command.
===Example config file===
===Example config file===
Line 655: Line 429:
Shown is an example config file as stored in <code>smscon_config</code>. This is presented for the gentle user only. Normal users never need to see nor edit this directly. Please use smscon command line or SMSCON Editor to edit settings.
Shown is an example config file as stored in <code>smscon_config</code>. This is presented for the gentle user only. Normal users never need to see nor edit this directly. Please use smscon command line or SMSCON Editor to edit settings.
 +
====Recent version====
<pre>
<pre>
# smscon user settings (initially written by version 0.9.16)
# smscon user settings (initially written by version 0.9.16)
# smscon configuration file written by:
# smscon configuration file written by:
-
@APPVERSION      = '0.9.17'
+
@APPVERSION      = '0.9.16'
# Send notification on battery discharge (yes|no):
# Send notification on battery discharge (yes|no):
Line 832: Line 607:
MASTERNUMBER    = 'CLS61ljsGhXGsZAMN58l8II96w=='
MASTERNUMBER    = 'CLS61ljsGhXGsZAMN58l8II96w=='
 +
</pre>
 +
 +
====Older version====
 +
 +
The config file of older version 0.8 may look like this:
 +
 +
<pre>
 +
# smscon user settings (v0.8.1)
 +
# (DO NOT edit the encrypted user settings below, use SMSCON-editor or SMSCON!)
 +
 +
# SMS number
 +
SENDERNUMBER      = '+1234567890'
 +
 +
# 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'
 +
COM_SHELL        = 'uptime >> /tmp/commandlog'
 +
COM_ALARM        = 'Alarm'  /* NEW IN 0.8.1 */
 +
COM_RESTART      = 'Restart'  /* NEW IN 0.8.1 */
 +
 +
# REMOTE command  /* NEW IN 0.8.1 */
 +
# (check server file at remote host to trigger smscon: 'yes', 'no')
 +
ENABLECHECKHOST  = 'no'
 +
# (check host)
 +
CHECKHOST        = 'www.bla.com/filetocheck'
 +
# (check interval in minutes)
 +
CHECKTIME        = 15
 +
 +
# Email settings
 +
EMAILADDRESS      = 'bla@bla.com'
 +
# (encrypted setting)
 +
USER              = '<ENCRYPTED>'
 +
# (encrypted setting)
 +
PASSWORD          = '<ENCRYPTED>'
 +
EMAILFROM        = 'bla@bla.com'
 +
MAILSERVER        = 'www.bla.com'
 +
MAILPORT          = 25
 +
 +
# SSH settings
 +
REMOTEHOST        = 'www.bla.com'
 +
REMOTEPORT        = 22
 +
# (encrypted setting)
 +
REMOTEUSER        = '<ENCRYPTED>'
 +
# (encrypted setting)
 +
REMOTEPASSWORD    = '<ENCRYPTED>'
 +
 +
# Reply message settings
 +
# (method to send reply messages: 'sms' / 'email' / 'both' / 'none')
 +
MESSAGESEND      = 'sms'
 +
# (enable resending of reply message after <RESENDTIME> minutes
 +
#  until successful sending; 'yes' / 'no')
 +
ENABLERESEND      = 'no'
 +
# (resend waiting time in minutes)
 +
RESENDTIME        = 15
 +
 +
# Send acknowledge SMS
 +
# (send acknowledge SMS after receiving valid SMS command: 'yes' / 'no')
 +
COMMANDREPLY      = 'no'
 +
 +
# Detect keyboard use
 +
# (send acknowledge SMS if keyboard is sliding: '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'
 +
 +
# Auto device unlock
 +
# (unlocks device when new SIM is inserted; 'yes' / 'no')
 +
SIMUNLOCK        = 'no'
 +
 +
# Silence the phone
 +
# (disable all phone sounds when SMSCON is set active with a SMS command: 'yes' / 'no')
 +
SILENCEDEVICE    = 'no'
 +
 +
# GPS settings
 +
# (if no GPS coordinates after <GPSTIMEOUT> seconds then stop aquiring)
 +
GPSTIMEOUT        = 1800
 +
# (number of GPS coordinates to acquire and use the most accurate in "Location"-mode)
 +
GPSPOLLING        = 3
 +
# (time between sending GPS coordinate SMS in "Trackon"-mode: 10 / 20 / 30 / 60 / 120)
 +
GPSINTERVAL      = 60
 +
# (method to send GPS coordinates: 'email' / 'sms' / 'both')
 +
GPSSEND          = 'sms'
</pre>
</pre>
Line 866: Line 742:
===Remote SSH connection===
===Remote SSH connection===
-
If SMSCON receives a COM_REMOTEON command (default command code 'Remoteon') it starts a ssh-server on the phone which tries to connect the host defined by REMOTEHOST setting, the "server side" (your own server). Values of REMOTEUSER and REMOTEPASSWORD settings are used to authenticate when contacting REMOTEHOST. This connection is (the reverse) part of the SSH connection tunnel being built.
+
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:
-
 
+
-
Once this (reverse-)SSH connection is made you can from the server side (=REMOTEHOST) connect to your Nokia device with the following shell command:
+
<pre>
<pre>
ssh -p 8080 localhost -l root
ssh -p 8080 localhost -l root
</pre>
</pre>
-
 
-
The hostname (''localhost'' in this example) was defined by the REMOTELISTENIP setting. The hostname ''localhost'' has special meaning, namely that you have to be logged in at your own server already when giving the above command.
 
-
 
-
The port number (''8080'' in this example) is a port number on REMOTEHOST and was defined by the REMOTELISTENPORT setting.
 
-
 
-
Above command contacts your phone at port 22 (or what ever port is defined by REMOTE2LOCALPORT setting). On the phone at this port the ssh-server is listening for incoming 'please open the door at the end of the tunnel' requests.
 
-
 
-
When you start making experiences with remote SSH connection you should leave all settings to their default, except REMOTEHOST, REMOTEUSER and REMOTEPASSWORD which must suit your own server name, user account on that server and its password.
 
-
 
-
On top of that, the remote SSH connection is even more powerful: If configured accordingly, it allows to contact the phone not only when you are logged in at REMOTEHOST. It supports connecting the phone from any (or particular) hosts in the internet as long as they are able to contact REMOTEHOST. In this case REMOTEHOST forwards  traffic to/from to the phone. Details on how to do this will follow.
 
==Files==
==Files==
Line 942: Line 806:
== Versions ==
== Versions ==
-
More information about each available version is [http://maemo.org/packages/view/smscon/ here].
+
=== 0.9.17-1 ([http://maemo.org/packages/view/smscon/ development]) ===
-
=== 0.9.19-1 (Current [[Extras-devel]]) ===
+
Availability: [[Extras-devel]]
'''Changelog'''
'''Changelog'''
-
  FIX: Fix poor image quality on COM_CAMERA command. SMSCON now uses ambient light sensor to select proper exposure and gain values for camera.
+
  FIX: Notification SMS were sent twice some times due to a too short timeout value. Now a longer timeout will hopefuly fix that.
-
FIX: Fix leaving temp files on smsmcon installation/upgrade.
+
=== 0.9.16-1 ([http://maemo.org/packages/view/smscon/ current extras testing]) ([http://maemo.org/packages/view/smscon/ current extras]) ===
-
 
+
-
ADD/CHANGE: SMSCON now keeps running rather than terminating itself if it does not detect a SIM card. This offers a litte chance that the phone connects to the internet via wlan which in turn allows to use CHECKHOST to control the phone. Note: If user skips the SIM code question on device boot, the phone treats this the same as if no SIM is present. SMSCON makes no difference. Now SMSCON makes an attempt to send a notification via email if no SIM was detected.
+
-
 
+
-
ADD: The COM_CAMERA command does now accept up to 3 parameters. To use them a user has to define the COM_CAMERA command on his phone to contain at least three (recommended optional) placeholders (a placeholder is written as ** or * char). More details see SMSCON wiki.
+
-
 
+
-
=== 0.9.18-1 ([[Extras-testing]]) ===
+
-
 
+
-
'''Changelog'''
+
-
ADDED: The SMS to trigger COM_CUSTOM and COM_SHELL commands may now contain arbitrary text which is passed to the script or shell as parameters. This allows for support of multiple custom scripts.
+
-
ADDED: Some environment variables are now setup before executing COM_CUSTOM and COM_SHELL commands:
+
-
  ${SMSCON_COMMANDORIGIN} contains info of command origin [SMS, CHECKHOST, CMDLINE]
+
-
  ${SMSCON_SENDERNUMBER} contains current sendernumber
+
-
  ${SMSCON_MASTERNUMBER} contains masternumber
+
-
  MINOR CHANGES: Fixed some typos; Superfluous script file name removed from feedback message.
+
-
 
+
-
=== 0.9.17-1 (Current [[Extras]]) ===
+
-
 
+
-
'''Changelog'''
+
-
FIX: Notification SMS were sent twice some times due to a too short timeout value. Now a longer timeout will hopefuly fix that.
+
-
=== 0.9.16-1 ===
+
Availability: [[Extras-testing]]
 +
Availability: [[Extras]]
'''Changelog'''
'''Changelog'''
Line 1,090: Line 936:
   NEW:    smscon now allows all options to start with the usual double dash as well.
   NEW:    smscon now allows all options to start with the usual double dash as well.
 +
=== 0.8.1-3 ===
 +
 +
'''Changelog'''
 +
* CHANGE/FIX: bug in ENABLECHECKHOST option; would execute wrong command & updated wiki because of some changes. See WIKI/Usage!
 +
 +
'''Issues'''
 +
* Using Wrong 3G connection when fMMS is installed (MMS connection instead)(unconfirmed by Vanvan)
 +
<del>* The "_" character does not get decoded correctly on reception and any command having this fails to execute. '''Recommended:''' until a fix is made avoid using this character in the commands. (confirmed)</del> -- fixed in 0.9.x [[User:yablacky|yablacky]] 08:46, 16 January 2012 (UTC)
 +
 +
=== 0.8.1-2 ===
 +
 +
'''Changelog'''
 +
* MINOR FIX: removed debug line in smscon code.
 +
 +
'''Issues'''
 +
* Using Wrong 3G connection when fMMS is installed (MMS connection instead)(unconfirmed by Vanvan)
 +
 +
=== 0.8.1-1 ===
 +
 +
'''Changelog'''
 +
* FIX: shutdown & reboot routine (EnablePoweroff & EnableReboot) give internal error.
 +
* NEW/CHANGE: expanded user setting MESSAGESEND ('sms', 'email', 'both' & 'none')
 +
* CHANGE: Removed DISABLESMS user setting. This is superseded by MESSAGESEND user setting!
 +
* CHANGE: with unauthorized SIM card change, SMS always will be send regardless of MESSAGESEND setting.
 +
* NEW: added smscon command (RESTART); user can restart smscon_daemon by SMS command.
 +
* NEW: added smscon command (COM_ALARM); phone will play user configurable sound file (only WAV format and must be named <code>alarm.wav</code> and placed in <code>/opt/smscon</code> directory) when command is received.
 +
* NEW: smscon_daemon sends SMS/email message if smscon_daemon crashes.
 +
* CHANGE: changed user setting ENABLERESEND ('yes', 'no'). Resending of messages will again be experimental feature!!!
 +
* CHANGE: removed MAXRESEND user setting (didn't work properly).
 +
* CHANGE: some log text changed/added.
 +
* CHANGE: removed updatechecker during installation of smscon (failed to work previously).
 +
* CHANGE: some changes in GPS message sending code.
 +
* CHANGE: AUTODEVICELOCK message is only send if COMMANDREPLY is enabled.
 +
* FIX: small bug in SMSsend().
 +
* FIX: bug in GPSINTERVAL handeling; GPSINTERVAL was always set at 60 sec. regardless of user setting.
 +
* CHANGE: The log file location changed from <code>/tmp/smscon.log</code> to <code>/opt/smscon/smscon.log</code> (whereas location of <code>/tmp/smscon_boot.log</code> did not change).
 +
 +
'''Issues'''
 +
* Using Wrong 3G connection when fMMS is installed (MMS connection instead)(unconfirmed by Vanvan)
 +
 +
===0.7-2===
 +
 +
'''Changelog'''
 +
* FIX: bug in RestoreNetwork(); restoring previous network could fail.
 +
* FIX: bug in CheckArguments(); execution of shell script could fail.
 +
 +
'''Issues'''
 +
 +
* Using Wrong 3G connection when fMMS is installed (MMS connection instead)(unconfirmed by Vanvan)
 +
 +
=== 0.7-1 ===
 +
 +
'''Changelog'''
 +
* '''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.
 +
 +
'''Known issues'''
 +
* 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 [http://talk.maemo.org/showthread.php?t=60729].
-
===Versions 0.8, 0.7, 0.6, 0.5 & 0.4===
+
=== 0.5 & 0.4 branch ===
-
Please don't use these anymore. Update to 0.9 or higher.
+
* Don't use these anymore and update to 0.7 or 0.8 branch!
==Future development ideas==
==Future development ideas==
Line 1,100: Line 1,017:
Feel free to add requests below.
Feel free to add requests below.
-
* Add a provision for SMS reception without the UI being notified so that SMSCON control is silent.<br/>INFO: Remote command server (CHECKHOST) already offers silent control.
+
* Add a provision for SMS reception without the UI being notified (so that SMSCON control is silent). INFO: Remote command server (CHECKHOST) already offers silent control.
-
* <del>Saving all <code>smscon_config</code> user variables in gconf database. No need for <code>smscon_config</code> file anymore.</del><br/>(WONT IMPLEMENT)
+
* saving all <code>smscon_config</code> user variables in gconf database. No need for <code>smscon_config</code> file anymore. (WONT IMPLEMENT)
-
* <del>Add setting for user's country mobile number prefix.</del><br/>(WONT IMPLEMENT: There is only one place where to specify the prefix anyway; namely the MASTERNUMBER)
+
* add setting for user's country mobile number prefix.
-
* <del>Add setting for alternative number (where alternative is a number sent a command and does not match the default) and </del>option to choose where reply should be send, i.e. default number, alternative or both. <del>Default number should not be replaced.</del><br/>(PARTLY IMPLEMENTED: Since 0.9.x there is a MASTERNUMBER concept. This is a default number that is never replaced.)
+
* 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. INFO: Since 0.9.x there is a MASTERNUMBER concept. This is a default number that is never replaced
-
* Add setting to choose the default internet connection (WLAN, GPRS, or ANY).
+
* add setting to choose the default internet connection (WLAN, GPRS, or ANY).
-
* 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.
+
* 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.
-
* <del>Add the ability to run more than one custom command.</del><br/>(IMPLEMENTED SINCE 0.9.18).
+
* Add the ability to run more than one custom command.
-
* <del>Application must be included in the ROM itself so that it cannot be removed.</del><br/>(CAN'T BE IMPLEMENTED)
+
* Application must be included in the ROM itself so that it cannot be removed. (CAN'T BE IMPLEMENTED)
-
* <del>Add a password so that no one else but the legitimate user can send an SMS to the phone and see where the phone is.</del><br/>(IMPLEMENTED since 0.9.x: The SMS_COMPREFIX/SMS_COMSUFFIX settings supply the desired password functionality)  
+
* Add a password so that no one else but the legitimate user can send an SMS to the phone and see where the phone is. (INFO: Use the prefix/suffix option in smscon editor application or set SMS_COMPREFIX/SMS_COMSUFFIX options via command-line)  
* Auto remove the received SMS from conversations.
* Auto remove the received SMS from conversations.
* Disable PhoneSpeakerSwitch on receipt of 'call' command.
* Disable PhoneSpeakerSwitch on receipt of 'call' command.
-
* <del>EmailCON: check an specified email inbox, reading it with the program itself and not the built in default mail prog, at a given frequency, paying attention to commands written in the subject and/or body, accepting all the commands that are accepted via SMS.</del><br/>(WONT IMPLEMENT)
+
* EmailCON: check an specified email inbox, reading it with the program itself and not the built in default mail prog, at a given frequency, paying attention to commands written in the subject and/or body, accepting all the commands that are accepted via SMS. (WONT IMPLEMENT)
-
* <del>Improve handling of front camera to reduce the odds of crappy or plain blank black pictures being taken.</del><br/>(CAN'T BE IMPLEMENTED)
+
* Improve handling of front camera to reduce the odds of crappy or plain blank black pictures being taken. (CAN'T BE IMPLEMENTED)
-
* When in "stolen" mode, replace the front cam "recording" LED pattern with a on-lighting pattern for stealthiness.<br/>(NOTE: The is no 'stolen mode')
+
* When in "stolen" mode, replace the front cam "recording" LED pattern with a on-lighting pattern for stealthiness.
* Email, or post online somewhere you choose, any new photography taken with the main camera, geotagging whenever possible, preferably without showing any signs it's happening (if possible with an option to re-dimension the picture before sending).
* Email, or post online somewhere you choose, any new photography taken with the main camera, geotagging whenever possible, preferably without showing any signs it's happening (if possible with an option to re-dimension the picture before sending).
-
* There should be an option to send email as text or as multipart html and text.<br/>(WHAT'S THE BENEFIT? TEND TO SAY WON'T IMPLEMENT)
+
* There should be an option to send email as text or as multipart html and text.
* For encryption of user settings secret code key could be based on device serial number (no more predefined key in script); this enhances security.
* For encryption of user settings secret code key could be based on device serial number (no more predefined key in script); this enhances security.
Line 1,151: Line 1,068:
This page has been accessed 41,132 times. --[[User:yablacky|yablacky]] 00:57, 13 April 2012 (UTC)<br>
This page has been accessed 41,132 times. --[[User:yablacky|yablacky]] 00:57, 13 April 2012 (UTC)<br>
This page has been accessed 42,375 times. --[[User:yablacky|yablacky]] 15:30, 28 April 2012 (UTC)<br>
This page has been accessed 42,375 times. --[[User:yablacky|yablacky]] 15:30, 28 April 2012 (UTC)<br>
-
This page has been accessed 43,315 times. --[[User:yablacky|yablacky]] 00:14, 13 May 2012 (UTC)<br>
+
 
-
This page has been accessed 43,675 times. --[[User:yablacky|yablacky]] 06:51, 16 May 2012 (UTC) wow, 10,000 :))<br>
+
-
This page has been accessed 44,554 times. --[[User:yablacky|yablacky]] 02:45, 23 May 2012 (UTC)<br>
+
-
This page has been accessed 44,921 times. --[[User:yablacky|yablacky]] 21:33, 24 May 2012 (UTC)<br>
+
-
This page has been accessed 48,809 times. --[[User:yablacky|yablacky]] 21:19, 8 June 2012 (UTC)<br>
+
-
This page has been accessed 55,671 times. --[[User:yablacky|yablacky]] 16:21, 13 July 2012 (UTC) 22,000!!<br>
+
-
This page has been accessed 77,263 times. --[[User:yablacky|yablacky]] 16:37, 20 May 2013 (UTC)<br>
+
[[Category:Software]]
[[Category:Software]]
[[Category:N900]]
[[Category:N900]]

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)