Kamis, 04 September 2008

phone Home Anti Robber Mac Security Script ( final steps)

Final Steps

The final steps are simple. First open up Terminal and use the cd command to change the directory to where you script is located. In Terminal type the following:

chmod +x scriptname.sh

This will allow the script to be executed in Terminal. For some reason the execute command doesn’t transfer when I zip it up and put it on my server.

The next step is to check to make sure it works. Very important. Type the following:

/path/to/script/scriptname.sh

This script assumes that you have everything in place, such as a web file. If the file on your server is not 1 then your log file should say “Passed”. Check it again by re-running the script with the server file containing the number 1. It should zip up all of the information and send it to your email. If all works the log file should say “Fail” and you should receive an email. If it doesn’t somewhere along the line something has gotten mixed up. Check Terminal to see what the error is and to see if you can fix it.

The very final step is to add it to cron. In terminal once again type:

crontab -e

Press “a” to go into insert mode. Then type the following:

*/5 * * * * /path/to/script/scriptname.sh

Then press escape and type the following without quotes: “wq!”. This will set up your crontab. Every 5 minutes it will check your server to see if anything has changed and run the script. As asked by whatismyip, you should not run the script more frequently than that, so you don’t pound their server.  This is so you don’t put to much load on there server asking for your IP address.

If all goes to plan you should be informed by your email address that the thief has been located, it should also send the images along. This script does rely on a couple of things. It is by no means perfect. For example it needs the Internet to work. If you don’t have the Internet then the script will not work. As well as this it also needs a server to check. In tomorrow’s post I will talk about how you can run commands by receiving an email. This means you don’t need to have a webserver.

Tidak ada komentar: