Introduction: Security Photo Emailer - Login Activated

About: I am 16 and have been interested in electronics and programming since age 11 when I built my first robot - The BeetleBot - since then I have graduated to arduino. I also like to hardware hack a bit.

This is a collection of some scripts that when put together will email you with a photo of who logged on to your computer.

This project can be a little tricky if you do not have much experience dealing with code/scripts. If you are having issues with people accessing your computer without your permission you can now catch them in the act!

You will need a computer with a webcam and internet access for this project. For any of the pictures, if you cannot see them fully, simply click the "I" in the bottom corner of the picture.

This is my first Instructable, constructive criticism is appreciated.

Step 1: Ingredients

There are a few programs that will make your life a whole lot easier when you are making this. The first is Notepad++. It is a free application you can get it here - http://notepad-plus-plus.org/

Notepad++ will enable you to edit these files with ease. It is very powerful and can also be used for general text editing.

The RAR Package *You will need Winrar to extract this. If you don't already have it you can get it here (32-bit)(64-bit)
This RAR includes Email.vbs (the core or the email sending part - adapted from here ); Snapz.exe (from here) ; and Send.bat which ties all both of the previous together.

NONE of these are viruses, if your scanner tells you otherwise then it is a false positive.

Step 2: Initial Setup

Using Winrar, extract the files into a folder. Make sure that all of the files are in the same folder. For ease, I recommend that you put this folder on the root of your hard drive.

Step 3: Replacing Examples in Email.vbs

In this step you will replace the example info in the Email.vbs with you own info.

First, open up Email.vbs with Notepad++ You can right-click and choose "Edit with Notepad++".
Once you are in, you should see a bunch of code.

To start, change youremail@domain.com to whatever your email address is. Change password to your email password.

Change the "smtp server goes here" to whatever your email provider's SMTP server is. Change smtp server port # to whatever your email provider's SMTP server port is.

Common Email Providers
Gmail - smtp.gmail.com Port - 465
Hotmail - smtp.live.com Port - 587
Yahoo - smtp.mail.yahoo.com Port - 995
POP Yahoo - plus.smtp.mail.yahoo.com Port - 465
MSN - smtp.email.msn.com Port - 110?
AOL - smtp.aol.com Port - ?

For Hotmail, Yahoo, MSN, and AOL you can change the "smtpauthenticate") = 1" to "smtpauthenticate") = 0" experiment; I only used Gmail so some of these may not be correct.

Step 4: Snapz Setup

To test if snapz is running correctly, simply run snapz.exe This was one of the files that was extracted in the initial setup. It should run and in the same folder as the .exe there should be a file called snapz.dib with a picture taken from your webcam on it. If there is, then snapz is running correctly.

Step 5: Editing Send.bat

In this step, you will select your target email, subject, message, and directory of your snapz file. Send.bat ties snapz and the Email.vbs file together. It takes a picture using snapz, sets the target email address, subject, and message, attaches the picture and sends the email.

Once again, use Notepad++ to open up Send.bat. Replace TargetAdress@domain.com with the address that you want to send the picture to.

Replace "Subject goes here" with your subject. I used "User logged on". Replace "Message goes here." with whatever you want your message to be. I used "User logged on to %username% at %time%". The %username% is replaced by the system to the current user logged on and the %time% is replaced with the current time.

Finally, navigate to wherever you have placed your snapz.exe and copy the directory. Replace "C:\directory\snapz.dib" with your own directory. Remember to include the snapz.dib in your directory, otherwise it won't be able to locate the webcam picture.

Step 6: Running on Login

To get Send.bat to run on login you simply have to put it in the "Startup" folder. If you are on Windows 7, simply navigate to your start menu, click "All Programs", scroll down to "Startup", right-click on "Startup", select "Open", and use the right mouse button to drag the Send.bat into "Startup". A list of options should pop up. Select "Create shortcuts here".

If done correctly, when you log into your account your webcam should take a picture and fire off an email to a specified address with a specified subject and body, with the picture attached.

Step 7: Making It Invisible

When you log in, you will be greeted with a command prompt box which clearly say "Sending Email" and "Taking Picture". If you want this to be a little more discreet, you can alter what it says in the Send.bat file. Also, you can get it to start minimized. To do this, all you have to do is right-click on the shortcut, select "Properties", under the "Shortcut" tab click on the dropdown menu labelled "Run:" and select "Minimized". When you log in, the command window will be minimized and hardly noticeable as quite often there are command prompt windows which appear on login. The window should close once the email has been sent and will hardly leave a trace

Step 8: Fin

I hope that you have enjoyed this instructable and I am looking forwards to making more and to reading your comments/questions/concerns. I am happy to accept constructive criticism and encourage it! So there it is, a login-activated photo taking email sender using only three scripts! Have fun!