Tuesday, April 2, 2013

HowTo: Get a SMS notification when someone logged into your computer


   Our goal is to get a SMS notification when a user logged into a windows machine. There is no direct service/software to achieve this. But Windows is providing a service to get E-mail notification when a task is performed. So we are using the same service to get an E-mail notification when a user logged into the system, and then forwarding the mail to our mobile as SMS.






To follow this post, you need a Windows7 computer with active internet connection, Two Gmail accounts, sendSMTP software, and of course a mobile.

1) Get E-mail notification when user logged into the system:

To get E-mail notifications we are using the windows Task Scheduler and SendSMTP programs. 
First download SendSMTP program from here. Extract the zip file to C: drive.

Now open the task scheduler program from start menu or just type “taskschd.msc” in Run box. 
Right click on the “Task Scheduler (Local)” and select “Create Task”.



In general tab Type a name and description for the task, and select “Run with highest privileges” check box.



In Triggers tab select “new”, select “at log on” in “Begin the task” drop down menu. Select “any user” radio button, and press ok.



In “Actions” tab select new button, select “Start a program”.  Now Select browse and choose the SendSMTP.exe file which we extracted in C: drive.



Type the following details in “Add arguments (optional)” box. It is saying optional but this is the important task in this segment.

/host smtp.gmail.com /auth 2 /userid sender_ID@gmail.com /pass password /from sender_ID@gmail.com /to receiver_ID@gmail.com /subject "Someone Just Logged Into your Computer!" /body "this mail is to inform you that a sever login deteced"

Just replace sender details and receiver details in the above text and paste it in the add arguments box. that means replace the "sender_ID@gmail.com" and "password" with sender id details, and the "receiver_ID@gmail.com" with receiver's email address.


Details of the above arguments:
/host - the SMTP host address, here we are using Gmail’s SMTP server.
/auth - this authentication method, the 2 indicates the SSL authentication.
/userid - user name used to authenticate the SMTP server.
/pass – password for the above user account
/from – the sender mail ID
/to – the receiver mail ID
/subject – the subject of the mail
/body – the body of the mail

In “Conditions” tab uncheck the option “Start the task only if the computer is on AC power”
With this the task creation completed.

Now logoff the computer and login again, and check the receiver’s mail for the alert mail. You should receive a mail immediately after login.

2)  Creating SMS alerts

OK, we are successfully receiving the E-mails to the receivers E-mail ID, now we have to forward the mail to Mobile. There are several ways to do this. Previously we have shown you how to get E-mail alerts using way2sms. We can also add a “SMS Gateway” as forwarding address to receive alerts.

But in this case we need a trusted service which can send SMS immediately after receiving the mail. So we are using Google Apps script to receive the SMS notifications.

From now on all the credit goes to Romain Vialard, and I just followed his original article.

Register your mobile number in Google Calender:

Following all the configuraion has to be done using receiver's Gmail account only.

First log into calendar.google.com.  Click on gears icon and select settings then mobile setup.
Select your country, and give your mobile number there. Click on “send verification code”.
Then you will receive a code to your mobile, give it there and select ‘finish setup’. Finally save the settings.

Automatic labeling every mail we received from sendSMTP:

Go to Gmail, click on gears icon in the above right corner and select settings.
In “Labels” tab, select “Create new label” and type “Sms Alert”.
Select “filters” tab, and select “Create a new filter”, type “Someone Just Logged Into your Computer!” in subject box. Then click on “Create filter with this search”. 
 
Now check the “apply the label” and select “Sms alert” from the menu. Finally click on the “Create filter”


The Final Step:

Click here to copy the Spreadsheet which contains the Google apps Script into your Google drive. And click ‘Yes, make a copy’.

Select tools --> 'Script Editor' and then select 'Resources' --> Current Project Triggers.
Click on ‘No triggers set up. Click here to add one now.’  Do the settings as shown below. And click on save.



Now click on “Authorize” in “Authorization required” box. And select “Grant Access”. Save the trigger.

OK, from now the trigger will monitor your mails for any new mails with the label ‘SmsAlert’ every minute. If it has found any new mails, it will send you a sms.





12 comments:

  1. It is really good! Step by step procedure! I would like to share it more. emergency notification

    ReplyDelete
    Replies
    1. Hi Mr. Steve Paul,
      i did everything above given, but i am not getting email, can u help me?

      Delete
  2. hello there , i didnt understand this step...


    Type the following details in “Add arguments (optional)” box. It is saying optional but this is the important task in this segment.

    /host smtp.gmail.com /auth 2 /userid sender_ID@gmail.com /pass password /from sender_ID@gmail.com /to receiver_ID@gmail.com /subject "Someone Just Logged Into your Computer!" /body "this mail is to inform you that a sever login deteced"

    ReplyDelete
    Replies
    1. yes.. i too didnt undrstnd dis step... i did everythng abov, but i am not receiving email.

      Delete
    2. /host smtp.gmail.com /auth 2 /userid sender_ID@gmail.com /pass password /from sender_ID@gmail.com /to receiver_ID@gmail.com /subject "Someone Just Logged Into your Computer!" /body "this mail is to inform you that a sever login deteced"

      In the above text replace "sender_ID@gmail.com" with your Gmail ID, and "password" with the password of the same Gmail account. then replace the "receiver_ID@gmail.com" with the Gmail ID, to which account you want to receive alerts. then copy the total paragraph into add arguments box.

      Delete
    3. Yes Satish,
      i did it & checked the same again,
      but still i am not receiving email....... can you please connect TeamViewer & check the issue at my end

      Delete
    4. Finally u receiving email

      manishcontiloefilms@gmail.com

      Delete
  3. Amazing blog! Do you have any tips for aspiring writers?
    I'm hoping to start my own blog soon but I'm a little lost on everything.
    Would you propose starting with a free platform like Wordpress or go for a paid
    option? There are so many choices out there that I'm completely confused ..
    Any suggestions? Bless you!

    Look at my webpage: search engine optimisation;
    escholcreations.com,

    ReplyDelete
  4. This design is wicked! You most certainly know how
    to keep a reader entertained. Between your wit and
    your videos, I was almost moved to start my own blog (well,
    almost...HaHa!) Excellent job. I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

    Also visit my website :: la enciclopedia equina libre

    ReplyDelete
  5. Thanks for sharing as it is an excellent post would love to read your future post
    sms service

    ReplyDelete