#!/bin/bash

# Dropbox "what happened to my stolen computer" script
# Written by Colin Deady 16/09/2008
#            support@ethicalwebsites.com (feel free to email with comments / questions)
#
# This script is designed to be run periodically by cron - on a Mac try the excellent CronniX to schedule it.
# www.abstracture.de/projects-en/cronnix
# It will write several useful files to your Dropbox ( www.getdropbox.com ) which will then be mirrored across
# all your Dropboxes and can be accessed online. This /may/ (or may not!) be useful if one of your computers
# gets stolen.
#
# IMPORTANT: THIS SCRIPT NEED EXECUTE PERMISSIONS TO RUN. At a terminal enter: chmod +x drop_off_my_details.sh
#
# v0.2
#
# CHANGES:
# v0.1 - 16/09/2008 initial release 
# v0.2 - 24/02/2010 corrected minor bug in the dropboxOutput line (needs trailing /)
#
# Released under a "do ANYTHING you want with it" license, ie: releasing to the public domain.
#
# DISCLAIMER: THIS SCRIPT IS SUPPLIED AS-IS WITHOUT ANY WANRRANTY EXPRESS OR IMPLIED. IR MAY NOT WORK.
#             IT MAY NOT HELP YOU GET BACK YOUR LOST / STOLEN COMPUTER. IT MAY BE USELESS.
#             DO NOT USE THIS UNLESS YOU ACCEPT ALL RESPONSIBILITY AND FULLY ABSOLVE Colin Deady FROM ANY CLAIMS AND LIABILITY.
#             YOU USE THIS SCRIPT ENTIRELY AT YOUR OWN RISK AND IN FULL KNOWLEDGE AND ACCEPTANCE OF THE ABOVE.

# define the directory  you want to write your output to
# IMPORTANT: set "thiscomputername" to be unique for each computer, and make sure that the folder exists on your Mac / Linux box.
dropboxOutput="/path/to/my/Dropbox/mycomputers/thiscomputername/"

# what IP and MAC address details can we see?
ifconfig > "${dropboxOutput}ifconfig.txt"

# let us try tracing a route to Google (may show up which ISP is in use and other interesting details... or not)
traceroute www.google.com > "${dropboxOutput}traceroute.txt"

# more IP details than we can shake a stick at
netstat -rn > "${dropboxOutput}netstat.txt"

# oh and let us go get our public IP address (NB: we are using the automation page on whatismyip.com to reduce bandwidth load)
curl -o "${dropboxOutput}mypublicip.txt" http://www.whatismyip.com/automation/n09230945.asp

# and the current system date and time (useful to match with a dynamic IP address)
date > "${dropboxOutput}dts.txt" # includes the timezone too

# any other commands you want to include - add them below...
uname -a > "${dropboxOutput}uname.txt" # eg the full uname output (which will include system name, date and time etc)
who am i > "${dropboxOutput}whoami.txt" # who are you?






