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:
mdtrooper 2011-08-19 11:23:24 +00:00
parent d6bd9c220a
commit 7088d85378
2 changed files with 109 additions and 44 deletions

View File

@ -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> 2011-08-18 Dario Rodriguez <dario.rodriguez@artica.es>
* operation/menu.php: Fixed a bug which hide extension icons. * operation/menu.php: Fixed a bug which hide extension icons.

View File

@ -53,58 +53,116 @@ function main_net_tools () {
switch($operation){ switch($operation){
case 1: echo "<h3>".__("Traceroute to "). $ip. "</h3>"; case 1:
echo "<pre>"; if (!file_exists('/usr/sbin/traceroute')) {
echo system ("/usr/sbin/traceroute $ip"); ui_print_error_message(__('Traceroute executable does not exist.'));
echo "</pre>"; }
else {
echo "<h3>".__("Traceroute to "). $ip. "</h3>";
echo "<pre>";
echo system ("/usr/sbin/traceroute $ip");
echo "</pre>";
}
break; break;
case 2: echo "<h3>".__("Ping to "). $ip. "</h3>"; case 2:
echo "<pre>"; ob_start();
echo system ("ping -c 5 $ip"); system('whereis ping');
echo "</pre>"; $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; break;
case 4: echo "<h3>".__("Basic TCP Scan on "). $ip. "</h3>"; case 4:
echo "<pre>"; ob_start();
echo system ("nmap -F $ip"); system('whereis nmap');
echo "</pre>"; $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; break;
case 5: echo "<h3>".__("Domain and IP information for "). $ip. "</h3>"; case 5:
echo "<pre>"; echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
echo system ("dig $ip"); ob_start();
echo system ("whois $ip"); system('whereis dig');
echo "</pre>"; $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; break;
case 3: echo "<h3>".__("SNMP information for "). $ip. "</h3>"; case 3: echo "<h3>".__("SNMP information for "). $ip. "</h3>";
ob_start();
echo "<h4>Uptime</h4>"; system('whereis snmpget');
echo "<pre>"; $output = ob_get_clean();
echo exec ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 "); $result = explode(':', $output);
$result = trim($result[1]);
echo "</pre>"; if (empty($result)) {
ui_print_error_message(__('SNMPget executable does not exist.'));
echo "<h4>Device info</h4>"; }
echo "<pre>"; else {
echo "<h4>Uptime</h4>";
echo system ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 "); echo "<pre>";
echo "</pre>"; echo exec ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
echo "</pre>";
echo "<h4>Interface Information</h4>"; echo "<h4>Device info</h4>";
echo "<table class=databox>"; echo "<pre>";
echo "<tr><th>".__("Interface");
echo "<th>".__("Status"); echo system ("snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
echo "</pre>";
$int_max = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
echo "<h4>Interface Information</h4>";
for ($ax=0; $ax < $int_max; $ax++){ echo "<table class=databox>";
$interface = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax "); echo "<tr><th>".__("Interface");
$estado = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax "); echo "<th>".__("Status");
echo "<tr><td>$interface<td>$estado";
} $int_max = exec ("snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
echo "</table>"; 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; break;
} }