Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a unique PC ID from a web browser

Tags:

php

apache

I have a web app that will be running n several specific target machines. I could have the user select which machine he is on when he logs in, but that is prone to error. Is there a way I can get some unique ID from each PC, store those in a database on my server and then when someone logs in from a particular machine, identify that machine? I thought of IP address but those might change as well due to the nature of our deployment. But is is critical that I know which machine the system is running on.

Note: I am not trying to determine the machine code of a web user's machine as that would be a privacy violation. I KNOW my machines so I was wanting to tie them to the database somehow. This also acts as security for me as I can reject logins from unknown machines.

Thanks for any ideas. I am running Apache with Code Igniter 3 and Centos 6.5

like image 556
Doug Wolfgram Avatar asked Jul 04 '14 04:07

Doug Wolfgram


People also ask

How do I get a unique device ID in my browser?

It is not technically possible to obtain an ID unique to the device, from a browser.

How do I find unique system ID?

To generate a mostly unique machine id, you can get a few serial numbers from various pieces of hardware on the system. Most processors will have a CPU serial number, the hard disks each have a number, and each network card will have a unique MAC address. You can get these and build a fingerprint for the machine.

Does each browser has a unique ID?

You can be identified by what's called Device fingerprint, which in your case is Browser Fingerprint. While the IP address is not a good identification, a combination of other factors that your browser passes on with the request can be used to identify you uniquely or almost uniquely.


2 Answers

It's not possible without a client component, browser plugin or something similar. The closest alternatives are:

  • using cookies;
  • using client certificates;
  • using browser fingerprinting;

each with their own disadvantages.

like image 197
Robby Cornelissen Avatar answered Sep 28 '22 08:09

Robby Cornelissen


You could use this as a computer ID:

$computerId = $_SERVER['HTTP_USER_AGENT'].$_SERVER['LOCAL_ADDR'].$_SERVER['LOCAL_PORT'].$_SERVER['REMOTE_ADDR'];

It's not completely fool proof, as the values of $_SERVER can be faked, however it will still add an extra layer of security that does not rely on cookies.

like image 23
Dan Bray Avatar answered Sep 28 '22 08:09

Dan Bray