Dmitry Shin лет назад: 8
Родитель
Сommit
d2161c7e16
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      htdocs/index.php

+ 5 - 3
htdocs/index.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 /**
 /**
- * HSDN PHP Looking Glass version 1.2.18b
+ * HSDN PHP Looking Glass version 1.2.19b
  *
  *
  * General Features:
  * General Features:
  *  - Supports the Telnet and SSH (through Putty/plink or sshpass)
  *  - Supports the Telnet and SSH (through Putty/plink or sshpass)
@@ -561,8 +561,6 @@ function process($url, $exec, $return_buffer = FALSE)
 {
 {
 	global $_CONFIG, $router, $protocol, $os, $command, $query, $ros;
 	global $_CONFIG, $router, $protocol, $os, $command, $query, $ros;
 
 
-	$exec = escapeshellcmd($exec)."\n";
-
 	$buffer = '';
 	$buffer = '';
 	$lines = $line = $is_exception = FALSE;
 	$lines = $line = $is_exception = FALSE;
 	$index = 0;
 	$index = 0;
@@ -653,6 +651,8 @@ function process($url, $exec, $return_buffer = FALSE)
 				$exec .= "\n";
 				$exec .= "\n";
 			}
 			}
 
 
+			$exec = escapeshellcmd($exec)."\n";
+
 			if ($fp = @popen('echo n | '.$ssh_path.' '.implode(' ', $params).' '.$exec, 'r'))
 			if ($fp = @popen('echo n | '.$ssh_path.' '.implode(' ', $params).' '.$exec, 'r'))
 			{
 			{
 				while (!feof($fp))
 				while (!feof($fp))
@@ -727,6 +727,8 @@ function process($url, $exec, $return_buffer = FALSE)
 					$prompt = '/[^\s]{2,}[\$%>] {0,1}$/';
 					$prompt = '/[^\s]{2,}[\$%>] {0,1}$/';
 				}
 				}
 
 
+				$exec .= "\n";
+
 				$telnet = new Telnet($url['host'], $url['port'], 10, $prompt);
 				$telnet = new Telnet($url['host'], $url['port'], 10, $prompt);
 				$telnet->connect();
 				$telnet->connect();
 				$telnet->login($url['user'], $url['pass']);
 				$telnet->login($url['user'], $url['pass']);