Rev 1130 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
557 | daniel-mar | 1 | #!/usr/bin/env php |
61 | daniel-mar | 2 | <?php |
3 | |||
511 | daniel-mar | 4 | /* |
5 | * OIDplus 2.0 |
||
6 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
||
7 | * |
||
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
9 | * you may not use this file except in compliance with the License. |
||
10 | * You may obtain a copy of the License at |
||
11 | * |
||
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
13 | * |
||
14 | * Unless required by applicable law or agreed to in writing, software |
||
15 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
17 | * See the License for the specific language governing permissions and |
||
18 | * limitations under the License. |
||
19 | */ |
||
20 | |||
1162 | daniel-mar | 21 | use ViaThinkSoft\OIDplus\OIDplus; |
22 | |||
97 | daniel-mar | 23 | require_once __DIR__ . '/../includes/oidplus.inc.php'; |
61 | daniel-mar | 24 | |
25 | OIDplus::init(true); |
||
26 | |||
1116 | daniel-mar | 27 | const ALL_OID_LIST = '/home/oidplus/all_oids.txt'; // contains all OIDs (non-public file) |
28 | const DESIRED_ROOT = '1.3.6.1.4.1.37476'; |
||
61 | daniel-mar | 29 | |
30 | # --- |
||
31 | |||
32 | exec("cat ".escapeshellarg(ALL_OID_LIST)." | sort | grep '^".DESIRED_ROOT."'", $out, $ec); |
||
33 | |||
34 | foreach ($out as $oid) { |
||
35 | $oid = trim($oid); |
||
36 | if ($oid == '') continue; |
||
37 | |||
130 | daniel-mar | 38 | if (strpos($oid, '1.3.6.1.4.1.37476.30.9.') !== 0) check_oid($oid); |
61 | daniel-mar | 39 | } |
40 | |||
1130 | daniel-mar | 41 | /** |
42 | * @param string $oid |
||
43 | * @return void |
||
44 | */ |
||
45 | function check_oid(string $oid) { |
||
61 | daniel-mar | 46 | |
261 | daniel-mar | 47 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array("oid:$oid")); |
236 | daniel-mar | 48 | $ok = $res->num_rows() > 0; |
61 | daniel-mar | 49 | |
50 | if (!$ok) { |
||
97 | daniel-mar | 51 | echo "Missing at OIDplus: $oid\n"; |
61 | daniel-mar | 52 | } |
53 | } |
||
54 | |||
55 | echo "OK\n"; |