Friday, March 28, 2014

mtr via a php script

because i need people to run mtr and not shell in.
 <form action="index.php" method="get">  
 Address <input type=text name=address /> Counter <input type=text name=counter size=4 value=15> <input type=submit value=go />  
 </form>  
   
 see that count thing? that's seconds you have to wait.<br>  
   
 <?php  
   
 if (strlen($_GET[address]) > 0  
 && $_GET[address] != 'localhost'  
 && $_GET[address] != '127.0.0.1'  
 && $_GET[address] != '127.0.0.0/8'  
 && $_GET[counter] <= 50) {  
 $output = shell_exec('/usr/bin/mtr '.$_GET[address].' -r -c '.$_GET[counter]);  
 echo "<pre>$output</pre>";  
 }  
   
 ?>  
Post a Comment