#!/bin/bash # Must customize the URL below to the location of your PHP script. PHONE_HOME_URL=http://www.example.com/laptop/911/ VERSION=1.0 USER_AGENT="Laptop Theft Protector/$VERSION" ANTITHEFT_HOME=./ LOG=$ANTITHEFT_HOME/antitheft.log REPLY_LOG=$ANTITHEFT_HOME/reply.log SCREENSHOT=$ANTITHEFT_HOME/screenshot.png # First request, ask server if we are stolen. curl --user-agent "$USER_AGENT" --output $REPLY_LOG $PHONE_HOME_URL # If server sent us a reply, yes, we're stolen. Otherwise server will stay quiet. if [ -f $REPLY_LOG ]; then rm $REPLY_LOG echo "Info from Stolen Laptop: `date \"+%Y-%m-%d %H:%M:%S\"`" > $LOG; echo "Hostname: `hostname`" >> $LOG; echo "" >> $LOG; echo "Network Configuration:" >> $LOG; ifconfig >> $LOG 2>&1; echo "" >> $LOG; echo "Traceroute to Google:" >> $LOG; traceroute "www.google.com" >> $LOG 2>&1 # First request without a screenshot, in case bandwidth is low. curl \ --user-agent "$USER_AGENT" \ --output $REPLY_LOG \ --form "date=`date +%Y%m%d-%H%M%S`" \ --form "log=@$LOG" \ $PHONE_HOME_URL screencapture -Cx $SCREENSHOT # Second request includes both, network log and screenshot. curl \ --user-agent "$USER_AGENT" \ --output $REPLY_LOG \ --form "date=`date +%Y%m%d-%H%M%S`" \ --form "log=@$LOG" \ --form "screenshot=@$SCREENSHOT" \ $PHONE_HOME_URL #Cleanup temp files, keep archives if enabled above. rm $LOG; rm $REPLY_LOG; rm $SCREENSHOT; fi