Reply
Thread Tools
Posts: 26 | Thanked: 11 times | Joined on Nov 2009
#1
This script was born out of my rage of having my N900 stolen earlier this year. I wanted a simple SMS-based solution for retrieving my new N900 if it were ever stolen again. I used some python code for SMS send/recv and GPS tracking from the wiki and put it together for this.

Here's how it works:
At phone startup, the script reads the SIM card number and compares it to your own valid number. If invalid, it'll send an SMS every x seconds to a pre-defined phone number that includes IMSI and GPS coordinates. It also makes a phone call to the same number after a user-defined number of seconds (to lower chance of thief closing out the phone app).

Whether the SIM card is valid or not, the script listens for a user-defined SMS alert-code. When alert mode is activated, it returns texts to the incoming number with the same info as above (IMSI and GPS).

Installation:
1. Send thief-be-caught.tar.gz to n900
2. Extract: tar cvf thief-be-found.tar.gz -C /
3. Fill out variables at the top of /etc/event.d/banana
3. Reboot
4. Check if script is running with: ps | grep sms

Prereqs: python libraries (incl. python-location)

To close the daemon:
sh /usr/sbin/sms-quit.sh

Notes:
* Some alert code strings seem to be interpreted incorrectly by the SMS receiving procedure, so try changing the alert code if nothing happens.
* Every time the GPS coordinates are read, the internal GPS and network positioning are enabled in case they were ever disabled. The location server will also be set to supl.google.com.

I hope this helps someone get their phone back if anything unfortunate happens. I am new to sh and python scripting, so please test and improve or offer feedback.
Attached Files
File Type: gz thief-be-caught.tar.gz (16.0 KB, 292 views)

Last edited by boxhead; 2010-08-18 at 20:45. Reason: changed to tar.gz and modified starting script
 

The Following 10 Users Say Thank You to boxhead For This Useful Post:
Posts: 92 | Thanked: 17 times | Joined on Feb 2010
#2
Thanks for that!
Do I have to activate it by sending SMS only?
 
Posts: 82 | Thanked: 44 times | Joined on Feb 2010
#3
You may also be interested in http://www.whereismydevice.com, (see http://talk.maemo.org/showthread.php?t=51027) - you could integrate your script with this, which will then keep you updated even if the stolen n900 has no capability to send SMS, by updating the details on the website for you to monitor.

Cheers,

Ben
__________________
http://www.whereismydevice.com - Recover your device if lost/stolen

http://jqueryinreallife.blogspot.com - Comedy jQuery blog
 
Posts: 26 | Thanked: 11 times | Joined on Nov 2009
#4
@Reeby
Yes, just send the ALERT_CODE you define.

@benh
Thanks. I'm setting up your scripts right now in case this falls through.
 
Posts: 56 | Thanked: 11 times | Joined on Jan 2010
#5
Originally Posted by boxhead View Post

Installation:
* banana -- place in /etc/event.d and edit the variables at the top
* sms.py, sms_gps.py -- place in /usr/sbin and chmod 755
* reboot
.
how do i place the files in /usr/sbin and chmod 755,

I now do it:

cp /home/user/MyDocs/newfolder/* /usr/sbin

and: cp /home/user/MyDocs/newfolder* /home/user/MyDocs/chmod 775

but that doesn't work :P


do i have to follow the banana documents steps? don't really understand them

Last edited by AlexV12; 2010-08-17 at 16:36.
 
Marcus's Avatar
Posts: 173 | Thanked: 72 times | Joined on Mar 2010 @ Denmark
#6
AlexV12:
It requires either SSH or using XTerm.

But please, don't do anything you don't know what is.

EDIT: You updated right before me.

Remember to do it as root.
sudo gainroot
 
Posts: 11 | Thanked: 3 times | Joined on Feb 2010
#7
Can somebody upload it to devel repository?

Thanks!
 

The Following User Says Thank You to luizcesta For This Useful Post:
Posts: 56 | Thanked: 11 times | Joined on Jan 2010
#8
Originally Posted by Marcus View Post
AlexV12:
It requires either SSH or using XTerm.

But please, don't do anything you don't know what is.

EDIT: You updated right before me.

Remember to do it as root.
sudo gainroot
i did, but unfortunatly nothing happens.

well it doesn't give an error but what do i do after i've copied the files to sbin and chmod?
 
Posts: 26 | Thanked: 11 times | Joined on Nov 2009
#9
@alex
You must copy sms.py and sms_gps.py to the /usr/sbin folder. There is no chmod folder. chmod is a unix command that lets you change file permissions. In this case, we need these files to execute, so type in:
Code:
cd /usr/sbin
chmod 755 sms.py
chmod 755 sms_gps.py
Finally, the file 'banana' is the script that runs at bootup. It must be copied to /etc/event.d

Make sure you edit the parameters at the top of this file.

VALID_IMSI=XXXXXXXXXXX # this is your own IMSI
SEND_TEXT_INTERVAL=120.0 # how often (sec) to send SMS
HOME_PHONE=XXXXXXXXXX # designated phone number to send SMS and phone calls
TIME_WAIT_TO_CALL=60 # time to wait (sec) after invalid SIM card detected before making phone call
ALERT_CODE="XXXXXXXXX" # SMS code used to activate alert mode

To fill out the VALID_IMSI field, you can find your own IMSI by entering this into the terminal:
Code:
dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.SIM /com/nokia/phone/SIM Phone.Sim.get_imsi
 
Posts: 56 | Thanked: 11 times | Joined on Jan 2010
#10
allright, i've done all that. how do you know when itms working?

like always xterm just goes to the next line (which normally means it worked what you typed)

but how do you shut it off? i'm not going to try it before i can turn it off.
 
Reply


 
Forum Jump


All times are GMT. The time now is 12:01.