2017-06-17 15:21:21 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
2018-04-26 16:14:28 +01:00
|
|
|
$init_modules = [];
|
2017-06-17 15:21:21 +01:00
|
|
|
require __DIR__ . '/../includes/init.php';
|
|
|
|
|
|
|
|
$hostname = $argv[1];
|
|
|
|
$os = $argv[2];
|
|
|
|
$msg = $argv[3];
|
|
|
|
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api = new \App\ApiClients\Oxidized();
|
2022-06-06 23:51:21 -05:00
|
|
|
if (preg_match('/Configured from .+ by (?P<user>\S+)/', $msg, $matches)) {
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api->updateNode($hostname, $msg, $matches['user']);
|
2022-06-06 23:51:21 -05:00
|
|
|
} elseif (preg_match('/Configuration committed by user \\\\\'(?P<user>.+?)\\\\\'/', $msg, $matches)) {
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api->updateNode($hostname, $msg, $matches['user']);
|
2022-06-06 23:51:21 -05:00
|
|
|
} elseif (preg_match('/ASA-(config-)?5-111005: (?P<user>\S+) end configuration: OK/', $msg, $matches)) {
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api->updateNode($hostname, $msg, $matches['user']);
|
2022-06-06 23:51:21 -05:00
|
|
|
} elseif (preg_match('/startup-config was changed by (?P<user>\S+)/', $msg, $matches)) {
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api->updateNode($hostname, $msg, $matches['user']);
|
2022-06-06 23:51:21 -05:00
|
|
|
} elseif (preg_match('/UI_COMMIT: User \\\\\'(?P<user>.+?)\\\\\'/', $msg, $matches)) {
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api->updateNode($hostname, $msg, $matches['user']);
|
2022-06-06 23:51:21 -05:00
|
|
|
} elseif (preg_match('/IMI.+.Startup-config saved on .+ by (?P<user>\S+)/', $msg, $matches)) {
|
2022-01-29 21:09:05 -06:00
|
|
|
$oxidized_api->updateNode($hostname, $msg, $matches['user']); //Alliedware Plus devices. Requires at least V5.4.8-2.1
|
2022-06-06 23:51:21 -05:00
|
|
|
} elseif (isset($hostname, $msg)) {
|
|
|
|
// without user detection...
|
|
|
|
$oxidized_api->updateNode($hostname, $msg);
|
2017-06-17 15:21:21 +01:00
|
|
|
}
|