Forum OpenACS Q&A: How to uniquely identify user's PC without using IP address?

I have a requirement to identify the computer a user uses for reporting purposes. I have been using IP address as they were static but now the client's IT manager wants to assign IP addresses dynamically (DHCP). This is for a private intranet so I can install anything I need on the user's PC. Are there browser add-ons available that can lookup the Windows "machine name" or the MAC address? How would I then pass these values back to AOLserver?

Has anyone done this before?

Thanks for any help.

Hi Brian,

Are cookies good enough?  If yes then OACS will do it out of the box.

Hi Brian,

In reality, when using DHCP with a reasonably long lease time, you'll find that the client PC's IP doesn't change. If you configure the client PCs to do dynamic DNS update (which any relatively recent OS s/b capable of), and configure DNS servers to accept these updates, you can use any of the standard nslookup utilities to map the client IP to machine DNS name.

Alternatively, the IT folks could reserve IPs based on MAC address.

Thirdly, the arp cache on your server should contain MAC to IP mappings for each client that accesses your service. If the client PC IP changes, so does your local cache.

Randy

You could always try the following script.  I don't recommend running it more than once per session.  You need samba installed on the web server to do this but nothing samba-wise needs to be running or mounted.

set win_info [exec nmblookup -A $some_ip];

set machine_name_ptr [string first {<03>} $win_info];

set machine_name [string trim [string range $win_info [expr [string last {>} $win_info $machine_name_ptr] + 1] [expr $machine_name_ptr - 1]]]

(I don't actually use this script so I don't know how well it works.  I did test it a couple of times before posting it though.)

Thanks for all the replies!

David, your script certainly looks like it could work. I need to check if it's a certainty that every PC accessing the site can be named this way.

I also came across this thing that has a completely different way of solving the problem. http://www.mvps.org/vbnet/index.html?code/network/macaddressremote.htm Now I've just got to figure out how to call it!

Thanks again.

A colleague and I came up with a simple solution using Javascript. It works by including on the login page a JavaScript file stored locally on the PC. The machine name is hard-coded into the script, and the script creates a hidden input in the login form containing that machine name, which is passed to the login program. I then store the machine name as a session property. A call to ad_get_client_property gives the machine name.

Thanks to everyone for their help.

Brian, I was reading about your problem and I have the same situacion in my job. I would like to know more in detail the solution that you used with javascript.

I will be waiting for your reply

Best Regards

Hi Alfredo,

it's really very simple. In the login page, I have the following:
<FORM method=post action="/register/user-login" name="login">
<script language="javascript" src="c:\machine\machine-name.js"></script>

The file c:\machine\machine-name.js on the client PC just contains the following line:
document.writeln('<input type="hidden" name="machine_name" value="BRIAN" />');

Then when the user logins and submits, on the next page (/register/user-login), I simply set a cookie to store the machine_name

ad_set_cookie machine_name $machine_name

I hope this is clear,
Brian