create a plist file to run this script from start up using lingon.
if it's not you sat in front of the screen it takes a piccy, a screenshot and if connected to tinternet, your IP, then ftps to a server. it then checks if dropbox is running and if not, starts it.
It mutes the volume when screen grabbing so you can't here the click - although the green light does come on briefly.
Happy if someone who knows what they are doing picks holes in it as this is more n exercise in technical than anything else. For some reason Dropbox doesn't seem to sync when started this way.
Code:
#!/bin/bash myuser="pondy" mydir=/Users/$myuser/Dropbox/stolen myarc=/Users/$myuser/Documents/archive mydate=$(date +"%d-%b-%y-%H-%M") # Find out console User localuser=`who | grep console` consoleusr=${localuser%% *} if [[ -n $consoleusr ]] then echo $consoleusr-is-here if [[ $consoleusr != $myuser ]] then echo "User not $myuser" # Mute, take snapshot and screengrap then put vol back curvol=`osascript -e "output volume of (get volume settings)"` osascript -e "set volume output volume 0" /Users/$myuser/Dropbox/Imagesnap/imagesnap $mydir/$mydate.img.jpg Screencapture -S $mydir/$mydate.scrn.jpg osascript -e "set volume output volume $curvol" # Check for WAN connection myip=`curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.\.]*\).*/\1/g'` echo "checking IP" if [ $myip ] # Write external IP add then echo $myip-at-$mydate-by-$consoleusr+$dropcheck >> $mydir/myip.txt echo $myip #ftp files to home su $myuser -c "/Users/$myuser/scripts/mysftp.sh $mydir" mv $mydir/*.jpg $myarc/ # Check if Dropbox is running dropcheck=`ps -A | grep Dropbox.app` grepdropcheck=`echo $dropcheck | grep MacOS` # Start Dropb box if not running if [[ $grepdropcheck ]] then echo "Dropbox is running" else echo "No dropbox found... Starting Dropbox..." su $myuser -c "/Applications/Dropbox.app/Contents/MacOS/Dropbox &" fi else echo "no ip" echo NoIP-at-$mydate-by+$consoleusr >> $mydir/myip.txt fi fi else echo "Noone at console" fi
Leave a comment: