Page 1 of 2 12 LastLast
Results 1 to 20 of 37
  1. jsabo's Avatar
    Posts
    427 Posts
    Global Posts
    479 Global Posts
       #1  
    Wiki & original script is here: pre dev wiki: GPS Tracking

    What that does is set up a job to run every 5 minutes, and check to see if you've gotten a text message that contains your secret code word.

    If you have, it emails you the current GPS location of your phone-- you know, that service that Apple wants you to pay for?

    Anway, I've updated the script so that instead of sending raw data, it will instead send a URL to Google Maps, and I added more comments, so if anyone wants to try to take this further, it's hopefully less work.

    Ze code:
    Code:
    SECRET=make up any secret code here-- must be a single word
    DEST=put your e-mail address here
    
    track()
    {
            # Call the GPS radio to get the location
            # The more times you run this (-n #), the more accurate it will get. Going above 3 does not seem to make any real difference
            # The tail -l command ensures that if you do run this multiple times, we only look at the last output.
            pos=$(luna-send -n 3 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1)
    
    				#strip the resulting information down to just the numeric values and the commas
    				pos=$(echo $pos | sed -r 's/[^-\.0-9,]//g')
    
            #echo $pos
    
            #We only care about 5 fields-- lat, lon, speed, altitude, and heading.
            #Use the cut function to split $pos and get those values
    
            lat=$(echo $pos | cut -d, -f4)
            lon=$(echo $pos | cut -d, -f5)
            hed=$(echo $pos | cut -d, -f7)
            spd=$(echo $pos | cut -d, -f8)
            alt=$(echo $pos | cut -d, -f9)
    
            #Create the URL to google maps
            msg=$(echo "http://maps.google.com/?ie=UTF8&q=$lat,$lon+(Heading:%20$hed%0DSpeed:%20$spd%20mph%0DAltitude:%20$alt)")
            #echo $msg
    
            #send the message
            luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"value": "'${DEST}'", "contactDisplay": "'${DEST}'", "prefix": "to$A", "identifier": "palm_anon_element_8"}], "messageText": "'"$msg"'"}'
    }
    
    checkmsg()
    {
            #Check to see if there have been any text messages sent in the last 5 minutes containing our secret string
            echo ".timeout 30000" > /tmp/trackersql
            cmd='SELECT messageText FROM com_palm_pim_FolderEntry WHERE timeStamp > (strftime("%s000", "now")-600000);'
            #output=$(echo $cmd|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3)
            output=$(echo $cmd|sqlite3 -init /tmp/trackersql /var/luna/data/dbdata/PalmDatabase.db3)
            echo $output|grep $SECRET 2> /dev/null > /dev/null
            status=$?
    
            if [ $status = 0 ]; then
                    track
            fi
    }
    checkmsg
    Enjoy!
  2. #2  
    I assume a rooted pre is necessary?
  3. #3  
    awesome idea thank you
  4. jsabo's Avatar
    Posts
    427 Posts
    Global Posts
    479 Global Posts
       #4  
    Quote Originally Posted by backlund View Post
    I assume a rooted pre is necessary?
    Totally. This is just a background job in linux that happens to call a couple of the Pre-specific functions.

    I might make a couple more passes at it to clean up the DB query and automatically send the location to anyone who knows the password-- that way, when you lose your phone, you can use your buddy's phone to find it.
  5. #5  
    Wouldn't it be easier (and better on the battery) to just hack the messaging app to look for specific keywords and either sms the location back to the user or call a separate app to email the google maps url for the location?
  6. jsabo's Avatar
    Posts
    427 Posts
    Global Posts
    479 Global Posts
       #6  
    Quote Originally Posted by mattbrad2 View Post
    Wouldn't it be easier (and better on the battery) to just hack the messaging app to look for specific keywords and either sms the location back to the user or call a separate app to email the google maps url for the location?
    Rather than running the cron job every 5 minutes? Better on battery, possibly. Easier is debatable.

    Hacking the app would probably mean adding just a single line for the check, which is probably better for the battery. But you would need to find where that is in the app, and if they update the app, your hack goes away.

    Either way, I just modified what the original poster did, rather than trying to reinvent the wheel.

    That said, right now, you do see the incoming message with the code word, and you do see the outgoing message with the URL in it-- if I stole your phone, it's semi-obvious that the phone just reported its location to someone.

    Another poster showed a hack that would report the phone's location back to a web server, rather than replying with a text. It did that every time the script ran.

    Another possible change would be to combine the two-- if I send the code word to the phone, via text, have it automatically start reporting its location to a web server, rather than replying back via text. Going in that direction could get more interesting, as you could set up MobileMe like functionality for the masses.

    Maybe something to do next week
  7. #7  
    Quote Originally Posted by jsabo View Post
    Wiki & original script is here: pre dev wiki: GPS Tracking

    What that does is set up a job to run every 5 minutes, and check to see if you've gotten a text message that contains your secret code word.

    If you have, it emails you the current GPS location of your phone-- you know, that service that Apple wants you to pay for?

    Anway, I've updated the script so that instead of sending raw data, it will instead send a URL to Google Maps, and I added more comments, so if anyone wants to try to take this further, it's hopefully less work.

    Ze code:
    Code:
    SECRET=make up any secret code here-- must be a single word
    DEST=put your e-mail address here
    
    track()
    {
            # Call the GPS radio to get the location
            # The more times you run this (-n #), the more accurate it will get. Going above 3 does not seem to make any real difference
            # The tail -l command ensures that if you do run this multiple times, we only look at the last output.
            pos=$(luna-send -n 3 palm://com.palm.location/startTracking '{"appId": "ILovePalm", "subscribe": true}' 2>&1 | tail -1)
    
    				#strip the resulting information down to just the numeric values and the commas
    				pos=$(echo $pos | sed -r 's/[^-\.0-9,]//g')
    
            #echo $pos
    
            #We only care about 5 fields-- lat, lon, speed, altitude, and heading.
            #Use the cut function to split $pos and get those values
    
            lat=$(echo $pos | cut -d, -f4)
            lon=$(echo $pos | cut -d, -f5)
            hed=$(echo $pos | cut -d, -f7)
            spd=$(echo $pos | cut -d, -f8)
            alt=$(echo $pos | cut -d, -f9)
    
            #Create the URL to google maps
            msg=$(echo "http://maps.google.com/?ie=UTF8&q=$lat,$lon+(Heading:%20$hed%0DSpeed:%20$spd%20mph%0DAltitude:%20$alt)")
            #echo $msg
    
            #send the message
            luna-send -n 1 palm://com.palm.messaging/sendMessageFromCompose '{"recipientJSONArray": [{"value": "'${DEST}'", "contactDisplay": "'${DEST}'", "prefix": "to$A", "identifier": "palm_anon_element_8"}], "messageText": "'"$msg"'"}'
    }
    
    checkmsg()
    {
            #Check to see if there have been any text messages sent in the last 5 minutes containing our secret string
            echo ".timeout 30000" > /tmp/trackersql
            cmd='SELECT messageText FROM com_palm_pim_FolderEntry WHERE timeStamp > (strftime("%s000", "now")-600000);'
            #output=$(echo $cmd|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3)
            output=$(echo $cmd|sqlite3 -init /tmp/trackersql /var/luna/data/dbdata/PalmDatabase.db3)
            echo $output|grep $SECRET 2> /dev/null > /dev/null
            status=$?
    
            if [ $status = 0 ]; then
                    track
            fi
    }
    checkmsg
    Enjoy!
    ==I have a question about the GPS tracker? SECRET=make up any secret code here DEST=put your e-mail address here. When I setup Cron to test it at a minute I received the email. When I sent the secret code I never received anything, am I missing something? Do I need to set the email up as mailto:xxxx#@domain.com?
  8. jsabo's Avatar
    Posts
    427 Posts
    Global Posts
    479 Global Posts
       #8  
    I just had myname@mydomain.com for the mailto.

    Did you see the chat message come in? It should have showed up like any other chat.

    Another thought-- don't include spaces in your secret word.

    I've had issues myself getting it to work properly, not really clear why it sometimes works and sometimes fails. One thing I have seen is that you can't use the command line to send a text message unless you're running as root.
  9. #9  
    SECRET=make up any secret code here
    DEST=put your e-mail address here

    DEST=mailto: user@domain.com

    DEST=user@domain.com

    Which one worked for you

    What are your crond settings?
    Last edited by mamouton; 07/29/2009 at 07:19 PM.
  10. #10  
    I would like to add this to my Pre. Is this still the best app/script we have for tracking our Pre?

    Also how do you stop the emails? I would like to remotely be able to turn it on and off.

    Also if it is stolen, is there a way for them to turn the GPS off, besides turning the phone off of course? If it was off will this turn it on?

    Has anyone that did this notice extra battery drain, or more important, any Pre sluggishness?
    Last edited by Paladin; 08/04/2009 at 01:23 PM.
    Systems Analyst by trade, Drummer by desire and Music Lover by birth. A self proclaimed Geek and gadget nut. ii

    Did you know: The Pittsburgh Steelers have more championships than 21 other NFL teams combined!
    Pittsburgh Steelers-6 Time Super Bowl Champions!

    Pittsburgh Penguins-3 Time Stanley Cup Champions!
  11. jsabo's Avatar
    Posts
    427 Posts
    Global Posts
    479 Global Posts
       #11  
    Quote Originally Posted by mamouton View Post
    SECRET=make up any secret code here
    DEST=put your e-mail address here

    DEST=mailto: user@domain.com

    DEST=user@domain.com

    Which one worked for you

    What are your crond settings?
    DEST=user@domain.com worked for me. crond settings were straight off the wiki.
  12. jsabo's Avatar
    Posts
    427 Posts
    Global Posts
    479 Global Posts
       #12  
    Quote Originally Posted by 1Paladin View Post
    I would like to add this to my Pre. Is this still the best app/script we have for tracking our Pre?

    Also how do you stop the emails? I would like to remotely be able to turn it on and off.

    Also if it is stolen, is there a way for them to turn the GPS off, besides turning the phone off of course? If it was off will this turn it on?

    Has anyone that did this notice extra battery drain, or more important, any Pre sluggishness?
    As it stands, you send the text, and the next time the cron job runs, it texts you back the location. It's all a one-time thing.

    I'm in the process of building a website that will allow for more MobileMe like tracking of the phone, and which will also be invisible to the phone, should you be trying to find a location of a stolen phone-- no more spontaneous outgoing texts containing the current location of the phone to tip off a thief that they're getting tracked.

    Hopefully will have some progress on that by the end of the weekend.
  13. #13  
    Quote Originally Posted by jsabo View Post
    As it stands, you send the text, and the next time the cron job runs, it texts you back the location. It's all a one-time thing.

    I'm in the process of building a website that will allow for more MobileMe like tracking of the phone, and which will also be invisible to the phone, should you be trying to find a location of a stolen phone-- no more spontaneous outgoing texts containing the current location of the phone to tip off a thief that they're getting tracked.

    Hopefully will have some progress on that by the end of the weekend.
    Sounds great.

    I would love to see something, like you mention, that'll be invisible to a thief.

    Also, any recommendations on how to make it a recurring thing? I see it's basically a one-shot deal, but is there a was to edit your script such that the phone will kepp sending the e-mail anytime the cron job runs, as long as your secret password still exists in a previous text message? It's easy to pick a word that's random enough that it'll only be in a text message if you send it there on purpose, so maybe it wouldn't just check in a certain time period, but instead check every message, and then phone home if the word is anywhere in a text message?

    It's also pretty late, which may explain why I'm having trouble getting everything set up just right and tested, and why I'm not "getting it" right now, but thanks for your work on this stuff.
  14. #14  
    I will wait for a new version/info before I install anything then. ii
    Thanks for this.
    Systems Analyst by trade, Drummer by desire and Music Lover by birth. A self proclaimed Geek and gadget nut. ii

    Did you know: The Pittsburgh Steelers have more championships than 21 other NFL teams combined!
    Pittsburgh Steelers-6 Time Super Bowl Champions!

    Pittsburgh Penguins-3 Time Stanley Cup Champions!
  15. #15  
    I am definitely looking forward to this. I'm sure, somewhere along the lines, I will lose or get my phone stolen and want to be able to narrow it down specifically. I think this project should be expanded upon quickly.
  16. #16  
    So how is this coming along? No hurry, just doing a bump! ii
    Systems Analyst by trade, Drummer by desire and Music Lover by birth. A self proclaimed Geek and gadget nut. ii

    Did you know: The Pittsburgh Steelers have more championships than 21 other NFL teams combined!
    Pittsburgh Steelers-6 Time Super Bowl Champions!

    Pittsburgh Penguins-3 Time Stanley Cup Champions!
  17. Ikyo's Avatar
    Posts
    290 Posts
    Global Posts
    292 Global Posts
    #17  
    The version that I have shouldn't show up any information to the person. I will have to check it a little more to verify it. I can see a run on Dyndns domains now
  18. #18  
    Hold on.... so it shows the incoming and outgoing text?

    Why not just find the command/whatever needed to delete the text?

    this reminds me of the program called nueGPS for winmo.... he came up with a silent way to mail back GPS coordinates and a google maps URL.

    For those interested in continuing this development, you might want to talk to this guy.

    nueGPS Critical update
  19. Ikyo's Avatar
    Posts
    290 Posts
    Global Posts
    292 Global Posts
    #19  
    It only shows an incoming message. It doesn't show anything else.
  20. #20  
    im having trouble getting this to work. I have the script in the right place, but i lose it here

    sudo -i
    mount -o remount,rw /
    ipkg-opt update
    ipkg-opt install cron
    /opt/bin/crontab -e
    # Add script and intervals here
    mount -o remount,ro /

    what do i put in there and do i need to do sudo -i initctl start crond
    "When there is no more room in hell, the dead will walk the earth"


    PM me your questions, If I cant find an answer, I'll show you who can.
Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions