B
Ben Callister
hello-
i need to have a way to accurately 'fingerprint' an end-user's machine. the
resulting 'fingerprint' needs to be a simple string-based value. currently,
i have created the function listed below that i am using to do this.
however, this appears to break down from time to time and i cant determine
exactly why.
i know that enabling/disable network connections will change the produced
value, but is there something else that would change this? perhaps the type
of encryption i am using? should i use another one? when i run this function
lots of times, it produces the same fingerprint. however, it appears to
change later in the future, and i havent been able to detect why because it
doesnt change each time i call this function.
i am totally open to changing my approach entirely. like i said, i simply
need *some* way to accurately identify an end-user's machine
(programmatically, of course).
can someone please provide me with thoughts and an example that will
accomplish this task better?
many thanks!
ben
--------------------
using System;
using System.Management;
using System.Security.Cryptography;
namespace QC.Forensics.Hardware
{
public class LocalMachine
{
public static string MachineFingerprint
{
get
{
//get the collection of all of the network adapters on the local machine
ManagementClass pManagementClass = new
ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection pMOColl = pManagementClass.GetInstances();
//build our fingerprint, based on all the MAC addresses for each network
card installed on the local machine
string sFingerprint = "";
string sCurMACAddress = "";
foreach(ManagementObject pCurMO in pMOColl)
{
sCurMACAddress = "";
try
{
sCurMACAddress = pCurMO["MacAddress"].ToString();
}
catch { }
if (sCurMACAddress != "")
{
if (sFingerprint == "") sFingerprint = sCurMACAddress;
else sFingerprint = sFingerprint + ":" + sCurMACAddress;
}
}
//now hash our value to get our true fingerprint
byte[] aInBits = System.Text.ASCIIEncoding.ASCII.GetBytes(sFingerprint);
SHA1 pHasher = new SHA1CryptoServiceProvider();
byte[] aOutBits = pHasher.ComputeHash(aInBits);
sFingerprint = Convert.ToBase64String(aOutBits);
return sFingerprint;
}
}
}
}
i need to have a way to accurately 'fingerprint' an end-user's machine. the
resulting 'fingerprint' needs to be a simple string-based value. currently,
i have created the function listed below that i am using to do this.
however, this appears to break down from time to time and i cant determine
exactly why.
i know that enabling/disable network connections will change the produced
value, but is there something else that would change this? perhaps the type
of encryption i am using? should i use another one? when i run this function
lots of times, it produces the same fingerprint. however, it appears to
change later in the future, and i havent been able to detect why because it
doesnt change each time i call this function.
i am totally open to changing my approach entirely. like i said, i simply
need *some* way to accurately identify an end-user's machine
(programmatically, of course).
can someone please provide me with thoughts and an example that will
accomplish this task better?
many thanks!
ben
--------------------
using System;
using System.Management;
using System.Security.Cryptography;
namespace QC.Forensics.Hardware
{
public class LocalMachine
{
public static string MachineFingerprint
{
get
{
//get the collection of all of the network adapters on the local machine
ManagementClass pManagementClass = new
ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection pMOColl = pManagementClass.GetInstances();
//build our fingerprint, based on all the MAC addresses for each network
card installed on the local machine
string sFingerprint = "";
string sCurMACAddress = "";
foreach(ManagementObject pCurMO in pMOColl)
{
sCurMACAddress = "";
try
{
sCurMACAddress = pCurMO["MacAddress"].ToString();
}
catch { }
if (sCurMACAddress != "")
{
if (sFingerprint == "") sFingerprint = sCurMACAddress;
else sFingerprint = sFingerprint + ":" + sCurMACAddress;
}
}
//now hash our value to get our true fingerprint
byte[] aInBits = System.Text.ASCIIEncoding.ASCII.GetBytes(sFingerprint);
SHA1 pHasher = new SHA1CryptoServiceProvider();
byte[] aOutBits = pHasher.ComputeHash(aInBits);
sFingerprint = Convert.ToBase64String(aOutBits);
return sFingerprint;
}
}
}
}