[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stolen laptop



On Sun, Jun 22, 2003 at 06:45:31PM -0400, Joseph Barillari wrote:
>
>I could envision a program that sends information about its local
>network to a predetermined location every time it connects to the
>network. A more elaborate solution might involve hacking a DHCP client
>(and a network stack) into Grub or Lilo so that the program could be
>run as soon as the laptop was switched on.

I've been using the following for a while, which does just what you
suggested. Run it out of /etc/ppp/ip-up.d and /etc/cron.daily and
redirect the output to mail. This approach does need mail to work,
which is another problem entirely. If you're on a foreign network or
whatever, then mail may be awkward. I've set up the mail system on my
laptop to batch things and send via home over ssh when available,
which probably has a good chance of working in most places.

======================================================================
#!/bin/sh
#
# laptop-location
#
# Try to work out where we are, and tell the world. Hopefully will
# never be needed, but may help if somebody ever steals me...
#
# (c) 2003 Steve McIntyre <steve@einval.com>
# Redistributable under GNU GPL v2 or higher

IFACES="eth0 eth1"
ROUTES="www.example.com www.debian.org"

ip_from_if ()
{
    ifconfig $1 2>/dev/null | grep "inet addr:" | sed
    's?.*.addr:??g;s? .*$??g'
}

# Let's grab our network config, and look up names for whatever
# addresses we've been given
for IFACE in $IFACES
do
    IP=`ip_from_if $IFACE`
    if [ "$IP"x != ""x ] ; then
        echo "$IFACE has an address $IP, details:"
        host $IP
    fi
done

# And try to see where we are - let's work out the beginnings of the
# routes home
echo Routes home:
for ROUTE in $ROUTES
do
    echo
    echo "Here to $ROUTE:"
    traceroute -m 5 $ROUTE
done
======================================================================

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
<a href=http://www.einval.com/steve/>My home page</a>
"Can't keep my eyes from the circling sky,
"Tongue-tied & twisted, Just an earth-bound misfit, I..."

Attachment: pgpkTbpUCTbAP.pgp
Description: PGP signature


Reply to: