Merge pull request #2455 from Rosiak/issue-2051

Add RIPE NCC API Whois lookup
This commit is contained in:
Daniel Preussker
2015-11-18 19:22:25 +00:00
4 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$status = 'error';
$message = 'unknown error';
$parameter = mres($_POST['parameter']);
if (isset($parameter)) {
$status = 'ok';
$message = 'Queried';
$output = get_ripe_api_whois_data_json($parameter);
}
else {
$status = 'error';
$message = 'ERROR: Could not query';
}
die(json_encode(array(
'status' => $status,
'message' => $message,
'parameter' => $parameter,
'output' => $output
)));

View File

@@ -1252,3 +1252,9 @@ function generate_dynamic_config_panel($title,$end_panel=true,$config_groups,$it
}
return $output;
}//end generate_dynamic_config_panel()
function get_ripe_api_whois_data_json($ripe_parameter) {
$ripe_whois_url = 'https://stat.ripe.net/data/whois/data.json?resource=' . $ripe_parameter;
return json_decode(file_get_contents($ripe_whois_url) , true);
}//end get_ripe_api_whois_data_json()

View File

@@ -74,6 +74,12 @@ if ($_SESSION['userlevel'] >= '10') {
<li><a href="<?php echo(generate_url(array('page'=>'availability-map'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> Availability</a></li>
<li><a href="<?php echo(generate_url(array('page'=>'map'))); ?>"><i class="fa fa-desktop fa-fw fa-lg"></i> Network</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><i class="fa fa-wrench fa-fw fa-lg"></i> Tools</a>
<ul class="dropdown-menu scrollable-menu">
<li><a href="<?php echo(generate_url(array('page'=>'ripenccapi'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg"></i> RIPE NCC API</a></li>
</ul>
</li>
<li role="presentation" class="divider"></li>
<li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><i class="fa fa-book fa-fw fa-lg"></i> Eventlog</a></li>