2011-08-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/net_tools.php: fixed the try to execute any commands in the extensions. Fixes: #3393861 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4781 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d6bd9c220a
commit
7088d85378
|
@ -1,3 +1,10 @@
|
|||
2011-08-19 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* extensions/net_tools.php: fixed the try to execute any commands in the
|
||||
extensions.
|
||||
|
||||
Fixes: #3393861
|
||||
|
||||
2011-08-18 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||
|
||||
* operation/menu.php: Fixed a bug which hide extension icons.
|
||||
|
|
|
@ -53,58 +53,116 @@ function main_net_tools () {
|
|||
|
||||
switch($operation){
|
||||
|
||||
case 1: echo "<h3>".__("Traceroute to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("/usr/sbin/traceroute $ip");
|
||||
echo "</pre>";
|
||||
case 1:
|
||||
if (!file_exists('/usr/sbin/traceroute')) {
|
||||
ui_print_error_message(__('Traceroute executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Traceroute to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("/usr/sbin/traceroute $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: echo "<h3>".__("Ping to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("ping -c 5 $ip");
|
||||
echo "</pre>";
|
||||
case 2:
|
||||
ob_start();
|
||||
system('whereis ping');
|
||||
$output = ob_get_clean();
|
||||
$result = explode(':', $output);
|
||||
$result = trim($result[1]);
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('Ping executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Ping to "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("ping -c 5 $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("nmap -F $ip");
|
||||
echo "</pre>";
|
||||
case 4:
|
||||
ob_start();
|
||||
system('whereis nmap');
|
||||
$output = ob_get_clean();
|
||||
$result = explode(':', $output);
|
||||
$result = trim($result[1]);
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('Nmap executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("nmap -F $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
|
||||
echo "<pre>";
|
||||
echo system ("dig $ip");
|
||||
echo system ("whois $ip");
|
||||
echo "</pre>";
|
||||
case 5:
|
||||
echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
|
||||
ob_start();
|
||||
system('whereis dig');
|
||||
$output = ob_get_clean();
|
||||
$result = explode(':', $output);
|
||||
$result = trim($result[1]);
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('Dig executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("dig $ip");
|
||||
echo "</pre>";
|
||||
}
|
||||
ob_start();
|
||||
system('whereis whois');
|
||||
$output = ob_get_clean();
|
||||
$result = explode(':', $output);
|
||||
$result = trim($result[1]);
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('Whois executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<pre>";
|
||||
echo system ("whois $ip");
|
||||
echo "</pre>";
|
||||
|
||||
}
|
||||
break;
|
||||
case 3: echo "<h3>".__("SNMP information for "). $ip. "</h3>";
|
||||
|
||||
echo "<h4>Uptime</h4>";
|
||||
echo "<pre>";
|
||||
echo exec ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h4>Device info</h4>";
|
||||
echo "<pre>";
|
||||
|
||||
echo system ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h4>Interface Information</h4>";
|
||||
echo "<table class=databox>";
|
||||
echo "<tr><th>".__("Interface");
|
||||
echo "<th>".__("Status");
|
||||
|
||||
$int_max = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
||||
|
||||
for ($ax=0; $ax < $int_max; $ax++){
|
||||
$interface = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
|
||||
$estado = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
|
||||
echo "<tr><td>$interface<td>$estado";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
ob_start();
|
||||
system('whereis snmpget');
|
||||
$output = ob_get_clean();
|
||||
$result = explode(':', $output);
|
||||
$result = trim($result[1]);
|
||||
if (empty($result)) {
|
||||
ui_print_error_message(__('SNMPget executable does not exist.'));
|
||||
}
|
||||
else {
|
||||
echo "<h4>Uptime</h4>";
|
||||
echo "<pre>";
|
||||
echo exec ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
|
||||
echo "</pre>";
|
||||
echo "<h4>Device info</h4>";
|
||||
echo "<pre>";
|
||||
|
||||
echo system ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
|
||||
echo "</pre>";
|
||||
|
||||
echo "<h4>Interface Information</h4>";
|
||||
echo "<table class=databox>";
|
||||
echo "<tr><th>".__("Interface");
|
||||
echo "<th>".__("Status");
|
||||
|
||||
$int_max = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
|
||||
|
||||
for ($ax=0; $ax < $int_max; $ax++){
|
||||
$interface = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
|
||||
$estado = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
|
||||
echo "<tr><td>$interface<td>$estado";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue