Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1423 → Rev 1424

/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-10-06
* Version 2023-11-11
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
87,11 → 87,19
echo sprintf("%-32s %s\n", "Microsoft GUID syntax:", '{' . strtoupper(oid_to_uuid(uuid_to_oid($uuid))) . '}');
echo sprintf("%-32s %s\n", "C++ struct syntax:", uuid_c_syntax($uuid));
echo "\n";
echo sprintf("%-32s %s\n", "As OID:", $oid);
if (class_exists('OidDerConverter')) {
echo sprintf("%-32s %s\n", "DER encoding of OID:", OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER($oid)));
}
 
echo sprintf("%-32s %s\n", "As OID (ISO/ITU-T 128 bits):", $oid=uuid_to_oid($uuid, '2.25'));
# Removed because it is too much information (we would also need to add this to the other OIDs too)
#if (class_exists('OidDerConverter')) {
# echo sprintf("%-32s %s\n", "DER encoding of OID:", OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER($oid)));
#}
echo sprintf("%-32s %s\n", "As OID (Microsoft):", $oid=uuid_to_oid($uuid, '1.2.840.113556.1.8000.2554'));
echo sprintf("%-32s %s\n", "As OID (Waterjuice 2x64 bits):", $oid=uuid_to_oid($uuid, '1.3.6.1.4.1.54392.1'));
echo sprintf("%-32s %s\n", "As OID (Waterjuice 4x32 bits):", $oid=uuid_to_oid($uuid, '1.3.6.1.4.1.54392.2'));
echo sprintf("%-32s %s\n", "As OID (Waterjuice 8x16 bits):", $oid=uuid_to_oid($uuid, '1.3.6.1.4.1.54392.3'));
 
echo "\n";
 
echo "<u>Interpretation of the UUID:</u>\n\n";
 
if (!$echo) ob_start();
840,6 → 848,7
}
 
function oid_to_uuid($oid) {
// TODO: Also support Non-2.25 base UUID-to-OID
if (!is_uuid_oid($oid,true)) return false;
 
if (substr($oid,0,1) == '.') {
862,6 → 871,7
}
 
function is_uuid_oid($oid, $only_allow_root=false) {
// TODO: Also support Non-2.25 base UUID-to-OID
if (substr($oid,0,1) == '.') $oid = substr($oid, 1); // remove leading dot
 
$ary = explode('.', $oid);
888,13 → 898,50
return true;
}
 
function uuid_to_oid($uuid) {
function uuid_to_oid($uuid, $base='2.25') {
if (!uuid_valid($uuid)) return false;
#$base = oid_sanitize($base);
 
$uuid = str_replace(array('-', '{', '}'), '', $uuid);
 
// Information about Microsoft and Waterjuice UUID-OID: https://waterjuiceweb.wordpress.com/2019/09/24/guids-to-oids/
 
if ($base == '2.25') {
$x = gmp_init($uuid, 16);
return '2.25.'.gmp_strval($x, 10);
return $base.'.'.gmp_strval($x, 10);
} else if ($base == '1.2.840.113556.1.8000.2554') {
return $base.'.'.
gmp_strval(gmp_init(substr($uuid,0,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,4,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,8,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,12,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,16,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,20,6),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,26,6),16),10);
} else if ($base == '1.3.6.1.4.1.54392.1') {
return $base.'.'.
gmp_strval(gmp_init(substr($uuid,0,16),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,16,16),16),10);
} else if ($base == '1.3.6.1.4.1.54392.2') {
return $base.'.'.
gmp_strval(gmp_init(substr($uuid,0,8),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,8,8),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,16,8),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,24,8),16),10);
} else if ($base == '1.3.6.1.4.1.54392.3') {
return $base.'.'.
gmp_strval(gmp_init(substr($uuid,0,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,4,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,8,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,12,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,16,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,20,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,24,4),16),10).'.'.
gmp_strval(gmp_init(substr($uuid,28,4),16),10);
} else {
throw new Exception("Unsupported UUID-to-OID base");
}
}
 
function uuid_numeric_value($uuid) {
$oid = uuid_to_oid($uuid);
/trunk/vendor/danielmarschall/vnag/TODO.md
8,7 → 8,7
- *.conf files: /daten sollte nicht in den example conf's stehen. irgendwie anders machen (Aber achtung: wir symlinken die config files in unserem /etc )
- idea: a script that converts the output of an EXISTING nagios plugin into VNag Weboutput. So an arbitary Nagios script can be forwarded to other systems over HTTP
- make all plugins "web enabled"
In the framework create an easy function, which generates a simple default HTML header and footer
- In the framework create an easy function, which generates a simple default HTML header and footer
- should error details, e.g. defective hard disks at the mdstat monitor be Verbosity=Summary, or Verbosity=AdditionalInformation ?
- idea for a new plugin: sudo /daten/scripts/tools/check_etc_perms | grep -v "world readable" | grep -v "world executable"
- should putputID, passwordOut and privateKey be a default argument? Then you can use encryption/signing for all plugins by default
/trunk/vendor/danielmarschall/vnag/src/framework/vnag_framework.inc.php
11,7 → 11,7
 
Developed by Daniel Marschall www.viathinksoft.com
Licensed under the terms of the Apache 2.0 license
Revision 2023-10-13
Revision 2023-11-05
 
*/
 
44,7 → 44,7
}
 
abstract class VNag {
/*public*/ const VNAG_VERSION = '2023-10-13';
/*public*/ const VNAG_VERSION = '2023-11-05';
 
// Status 0..3 for STATUSMODEL_SERVICE (the default status model):
# The guideline states: "Higher-level errors (such as name resolution errors, socket timeouts, etc) are outside of the control of plugins and should generally NOT be reported as UNKNOWN states."
782,7 → 782,7
}
 
$payload = @json_decode($payload,true);
if (!$payload) {
if ($payload === null) {
throw new VNagWebInfoException(VNagLang::$payload_not_json);
}
 
2248,5 → 2248,3
 
$inside_vnag_run = false;
$old_error_handler = set_error_handler("vnagErrorHandler");
 
// === End of document ===