Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1344 → Rev 1345

/trunk/TODO
1,4 → 1,7
 
August 2023 planned:
- Make a setting which rejects pages to proxy OIDplus (is this possible? What if the proxy does not send HTTP_X_FORWARDED_HOST?)
 
May 2023 planned:
- Don't send "information object OIDs" (= Non-OIDs) OIDs to oid-info.com anymore
=> 17 May 2023 mitigated at VTS internal side
/trunk/doc/config_values.md
472,6 → 472,19
Note: If supported, you can use Apache's "ProxyPassReverseCookiePath" to translate
the cookie path in a reverse-proxy setting.
 
### XFF_TRUSTED_PROXIES
 
OIDplus::baseConfig()->setValue('XFF_TRUSTED_PROXIES', []);
 
Contains the IP addresses of proxies of which the value
`HTTP_X_FORWARDED_FOR` is trusted in order to determine the IP address
of the real web-visitor. Otherwise `REMOTE_ADDR` will be used to
determine the address of the web-visitor.
Please note: If you have multiple proxies, then the second-level-proxy
must trust the third-level-proxy and so on.
OIDplus only verifies the address of its direct communication partner,
i.e. the proxy that will identify itself through `REMOTE_ADDR`.
 
### RA_PASSWORD_PEPPER
 
OIDplus::baseConfig()->setValue('RA_PASSWORD_PEPPER', '');
/trunk/includes/classes/OIDplus.class.php
2513,4 → 2513,20
}
}
 
/**
* Tries to determine the IP address of the website visitor
* @return string|false
*/
public static function getClientIpAddress() {
$direct_connection = $_SERVER['REMOTE_ADDR'] ?? false;
if ($direct_connection === false) return false;
 
$trusted_proxies = OIDplus::baseConfig()->getValue('XFF_TRUSTED_PROXIES', []);
if (in_array($direct_connection, $trusted_proxies)) {
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?: $direct_connection;
} else {
return $direct_connection;
}
}
 
}
/trunk/includes/classes/OIDplusAuthContentStoreJWT.class.php
267,7 → 267,7
// Optional feature: Limit the JWT to a specific IP address (used if JWT_FIXED_IP_USER or JWT_FIXED_IP_ADMIN is true)
$ip = $contentProvider->getValue(self::CLAIM_LIMIT_IP, null);
if (!is_null($ip)) {
if (isset($_SERVER['REMOTE_ADDR']) && ($ip !== $_SERVER['REMOTE_ADDR'])) {
if ($ip !== OIDplus::getClientIpAddress()) {
throw new OIDplusException(_L('Your IP address is not allowed to use this token'));
}
}
364,9 → 364,12
if ($admin) $authSimulation->adminLogin();
$authSimulation->setValue(OIDplusAuthContentStoreJWT::CLAIM_GENERATOR, $gen);
$authSimulation->setValue('exp', time()+$ttl);
if ($limit_ip && isset($_SERVER['REMOTE_ADDR'])) {
$authSimulation->setValue(self::CLAIM_LIMIT_IP, $_SERVER['REMOTE_ADDR']);
if ($limit_ip) {
$cur_ip = OIDplus::getClientIpAddress();
if ($cur_ip !== false) {
$authSimulation->setValue(self::CLAIM_LIMIT_IP, $cur_ip);
}
}
return $authSimulation->getJWTToken();
}
 
599,10 → 602,13
$this->raLogin($email);
$ttl = OIDplus::baseConfig()->getValue('JWT_TTL_LOGIN_USER', 30*24*60*60);
$this->setValue('exp', time()+$ttl); // JWT "exp" attribute
if (OIDplus::baseConfig()->getValue('JWT_FIXED_IP_USER', false) && isset($_SERVER['REMOTE_ADDR'])) {
$this->setValue(self::CLAIM_LIMIT_IP, $_SERVER['REMOTE_ADDR']);
if (OIDplus::baseConfig()->getValue('JWT_FIXED_IP_USER', false)) {
$cur_ip = OIDplus::getClientIpAddress();
if ($cur_ip !== false) {
$this->setValue(self::CLAIM_LIMIT_IP, $cur_ip);
}
}
}
 
/**
* @param string $loginfo
634,10 → 640,13
$this->adminLogin();
$ttl = OIDplus::baseConfig()->getValue('JWT_TTL_LOGIN_ADMIN', 30*24*60*60);
$this->setValue('exp', time()+$ttl); // JWT "exp" attribute
if (OIDplus::baseConfig()->getValue('JWT_FIXED_IP_ADMIN', false) && isset($_SERVER['REMOTE_ADDR'])) {
$this->setValue(self::CLAIM_LIMIT_IP, $_SERVER['REMOTE_ADDR']);
if (OIDplus::baseConfig()->getValue('JWT_FIXED_IP_ADMIN', false)) {
$cur_ip = OIDplus::getClientIpAddress();
if ($cur_ip !== false) {
$this->setValue(self::CLAIM_LIMIT_IP, $cur_ip);
}
}
}
 
// Individual functions
 
676,6 → 685,7
if (!isset($payload["nbf"])) $payload["nbf"] = time();
if (!isset($payload["exp"])) $payload["exp"] = time()+3600/*1h*/;
 
$cur_ip = OIDplus::getClientIpAddress();
if (!isset($payload[self::CLAIM_TRACE])) {
// "Trace" can be used for later updates
// For example, if the IP changes "too much" (different country, different AS, etc.)
684,7 → 694,7
$payload[self::CLAIM_TRACE]['iat_1st'] = $payload["iat"];
$payload[self::CLAIM_TRACE]['jti_1st'] = $payload["jti"];
$payload[self::CLAIM_TRACE]['seq'] = 1;
$payload[self::CLAIM_TRACE]['ip'] = $_SERVER['REMOTE_ADDR'] ?? '';
if ($cur_ip !== false) $payload[self::CLAIM_TRACE]['ip'] = $cur_ip;
$payload[self::CLAIM_TRACE]['ip_1st'] = $payload[self::CLAIM_TRACE]['ip'];
$payload[self::CLAIM_TRACE]['ua'] = $_SERVER['HTTP_USER_AGENT'] ?? '';
$payload[self::CLAIM_TRACE]['ua_1st'] = $payload[self::CLAIM_TRACE]['ua'];
691,7 → 701,7
} else {
assert(is_numeric($payload[self::CLAIM_TRACE]['seq']));
$payload[self::CLAIM_TRACE]['seq']++;
$payload[self::CLAIM_TRACE]['ip'] = $_SERVER['REMOTE_ADDR'] ?? '';
if ($cur_ip !== false) $payload[self::CLAIM_TRACE]['ip'] = $cur_ip;
$payload[self::CLAIM_TRACE]['ua'] = $_SERVER['HTTP_USER_AGENT'] ?? '';
}
 
/trunk/includes/classes/OIDplusMailUtils.class.php
177,7 → 177,8
$h->addHeader('X-Mailer', 'PHP/'.PHP_VERSION);
 
// DM 14.04.2022: Commented out because of privacy
//if (isset($_SERVER['REMOTE_ADDR'])) $h->addHeader('X-RemoteAddr', $_SERVER['REMOTE_ADDR']);
// $cur_ip = OIDplus::getClientIpAddress();
//if ($cur_ip !== false) $h->addHeader('X-RemoteAddr', $cur_ip);
 
$h->addHeader('MIME-Version', '1.0');
 
/trunk/plugins/viathinksoft/captcha/hcaptcha/OIDplusCaptchaPluginHCaptcha.class.php
80,7 → 80,7
array(
"secret" => $secret,
"response" => $response,
"remoteip" => $_SERVER['REMOTE_ADDR'],
"remoteip" => OIDplus::getClientIpAddress() ?: '',
"sitekey" => $sitekey
)
);
/trunk/plugins/viathinksoft/captcha/recaptcha/OIDplusCaptchaPluginRecaptcha.class.php
115,7 → 115,7
_CheckParamExists($params, $fieldname);
$response=$params[$fieldname];
 
$verify=url_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.urlencode($secret).'&response='.urlencode($response).'&remoteip='.urlencode($_SERVER['REMOTE_ADDR']));
$verify=url_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.urlencode($secret).'&response='.urlencode($response).'&remoteip='.urlencode(OIDplus::getClientIpAddress() ?: ''));
if ($verify === false) {
throw new OIDplusException(_L('CAPTCHA not successfully verified').' (Web request failed)');
}
/trunk/plugins/viathinksoft/captcha/vts_challenge/OIDplusCaptchaPluginVtsClientChallenge.class.php
61,7 → 61,7
 
$starttime = time();
$random = mt_rand($min,$max);
$ip_target = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
$ip_target = OIDplus::getClientIpAddress() ?: 'unknown';
$challenge = sha3_512($starttime.'/'.$ip_target.'/'.$random); // $random is secret!
$challenge_integrity = OIDplus::authUtils()->makeAuthKey(['797bfc34-f4fa-11ed-86ca-3c4a92df8582',$challenge]);
$send_to_client = array($starttime, $ip_target, $challenge, $min, $max, $challenge_integrity);
155,7 → 155,7
 
$open_trans_file = self::getOpenTransFileName($ip_target, $answer);
 
$current_ip = ($_SERVER['REMOTE_ADDR'] ?? 'unknown');
$current_ip = OIDplus::getClientIpAddress() ?: 'unknown';
if ($ip_target != $current_ip) {
throw new OIDplusException(_L('IP address has changed. Please try again. (current IP %1, expected %2)', $current_ip, $ip_target));
//} else if (time()-$starttime > OIDplus::baseConfig()->getValue('VTS_CAPTCHA_MAXTIME', 10*60/*10 minutes*/)) {
/trunk/plugins/viathinksoft/logger/000_database/OIDplusLoggerPluginDatabase.class.php
40,7 → 40,7
* @throws OIDplusException
*/
public function log(OIDplusLogEvent $event): bool {
$addr = $_SERVER['REMOTE_ADDR'] ?? '';
$addr = OIDplus::getClientIpAddress() ?: '';
OIDplus::dbIsolated()->query("insert into ###log (addr, unix_ts, event) values (?, ?, ?)", array($addr, time(), $event->getMessage())); // TODO: why unix_ts? Why not a database DATETIME field?!
$log_id = OIDplus::dbIsolated()->insert_id();
if ($log_id === 0) {
/trunk/plugins/viathinksoft/logger/100_linux_syslog/OIDplusLoggerPluginLinuxSyslog.class.php
73,7 → 73,7
$objects_info = count($objects_names) == 0 ? '' : ' ('._L('affected objects: %1',implode(', ',$objects_names)).')';
 
$ts = date('Y-m-d H:i:s');
$addr = $_SERVER['REMOTE_ADDR'] ?? _L('unknown');
$addr = OIDplus::getClientIpAddress() ?: _L('unknown');
$line = "[$ts] [$addr] ".$event->getMessage().$users_info.$objects_info;
 
return @file_put_contents('/var/log/syslog', "$line\n", FILE_APPEND) !== false;
/trunk/plugins/viathinksoft/logger/300_userdata_logfile/OIDplusLoggerPluginUserdataLogfile.class.php
66,7 → 66,7
$objects_info = count($objects_names) == 0 ? '' : ' ('._L('affected objects: %1',implode(', ',$objects_names)).')';
 
$ts = date('Y-m-d H:i:s');
$addr = $_SERVER['REMOTE_ADDR'] ?? _L('unknown');
$addr = OIDplus::getClientIpAddress() ?: _L('unknown');
 
// Note: $ts was put into brackets, because there is probably a bug in fail2ban that does not allow the date/time being at offset 0
// "WARNING Found a match for '020-05-11 22:50:58 [192.168.69.89] Failed login ..."
/trunk/vendor/danielmarschall/uuid_mac_utils/includes/uuid_utils.inc.php
3,7 → 3,7
/*
* UUID utils for PHP
* Copyright 2011 - 2023 Daniel Marschall, ViaThinkSoft
* Version 2023-07-18
* Version 2023-07-29
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
658,25 → 658,102
echo sprintf("%-32s %s\n", "Custom data block4 (14 bit):", "[0x$custom_block4]");
echo sprintf("%-32s %s\n", "Custom data block5 (48 bit):", "[0x$custom_block5]");
 
// Check if Custom UUIDv8 is likely an OIDplus 2.0 System UUID
// Details here: https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md
if (($custom_block4 == '0000') && (strtolower($custom_block5) == '1890afd80709')) {
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 System UUID</a></u>\n\n";
// START: Check if Custom UUIDv8 is likely an OIDplus 2.0 Custom UUID
 
echo sprintf("%-32s %s\n", "System ID:", "[0x$custom_block1] ".hexdec($custom_block1));
echo sprintf("%-32s %s\n", "Creation time:", "[0x$custom_block2] ".($custom_block2 == '0000' ? 'Unknown' : date('Y-m-d', hexdec($custom_block2)*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$custom_block3]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$custom_block4] 0=System");
echo sprintf("%-32s %s\n", "Object ID hash:", "[0x$custom_block5] SHA1('') = ????????????????????????????$custom_block5");
$oidplus_systemid_hex = $custom_block1;
$oidplus_systemid_int = hexdec($oidplus_systemid_hex); // 31 bit hash of public key
$oidplus_systemid_valid = hexdec($custom_block1) < 0x80000000;
 
$oidplus_creation_hex = $custom_block2;
$oidplus_creation_int = hexdec($oidplus_creation_hex); // days since 1 January 1970, or 0 if unknown
//$oidplus_creation_valid = ($oidplus_creation_int >= 14610/*1 Jan 2010*/) && ($oidplus_creation_int <= floor(time()/24/60/60)/*Today*/);
$oidplus_creation_unknown = $oidplus_creation_int == 0;
 
$oidplus_reserved_hex = $custom_block3;
$oidplus_reserved_int = hexdec($oidplus_reserved_hex);
 
$oidplus_namespace_hex = $custom_block4;
$oidplus_namespace_int = hexdec($oidplus_namespace_hex);
 
$oidplus_data_hex = $custom_block5;
$oidplus_data_int = (PHP_INT_SIZE == 4) ? gmp_strval(gmp_init($oidplus_data_hex,16),10) : hexdec($custom_block5);
 
if ($oidplus_systemid_valid && ($oidplus_reserved_int == 0)) {
if (($oidplus_namespace_int == 0) && $oidplus_creation_unknown && (strtolower($oidplus_data_hex) == '1890afd80709')) {
// System GUID, e.g. 6e932dd7-0000-8000-8000-1890afd80709
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60))); /**@phpstan-ignore-line*/
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=System");
echo sprintf("%-32s %s\n", "Data (empty string hash):", "[0x$oidplus_data_hex] SHA1('') = ????????????????????????????$oidplus_data_hex");
}
else if (($oidplus_namespace_int == 1) && $oidplus_creation_unknown) {
// User GUID, e.g. 6e932dd7-0000-8000-8001-2938f50e857e (User), 6e932dd7-0000-8000-8001-000000000000 (Admin)
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60))); /**@phpstan-ignore-line*/
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=User");
if ($oidplus_data_int == 0) {
echo sprintf("%-32s %s\n", "Data (Username):", "[0x$oidplus_data_hex] 0=Admin");
} else {
// Check if Custom UUIDv8 is likely an OIDplus 2.0 Information Object UUID
// Details here: https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md
// NOTE: Actually, the date 0x0000 is OK for objects which have an unknown creation date. However, we disallow it, otherwise there is a risk that Non-OIDplus UUID gets confused with OIDplus UUIDs
$min_day = 14610; // 1 Jan 2010
$max_day = floor(time()/24/60/60); // Today
if (($custom_block3 == '000') && (hexdec($custom_block2) >= $min_day) && (hexdec($custom_block2) <= $max_day)) {
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Information Object UUID</a></u>\n\n";
 
echo sprintf("%-32s %s\n", "Data (Username):", "[0x$oidplus_data_hex] SHA1(UserName) = ????????????????????????????$oidplus_data_hex");
}
}
else if (($oidplus_namespace_int == 2)/* && $oidplus_creation_valid*/) {
// Log entry GUID, e.g. 6e932dd7-458c-8000-8002-0000000004d2
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=Log Entry");
echo sprintf("%-32s %s\n", "Data (Sequence number):", "[0x$oidplus_data_hex] $oidplus_data_int");
}
else if (($oidplus_namespace_int == 3) && $oidplus_creation_unknown) {
// Configuration entry GUID, e.g. 6e932dd7-0000-8000-8003-f14dda42862a
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60))); /**@phpstan-ignore-line*/
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=Configuration Entry");
echo sprintf("%-32s %s\n", "Data (Setting name hash):", "[0x$oidplus_data_hex] SHA1(SettingName) = ????????????????????????????$oidplus_data_hex");
}
else if ($oidplus_namespace_int == 4) {
// ASN.1 Alpahnumeric identifier GUID, e.g. 6e932dd7-0000-8000-8004-208ded8a3f8f
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=ASN.1 Alphanumeric ID");
$oidplus_data_24hi_hex = substr($oidplus_data_hex, 0, 6);
$oidplus_data_24lo_hex = substr($oidplus_data_hex, 6, 6);
echo sprintf("%-32s %s\n", "Data (OID hash):", "[0x$oidplus_data_24hi_hex] SHA1(OID) = ????????????????????????????$oidplus_data_24hi_hex");
echo sprintf("%-32s %s\n", "Data (Name hash):", "[0x$oidplus_data_24lo_hex] SHA1(AlphaNumId) = ????????????????????????????$oidplus_data_24lo_hex");
}
else if ($oidplus_namespace_int == 5) {
// Unicode Label entry GUID, e.g. 6e932dd7-0000-8000-8005-208dedaf9a96
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=Unicode Label");
$oidplus_data_24hi_hex = substr($oidplus_data_hex, 0, 6);
$oidplus_data_24lo_hex = substr($oidplus_data_hex, 6, 6);
echo sprintf("%-32s %s\n", "Data (OID hash):", "[0x$oidplus_data_24hi_hex] SHA1(OID) = ????????????????????????????$oidplus_data_24hi_hex");
echo sprintf("%-32s %s\n", "Data (Name hash):", "[0x$oidplus_data_24lo_hex] SHA1(UnicodeLabel) = ????????????????????????????$oidplus_data_24lo_hex");
}
else if (($oidplus_namespace_int >= 6) && ($oidplus_namespace_int <= 0xF)) {
// System reserved
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace:", "[0x$oidplus_namespace_hex] $oidplus_namespace_int=Unknown (System Reserved)");
echo sprintf("%-32s %s\n", "Data (Setting name hash):", "[0x$oidplus_data_hex] Unknown");
}
else if ($oidplus_namespace_int > 0xF) {
// Information Object GUID, e.g. 6e932dd7-458c-8000-b9e9-c1e3894d1105
$known_objecttype_plugins = array(
// Latest list here: https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md
'1.3.6.1.4.1.37476.2.5.2.4.8.1' => 'doi (ViaThinkSoft plugin)',
700,18 → 777,19
);
$namespace_desc = 'Unknown object type';
foreach ($known_objecttype_plugins as $oid => $name) {
if ((hexdec(substr(sha1($oid),-4)) & 0x3fff) == hexdec($custom_block4)) $namespace_desc = "$oid = $name";
if ((hexdec(substr(sha1($oid), -4)) & 0x3fff) == $oidplus_namespace_int) $namespace_desc = "$oid = $name";
}
 
echo sprintf("%-32s %s\n", "System ID:", "[0x$custom_block1] ".hexdec($custom_block1));
echo sprintf("%-32s %s\n", "Creation time:", "[0x$custom_block2] ".($custom_block2 == '0000' ? 'Unknown' : date('Y-m-d', hexdec($custom_block2)*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$custom_block3]");
echo sprintf("%-32s %s\n", "Namespace (Obj.type OID) hash:", "[0x$custom_block4] $namespace_desc");
echo sprintf("%-32s %s\n", "Object ID hash:", "[0x$custom_block5] SHA1 = ????????????????????????????$custom_block5");
 
echo "\n<u>Interpretation of <a href=\"https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md\">OIDplus 2.0 Custom UUID</a></u>\n\n";
echo sprintf("%-32s %s\n", "System ID:", "[0x$oidplus_systemid_hex] ".$oidplus_systemid_int);
echo sprintf("%-32s %s\n", "Creation time:", "[0x$oidplus_creation_hex] ".($oidplus_creation_unknown ? 'Unknown' : date('Y-m-d', $oidplus_creation_int*24*60*60)));
echo sprintf("%-32s %s\n", "Reserved:", "[0x$oidplus_reserved_hex]");
echo sprintf("%-32s %s\n", "Namespace (Obj.type OID hash):", "[0x$oidplus_namespace_hex] $namespace_desc");
echo sprintf("%-32s %s\n", "Data (Object name hash):", "[0x$oidplus_data_hex] SHA1(ObjectName) = ????????????????????????????$oidplus_data_hex");
}
}
 
// END: OIDplus 2.0 Custom UUID Interpretation
 
break;
default:
echo sprintf("%-32s %s\n", "Version:", "[0x".dechex($version)."] Unknown");