Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    have stolen nokia "call home" with its ip address

    Reply
    Page 5 of 7 | Prev |   3     4   5   6     7   | Next
    Texrat | # 41 | 2008-07-17, 03:15 | Report

    This is an incredibly potentially useful idea! Nice.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    dannemil | # 42 | 2008-07-19, 01:08 | Report

    Originally Posted by Texrat View Post
    This is an incredibly potentially useful idea! Nice.
    Thanks. I am close to having a version that also includes the gps location of the nokia. It will turn on the gps at boot and wait until the gps gets a valid fix or until some period of time has passed, then call home the ip address info as well as the latitude and longitude. You could then use google earth to narrow down the location of the nokia.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    dannemil | # 43 | 2008-07-23, 21:36 | Report

    I have taken the suggestions offered earlier and incorporated them in this version of the call home script. In particular

    1. The gpsd daemon is launched for 8 minutes to try for a fix, and if a fix is obtained, the gps coordinates are written to the file that is sent home. You can change the variable that determines how long it tries for a fix :-( If you get coordinates, you can paste them into Google Earth to get some idea of where your nokia tablet is.

    2. The script is now located in /etc/init.d/network/ instead of in a crond directory, so as soon as the network connection is made, the gpsd daemon is launched, and gps/ip information is sent home using secure copy <scp>in the file .locate-nokia once per session.

    3. If a gps fix is not obtained, then the last known gps coordinates are sent.

    4. I am not a programmer so this code could really use some help and improvement ( for open source)

    Copy the script below into /etc/network/if-up.d/ and chmod 577 the file. If all works as intended, then about 8 minutes after you make a network connection, you should find the file sent to your "home" computer.

    [EDITED: I later attached the text file version of the script instead of having to copy and paste the inline version. Just remove the .txt when you cp the script to /etc/network/if-up.d/]

    ################################################## #######################
    #
    # (July 23, 2008): adapted from the laptop
    # script to call home at http://snippets.dzone.com/posts/show/3693
    #
    # Script to have Nokia internet tablet "call home" with its
    # current ip address and gps coordinates if available.
    #
    # "Calling home" means securely copying a file with gps/ip info
    # to a computer set up to receive this file.
    #
    #
    #======= Notes:============================================ ==============
    #
    # 1) the version of awk on the N810 does not do exponention
    # (e.g. 10^2) so I had to jump through hoops in awk to implement
    # a piece of code that called for exponents
    #
    # 2) This version of the program starts the gpsd daemon and runs
    # it for 8 minutes to try for a fix. If it gets a fix, it includes
    # the gps coordinates in the file that is sent home. If it doesn't
    # get a fix then it sends the most recent coordinates.
    # You can change this value by changing the variable $gps_on_time
    # below. The running gps data are stored in the file
    # /home/user/gps.log. This file consists of NMEA sentences.
    # The GPGGA sentences have the latitude, longitude and whether a
    # valid fix was obtained.
    #
    # 3) Assumes that you have a standard install with your home
    # directory at /home/user. If not, then change the home directory
    # in the variable called $base
    #
    # 4) The first time it is launched, it will create the file
    # /home/user/.last_known as an empty file. If it ever gets a gps
    # fix, it will store the current gps coordinates in that file.
    #
    # 5) Put this script <call_home> in /etc/network/if-up.d/<call_home>
    # without the <> brackets, gainroot and chmod 755 the file.
    # Whenever the network comes up, the script will execute and send
    # the information home after it has tried for a gps fix. Because it
    # is squirreled away in this somewhat obscure 3-deep
    # directory, I left the name as call_home. If you are particularly
    # paranoid, you could rename it something else that would not give
    # away its purpose.
    #
    # 6) The "hidden" file that is sent home is called .locate-nokia.
    # This is written locally to your home directory, usually /user/home
    #
    # 7) There are several variables that you have to define in the ip/system
    # section of the script below


    #====== set user's home directory; usually /home/user

    base="/home/user/"

    #====== set period gps tries for fix

    gps_on_time="480" #seconds

    #====== last known gps coordinates are always written to /home/user/.last_known
    #====== check for file's existence; if it exists, leave it alone
    #====== if not then create an empty file

    if [ -f $base".last_known" ];
    then
    touch -c $base".last_known"
    else
    touch $base".last_known"

    fi
    #====== first remove the previous gps.log data

    rm -f $base"gps.log"

    #====== start the gpsd daemon, run it for $gps_on_time, then kill it

    su user -c /usr/libexec/navicore-gpsd-helper >> $base"gps.log" & sleep $gps_on_time && kill "$(pidof /usr/sbin/gpsd)"

    #====== determine whether a valid fix was obtained

    fix_state=$(tail -13 $base"gps.log" | grep GPGGA | awk -F',' '{print $7}')


    if [ $fix_state -eq "1" ]; then

    temp=$(date)

    #====== write date and time to .last_known

    awk -v varx="$temp" 'BEGIN {print "Date of last gps fix: " varx}' > $base".last_known"

    #====== extract the raw latitude and longitude from the NMEA sentences in /home/user/gps.log

    raw_lat=$(tail -13 $base"gps.log" | grep GPGGA | awk -F',' '{print $3}')
    lat_dir=$(tail -13 $base"gps.log" | grep GPGGA | awk -F',' '{print $4}')
    raw_long=$(tail -13 $base"gps.log" | grep GPGGA | awk -F',' '{print $5}')
    long_dir=$(tail -13 $base"gps.log" | grep GPGGA | awk -F',' '{print $6}')

    #====== The raw latitude and longitude are not very human readable,
    #====== so reformat them into deg, min and secs
    #====== this is where this implementation of awk lacks exponentiation,
    #====== so a tortuous awk workaround was devised (see the for loop)
    #====== for doing what should have been 10^(-n) as a series of repeated
    #====== divisions by 10

    latitude=$(awk -v var1="$raw_lat" -v var2="$lat_dir" 'BEGIN { split(var1,a,"."); b=length(a[1]); if (b==4) ls=2; else ls=3; n=1; for (i=1; i<=length(a[2]); i++) {n=n/10}; print (substr(a[1],1,ls)" deg " substr(a[1],(ls+1),2)" min "a[2]*n*60 " sec " var2 )}')

    longitude=$(awk -v var3="$raw_long" -v var4="$long_dir" 'BEGIN { split(var3,a,"."); b=length(a[1]); if (b==4) ls=2; else ls=3; n=1; for (i=1; i<=length(a[2]); i++) {n=n/10}; print (substr(a[1],1,ls)" deg " substr(a[1],(ls+1),2)" min "a[2]*n*60 " sec " var4 )}')

    #====== now that latitude and longitude are in human readable form,
    #====== write them to .locate-nokia

    echo $latitude >> $base".last_known"
    echo $longitude >> $base".last_known"
    echo $latitude | awk '{print $1" "$3" "$5" "$7" <---paste this into GoogleEarth/My Places/Add/Placemark/Latitude"}' >> $base".last_known"
    echo $longitude | awk '{print $1" "$3" "$5" "$7" <---paste this into GoogleEarth/My Places/Add/Placemark/Longitude"}' >> $base".last_known"

    else

    #====== If no fix was obtained, just log that fact with the date to the
    #====== /home/user/.fix-failed.log file
    #====== Aside: the gps on the NIT is so crappy that it will almost always fail,
    #====== but on the odd occasion when then tablet is turned on outside or near an
    #====== open window it might get a fix in 8 minutes

    date > $base".fix-failed.log"
    echo "fix failed, no gps" >> $base".fix-failed.log"


    fi

    #====== filename to be written to remote location

    rfile=".locate-nokia"

    #====== remove previous version of file

    rm -f $base$rfile

    #====== create the file by redirecting date to it; write
    #====== current date and time to file to be sent home

    date > $base$rfile

    #====== write last known gps coordinates

    cat $base".last_known" >> $base$rfile

    #================================================= ========================
    #====== Next check for and run the ip/system related commands ============
    #====== These commands gather info to be sent home =======================
    #====== YOU HAVE TO DEFINE SOME VARIABLES FOR THIS TO WORK ===============
    #====== Leave quotes " " but remove angle brackets <> ====================

    static_ip="<put ip address near you for traceroute>"
    private_key="<name of your private key for ssh to remote location where file is sent>"
    username="<username for scp command>"
    remote_ip="<ip address to receive the scp file>"





    #================================================= ========================

    #
    #====== basic command : command used
    #====== case[0] who : who >> $base$rfile
    #====== case[1] wget : ipnameit=$(wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
    #====== case[2] whois : /usr/local/bin/whois $ipnameit 2>&1 >> $base$rfile
    #====== case[3] ifconfig : /sbin/ifconfig -a 2>&1 >> $base$rfile
    #====== case[4] traceroute : /usr/sbin/traceroute $static_ip 2>&1 | head -15 >> $base$rfile
    #====== case[5] scp : scp -q -i $base.ssh/$private_key $base$rfile $username@$remote_ip:~
    #
    #====== only run the command if the path exists on the user's nokia

    for program in who wget whois ifconfig traceroute scp

    do

    prog_path=$(which $program)


    if [ "$prog_path" = "" ];

    then
    echo "program not found" > /dev/null

    else
    case $program in

    who) $prog_path >> $base$rfile;;

    wget) ipnameit=$($prog_path -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//')

    if [ $ipnameit!="" ];

    then

    echo "My IP address is $ipnameit" >> $base$rfile

    else

    echo "IP address not available" >> $base$rfile

    fi;;

    whois) if [ -n "$ipnameit" ];

    then

    $prog_path $ipnameit 2>&1 >> $base$rfile

    else

    $prog_path "no ip address" 2>&1 >> $base$rfile

    fi;;

    ifconfig) $prog_path -a 2>&1 >> $base$rfile;;

    traceroute) $prog_path $static_ip 2>&1 | head -15 >> $base$rfile;;

    scp) $prog_path -q -i $base.ssh/$private_key $base$rfile $username@$remote_ip:~;;

    esac



    fi

    done



    #====== I hope you never have to use it...

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Files
    File Type: txt call_home.txt (8.0 KB, 110 views)

    Last edited by dannemil; 2008-07-23 at 21:58. Reason: need to attach file
    The Following 2 Users Say Thank You to dannemil For This Useful Post:
    Alan_Peery, Naranek

     
    Benson | # 44 | 2008-07-23, 21:46 | Report

    Code tags and/or attached file? I'm not sure this one would, but often scripts posted inline like this get mangled, and it's a pain to try to debug...

    Edit | Forward | Quote | Quick Reply | Thanks

     
    dannemil | # 45 | 2008-07-23, 21:53 | Report

    Originally Posted by Benson View Post
    Code tags and/or attached file? I'm not sure this one would, but often scripts posted inline like this get mangled, and it's a pain to try to debug...
    Sorry, if it gets mangled. I wasn't sure attached files were allowed. I could certainly repost it as an attachment.

    Ah, now I see that attachments are allowed, so I'll repost the script as an attachment.

    Here it is again as an attachment. Just remove the .txt before using it.

    Edit | Forward | Quote | Quick Reply | Thanks
    Attached Files
    File Type: txt call_home.txt (8.0 KB, 125 views)

    Last edited by dannemil; 2008-07-23 at 22:01. Reason: misspelled words

     
    gemniii42 | # 46 | 2008-07-24, 06:24 | Report

    Some decent thoughts here but I think it's mostly an unworkable problem.
    What type of thieves/losses do you expect:
    1. Theft of opportunity as a single item - left on a car seat looks like a GPS.
    2. Theft of opportunity because it was it was with other luggage.
    3. Calculated theft - someone smart enough to know what it is and want it
    4. Loss - whoops I left it on the bus/somewhere.

    The lojack/call home concept is good but overkill for what is now a $300 device NEW.
    I've only been on this forum for about a year and can only remember about two threads of #1, one of #2, zero of #3 and two of #4.

    Perhaps one of the best things would be an easily searchable database here of all "stolen" IT's MAC addresses so when one turns up we could search the list. Also post stolen ones to Craigs list comments.

    Add that to a log in screen offering a reward and we could probably cover 95% of the cases.

    In any circumstance, keep a good backup.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    konttori | # 47 | 2008-07-24, 07:21 | Report

    Very cool script indeed. Kudos.

    If we wanted, SSU could be made to report an identifying number of the device to the Nokia servers (e.g. wlan id). And Nokia servers would be able to store and check that against stolen devices ids and then report the ip addresses. But at least I would feel sending the wlan ids as a privacy issue.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Khertan | # 48 | 2008-07-24, 11:49 | Report

    Konttory ... you already send the wlan mac adress when you download a new firmware

    Edit | Forward | Quote | Quick Reply | Thanks

     
    dannemil | # 49 | 2008-07-24, 12:04 | Report

    Originally Posted by gemniii42 View Post
    Some decent thoughts here but I think it's mostly an unworkable problem.
    What type of thieves/losses do you expect:
    1. Theft of opportunity as a single item - left on a car seat looks like a GPS.
    2. Theft of opportunity because it was it was with other luggage.
    3. Calculated theft - someone smart enough to know what it is and want it
    4. Loss - whoops I left it on the bus/somewhere.

    The lojack/call home concept is good but overkill for what is now a $300 device NEW.
    I've only been on this forum for about a year and can only remember about two threads of #1, one of #2, zero of #3 and two of #4.

    Perhaps one of the best things would be an easily searchable database here of all "stolen" IT's MAC addresses so when one turns up we could search the list. Also post stolen ones to Craigs list comments.

    Add that to a log in screen offering a reward and we could probably cover 95% of the cases.

    In any circumstance, keep a good backup.
    Why not try all of these? The more information there is about its whereabouts, the better. A simple login screen as you say would go a long way toward at least deterring the the person who ends up with your Nokia from "easily" gaining access to any information that you have on there.

    I think the MAC address database is an interesting one, but it has some privacy issues involved if every time I make a network connection my ip address shows up on someone else's server (it's different if it shows up on MY server).

    As far as it being relatively cheap, I agree that it's not like when your laptop gets stolen, but hey, even cheap cell phones have mechanisms to "lock" them down when they get stolen mostly as a deterrent to losing the information on the phone.

    At any rate, all good ideas for at least making an attempt to retrieve the device if it ever gets lifted.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    gemniii42 | # 50 | 2008-07-24, 13:58 | Report

    Originally Posted by dannemil View Post
    <snip>

    As far as it being relatively cheap, I agree that it's not like when your laptop gets stolen, but hey, even cheap cell phones have mechanisms to "lock" them down when they get stolen mostly as a deterrent to losing the information on the phone.

    At any rate, all good ideas for at least making an attempt to retrieve the device if it ever gets lifted.
    Yeh, I forgot to mention, as posted in another thread, the machine should be wiped as soon as it's determined to be stolen (3 wrong password or something).

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Page 5 of 7 | Prev |   3     4   5   6     7   | Next
vBulletin® Version 3.8.8
Normal Logout