![]() |
N900 physical recovery (Getting your phone back!) [HOWTO]
Alright, i think i speak for a lot of us that losing our phones would be disastrous. Either because you lose it, or it was stolen. Nobody wants to go through that.
I've made some strides in making sure that you can get it back. It's important to note that aside from the first step, the rest can be done REMOTE. So if you really have lost your phone you can do all of the steps while it's still lost but responding. This guide will also help if you've allready lost it but can still log in. Required: *a modicum of unix/linux knowledge, you'll need to know how to use SSH and edit files from the commandline *ssh installed on the phone *a remote server, ssh/ftp etc. DISCLAIMER: Using the below could end in tears/flames/the end of the world! Also my code will most likely be ugly/tear inducing/vommitable so use at your own risk :D The most important step is making sure you know what your phone's public IP is. Most mobile providers will randomize your IP on each connection but that's what this whole thing is about. If you know this, and you can still login, you have a shot at recovery. To be able to find it, you could install a dynamic DNS client, or you can do the following: Locate the /etc/network/if-up.d/00_disable_icmp_echo_reply and add the following in between the bottom echo and exit lines: Code:
ifconfig gprs0|awk '/inet addr/ { print $2 }'|awk -F: '{ print $2 }' > /tmp/n900ip Code:
scp /tmp/n900ip [user]@[remote computer]:/[remote location] Adding these lines to this script will make sure it's activated every time your phone makes a gprs/3g connection, storing the ip offsite every time. Check to make sure this works by disconnecting and reconnecting your connection on the phone and checking the file it uploaded to your server. After you do this try logging in to your phone with this IP using SSH. Did all that work? Great, rest easy for now. IT'S GONE! I CAN'T FIND IT! Alright, if everything went as planned you'll have your public ip. Try the SSH connection you tested and login. IT WORKED! Now what? First things first. If your phone is moving, it very probably isn't in your posession anymore. Check the accelerometers to see if this is the case with: Code:
watch cat /sys/class/i2c-adapter/i2c-3/3-001d/coord Ok so it's not moving, it could be you just left it in a pocket or somewhere close. Let's make it make a noise. If you have mplayer you could do a: Code:
mplayer /home/user/MyDocs/[location with an MP3] Code:
dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_activate string:PatternIncomingCall Code:
dbus-send --print-reply --system --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_vibrator_pattern_deactivate string:PatternIncomingCall THIS IS STUPID, YOU'RE STUPID! I DON'T HEAR IT? Well, here is where things get a bit more complicated. It could be that you left it at work, or maybe it's not actually in your possesion anymore... Let's see what were up against. Make a picture with the front cam: Code:
gst-launch v4l2src device=/dev/video1 num-buffers=1 ! ffmpegcolorspace ! jpegenc ! filesink location=frontcam.jpg Code:
python -m SimpleHTTPServer 80 You can also make it call you and listen in on what is going on the neigbourhood of your phone: Code:
dbus-send --system --dest=com.nokia.csd.Call --type=method_call --print-reply /com/nokia/csd/call com.nokia.csd.Call.CreateWith string:"[YOUR PHONE NUMBER GOES HERE]" uint32:0 I DON'T HEAR OR SEE A THING! Here's where we're going to try and read the gps. First, install python-location (apt-get install python-location) on your phone and make a new file called gps.py and fill it with this (thanks to happy_n900_user!): Code:
import location Code:
python2.5 gps.py If it's out of GPS range, you'll have to kill it with CTRL+C. Once you have that, GO GET YOUR PHONE BACK (but please be smart about it! ;) ) All of this is not meant to be some all inclusive guide, it's meant to give you a shot if you ever do lose your phone. I'll try and keep this post updated with new methods Big thanks go to: -Jebba for his great list of dbus commands -happy_n900_user for getting the python script to actually spit out a GPS location -everyone involved in making this phone as great as it is! |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
I still like the option of setting up a daemon to check a file on a server you have access to for a trigger to send the front cam photo and lat/long to an email address or save it to a server. This means that if it is out of signal range of any network when you try to get hold of it, it can still get the info to you when it finds a network connection...
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Very useful. Thanks.
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Useful and funny. I like that it helps with my most likely problem, that my N900 has fallen into an obscure corner of the rubble sometimes called my residence.
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Nice ideas but totally useless if someone has stolen your phone and puts a different sim card in it
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
That's a pretty cool thing to be able to do!
Does the phone need to have active internet connection for this to work or just be switched on? |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
This is a nice idea and all, but how do you expect to SSH to the device if it is connected to a GSM network only? In my experience, devices on cellular GSM data networks are NAT'd behind a firewall with hundreds of other devices, so unless they explicitly forward SSH to your device, there's no way you can connect to it..
I just connected my N900 to a GSM data network, viewed IP for gprs0 in ifconfig, and even visited 'whatismyip.org' to verify, and I was unable to SSH to the device, or even ping it. Unfortunately, unless the device somehow 'knows' it is stolen and phones home, or the thief connects to a wifi network that explicitly allows SSH forwarding to the device, it's as good as gone. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
I am pretty sure you could also use dynamic dns to keep track of your IP, but I have never tried it before, so not sure how to set it up.
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
@craftyguy:
In testing this i was consistently able to setup a connection using the public IP, but this might not work for your provider. Instead you could go the reverse port forwarding route. This will require you have an ssh-able server on the other end, not to mention you'd still need some way to consistently reconnect. If someone has a version of autossh that runs on the phone that'd be ideal for this. The unknown however is how a permanent connection will affect the battery life. As said, this is not meant to be a all inclusive guide, more of a list of pointers and commands that, should your phone be lost, can be used to track it down. @benh_n900: I've added this link to the above guide which has information on how to do that. Personally I don't like to give it a DNS for fear of it getting hit too hard from outside sources. The only person who should have access to it is me. The method in the guide ensures that. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
Interesting concept. For the record, I'm on T-Mobile here in the US. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Great GUIDE!
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
Think of this as a fallback option. That's why it has single line (easily copy+pasted) commands in it. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Really useful tutorial, didn't had a clue till now how I can make it vibrating with commands, or how to make a call that way and stuff, thanks :)
The only part which I can't get working is: Quote:
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
It got me thinking though, if instead of the "write ip to a file" line in the if-up script you put a reverse port forward like: Code:
ssh -R 2210:localhost:22 [yourserver] Might be worth trying out. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Excellent collections of one liners synthaxx, here is what I modified:
Writing your IP to a file does not really have anything to do with ping reply, so for better abstraction I created a new file instead of editing /etc/network/if-up.d/00_disable_icmp_echo_reply I named it /etc/network/if-up.d/10_send_ip Code:
#!/bin/sh Code:
scp -F /home/user/.ssh/config /tmp/n900ip You can also skip saving the IP to a file by changing the file 10_send_ip to: Code:
#!/bin/sh |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
@ecksun
Thanks! I was just trying to get this to go directly to an ssh session, and yours works very nicely. I agree that putting it in the disable echo reply script is not the prettiest method, but since that script will only execute with an external connection it'd do for now. Got me thinking too. What if you have the script checking for a specific file, something like "stolen" on your server. If that file exists, start a reverse portforward. That way, if you make that file it'll start an ssh which allows people that don't have direct access to the ssh session via their public ip to still access it remotely. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Oh, I see, that would be easy to check though, can update the script in a little while (to check for external connection), however that might not always be desired?
It doesn't sound too hard to start a reverse port forward if there exists a file on the server, however it might take a while for the phone to recognize the file considering it only checks for it when a new connection is established. Could be crontabed though. Just on a side note, the N900 and the SSH server does per default accept connections even on the gprs0 interface? I'm having some troubles connecting but my ISP claims they don't block any ports :/ Edit: I beleave I just have to add the following line to the file, though i have not tested it.. Code:
if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then Code:
#!/bin/sh |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
It could be triggered by SMS to the phone.
If SIM card changed, then detect it and use it to send an SMS to other phone, so you will have the new SIM's phone number. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
This is fascinating stuff.
I am still thinking about how to get this script working on my N900 and about where it should send the file to, but I'm also wondering if we could have a little more information included in the file before it's sent. Nearby wireless AP for example. I know that iwlist wlan0 scan will give me MAC addresses and power levels and I can then use something like http://outflux.net to /geoloc/ to get a street. Does this sound possible or have I missed the point? |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
What I learnt from this, if I manage to nick a N900, I'll flash it :p
firmware AND eMMC just to be safe that no one can track me down :p also i will buy a simcard with data connection blocked and use with the stolen phone :p solution: implement some sort of security protection for Flasher |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
I hacked up a script, designed to be run in a cron job, which gathers information about the machine's current internet connection and send it hidden in a ping message as well as via a UDP packet; I didn't think to interrogate the GPS as none of my computers have one built in, it'd be easy to add. The only thing it needs is
Here it is, please attempt improvements or offer ideas. http://pastebin.com/SHf1ynzj |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Would there be an easy way to have the phone send this off in an email? I'm thinking that it could run a few times a day and I can filter these off into a folder other than my inbox.
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Per this python-location thread I suggest adding an additional conditional check to the if statement in you GPS code. I was having problems with the first iteration through the loop returning inaccurate LAT/LONG data. If I only return a value when device.fix[6] is less than a constant (I chose a value of 2000), then I get the results I would expect.
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Maybe I am pointing the obvious, but it is not necessary to use dyndns. If you have a voip account active on your N900, its i.p. is known from the registar.
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Any further with this guys? I can execute all the scripts via ssh in my won lan or when the phone is connected to another Lan. Its just when it is connected to data plan connection im hitting a stumbling block. I think Vodafone UK block it maybe?
There was a application a while back called RemoteSecurity that locked the phone when you sent a particular message to it. It had a few bugs but it worked. Could it not work if say you nominate a Mob number as emergancy contact. If you then send a particular word/phrase from that mobile it could then lock the pone and send all this data Gps position ect back to nominated number. Also if a new sim is detected it could send the data to the emergancy number aswell as IP address if connected to WLan. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
i just got ddclient to work so it can update my dynamic IP adress (http://sourceforge.net/apps/trac/ddclient)
only one problem: perl on de n900 seems to lack the sys/hostname.pm module. so i copied this from my ubuntu box to the n900 , made the configfile in /etc/ddclient, made a /var/cache/ddclient dir and the ddclient is running and updating my ip adress with zonedit :D very happy with this.. planning to run it every time the gprs0 goes ip .. if its on wifi i guess remote ssh'ing is useless when stolen, they have to forward all ssh traffic for this to work.. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
I saw this thread but immediately saw that it is not going to work unless you use the phone to intiate a reverse ssh tunnel to a remote host, due to most internet connections being NAT.
My solution which I have finally got working is this: 1. setup an ssh server on a remote host that is on the internet. I run it on port 443 as it's unlikely that it'll get blocked 2. setup key file based login on the server and copy the public key to the phone. This is the fiddly step. 3. create a file in /etc/network/if-up.d/ that contains something like: ssh -o ExitOnForwardFailure=yes -vvnTNx -p 443 -R 22222:localhost:22 user@remotehost This way, every time it connects to the internet, it will try to create a reverse tunnel to your remote host. Then if I need to connect to my phone, I do the following command on my remote host: ssh -p 22222 localhost hope this helps. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
If you use sipphone (which is the company behind gizmo), you can logon using your user i.d. and get the i.p. and the open port of your N900. You can also use any port, not just 5060. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
My question is this - if I only allow the device to connect to the internet via wifi, is there any way that this tunnel could use one of the other interfaces to send/receive data? (they go up, even if they don't get an internet connection, right?), or is it constrained by my internet connection choices? Ben |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
It can be hidden at a very low level (/etc/inittab) and doesn't rely on any kind of user input, only that the thief has the phone switched on whilst near any open wifi. You can make the phone connect to a different server by updating the dns of the remote host you programmed it to connect to. So, say you needed to bring down the remote server, you could put another in it's place without having to reprogram the phone. Pretty much every firewall in the land allows port 443 and traditionally it's not monitored that heavily, as most traffic across it is expected to be encrypted/ Quote:
if [ "$ICD_CONNECTION_TYPE" != GPRS ]; then It could quite easily use GPRS and shouldn't use much bandwidth at all unless you use the tunnel. I was thinking of having some rules as to when it should try and use GPRS to connect, something like no connection for a week via WLAN, try using the GPRS. It would be nice to work out a script that collected as much geographical/call related information, encrypt it then use the ssh tunnel to drop it off at the remote server. |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
Thanks though! Ben |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
(Sowwy for being lazy and not look it up from specs myself.) |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
Code:
$ diff oldgps.py gps.py |
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
hi , i need some help from you guys , my mobile(n900) is stolen . i m living in Qatar . is there any way that i can track the location of my mobile . plz help
|
Re: N900 physical recovery (Getting your phone back!) [HOWTO]
Quote:
|
All times are GMT. The time now is 17:47. |
vBulletin® Version 3.8.8