Whereabouts are you?

If you’re one of the people who are using my uni pinging script you may have noticed that it has sped up slightly, this is because it has now been partially parallelised (it sends out a maximum of 10 pings to 10 different hosts every couple of seconds)!

Another feature I’ve been wanting to implement has been the ability to find out which computers your friends are currently at, so you can meet up with them, find what lab they are in or whatever, I’ve now written a little script which users can opt in to which notifies the server whenever you log into a machine.
This seems like a simple concept, however, I wanted setup and use to be as simple as possible (thus increasing the complexity), while maintaining a secure protocol (basically make it difficult for someone else to say that another user is logged in at machine ‘x’), I thought I’d do a quick write up of how it works. All in all, it functions well for a few hours work!

Essentially the script is broken down into three parts, the user registration and installation component – I wanted this to be a simple as executing a program, the notifier; the script which notifies the server that you have logged in, and lastly the lookup client, allow people to query the server for when the user had last logged in. I’ll explain each with a paragraph to themselves.

User Registration
The user first has to call a script on my share which can be read and executed by all. Essentially all this script does is send to my server what machine they are coming from, and their user name! The server then validates their host name and checks to see if the user has already registered, if this is all fine the server then produces a secret key for the user, and sends this back! The script will check if all went well and then set up the appropriate paths (aliases and a script to run on login) – the secret key is used for the login. If I had simply passed the user name it would have been possible to “check in” another user simply by passing this information.

Checking In
This script is called when the user logs in, since it calls a web page, in order to not impact performance, this script is backgrounded. This sends the server the secret key, the user name, the current host name, and if the user is logging in or out. This information is then validated and then the server updates it’s information.

Look Ups
Finally, the main component, looking up where a user is. This takes your user name and the requested user, after validating that your user name has not been spoofed (think what other information is provided when connecting to a web server, and what we can assume to know about the current user), we search the database for the user. If they are found, the known information is returned, otherwise a message informing the user to register them with the service is returned!

If you want more info, leave a comment below!

Leave a Reply

Your email address will not be published.