

Read more about the Win32_NetworkAdapterConfiguration object here (VS.85). Now the client can see his/her own MAC and IP Addresses.

Then we can simply use textboxes to display that information or whatever you like.ĭocument.getElementById( "txtMACAdress").value = unescape(macAddress) ĭocument.getElementById( "txtIPAdress").value = unescape(ipAddress) ĭocument.getElementById( "txtComputerName").value = unescape(computerName) Īnd just like before, make sure to place the declarations snippet above this script for it to display the values properly. Instead of Win32_Processor, here we'll access Win32_NetworkAdapterConfiguration to read network related details like the MAC Address, IP Address and the computer name. Var wmi = GetObject( "winmgmts:") Į = new Enumerator(wmi.ExecQuery( "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")) Ok if you're done reading, you'll notice we simply change the script to this: To reiterate, this is not going to work in op's usecase, but can and does work in my usecase.This is somewhat similar to the previous post Get client cpu id with javascript, so the client still needs to enable ActiveX components on his browser. This can be changed to wait for the mac before calling next() and block non-whitelisted requests. That script cached the ip, and could quickly verify the validity of the machine at that point using something like: ping -c 1 -w 2 -q $homeip > /dev/nullĮxecFile(`resolveip`,, (error, stdout, stderr) => "`) ifconfig is deprecated on Linux, so you should use ip.

On Linux, either of these commands will show you the MACs of all network cards in your machine: ifconfig grep ether ip link. However, doing this takes a long time (Doing so on a net with subnet 255.255.192.0 can take > 30s!) So if your machine has a wireless card and an Ethernet card, it'll have two MAC addresses. homeip=$(sudo arp-scan -lq | grep -i -m 1 $homemac | grep -oP "\d+\.\d+\.\d+\.\d+") Posts 7.5k Views Log in to reply M Maximilian Gerhardt, 12:02 UFD UFD One of the first Google results for 'C linux get MAC': Either cross-compile the program or compile locally. I previously had written a script to seek out a specific computer known to be on a network and known by its mac address. As per other answers, this will not work under all conditions, but it does work under a condition as detailed below My Usecase This is too specific for the original question, but someone else may find this useful.
