Added Utils::getUniqueID(), returns a machine ID and a even more variable machine ID

This commit is contained in:
Shoghi Cervantes
2014-01-29 17:07:01 +01:00
parent 7e8ae3a1e1
commit 09720a59ec
3 changed files with 27 additions and 7 deletions

View File

@@ -31,6 +31,32 @@ class Utils{
return ((@fsockopen("google.com", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.linux.org", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.php.net", 80, $e = null, $n = null, 2) !== false) ? true:false);
}
public static function getUniqueID($raw = false){
$machine = php_uname("a");
$machine .= file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : "";
$machine .= sys_get_temp_dir();
if(Utils::getOS() == "win"){
exec("ipconfig /ALL", $mac);
$mac = implode("\n", $mac);
if(preg_match_all("#Physical Address[. ]{1,}: ([0-9A-F\-]{17})#", $mac, $matches)){
foreach($matches[1] as $i => $v){
if($v == "00-00-00-00-00-00"){
unset($matches[1][$i]);
}
}
$machine .= implode(" ", $matches[1]); //Mac Addresses
}
}
$data = $machine . PHP_MAXPATHLEN;
$data .= PHP_INT_MAX;
$data .= PHP_INT_SIZE;
$data .= get_current_user();
foreach(get_loaded_extensions() as $ext){
$data .= $ext.":".phpversion($ext);
}
return hash("md5", $machine, $raw).hash("sha512", $data, $raw);
}
public static function getIP($force = false){
if(Utils::$online === false){
return false;