J'ai des problèmes avec cette commande "show version" sur le routeur cisco, je dois passer à l'écran suivant en appuyant sur un lorsque "--show more--" apparaît. Suivez le code:phpseclib ssh2 pty telnet cisco - comment avancer --more-- dans "show version"
function showVersion($ssh, $ansi){
$ssh->enablePTY();
$ssh->write("show version\n");
//$ssh->exec("show version");
$prompt_saida = "";
$ssh->setTimeout(3);
$prompt_temp = $ssh->read('#--More--|\[>\]#', NET_SSH2_READ_REGEX);
$prompt_saida = $prompt_temp;
$ssh->setTimeout(3);
while($prompt_temp = $ssh->read('#--More--|\[>\]#', NET_SSH2_READ_REGEX)){
$ssh->setTimeout(3);
$prompt_saida.= $ssh->read(NET_SSH2_READ_REGEX);
if (!preg_match('#--More--$#', $prompt)) { break; }
$ssh->write(' ');
$ssh->setTimeout(3);
}
return $prompt_saida;
//$ssh->write("terminal length 0\n");
//$ssh->write("\n");
$ssh->setTimeout(3);
//$ssh->read();
//$ssh->getLog();
$ansi->appendString($ssh->read());
}
Dernière connexion: Mer 4 octobre 2017 15:41:46 de xx.xx.xxx.xxx
Accès restreint aux utilisateurs autorisés. [xxxxxxxxxx [xxx @ [34; 1mPRA-xxxxxxxx [xxxx> [xxx
Authentifié avec succès!
"N'OUBLIEZ PAS DE CONFIGURER LA CONFIGURATION DU ROUTEUR SUR LA NVRAM, APRÈS CONSOLIDER LES MODIFICATIONS !!"
xxxxx_xxxx_xx> show version bash: show: command not found [xxxxxxxxxx @ [xxx [34; 1mPRA-xxxxxxxx [xxxx> [xxx
avec $ssh->exec("show version");
Dernière connexion: Mer 4 octobre 15 : 41: 46 2017 à partir de xx.xx.xxx.xxx
Accès restreint aux utilisateurs autorisés. [xxxxxxxxxx [xxx @ [34; 1mPRA-xxxxxxxx [xxxx> [xxx
Authentifié avec succès!
"N'OUBLIEZ PAS DE CONFIGURER LA CONFIGURATION DU ROUTEUR SUR LA NVRAM, APRÈS CONSOLIDER LES MODIFICATIONS !!"
xxxxx_xxxx_xx>/bin/bash: show: command not found
Voulez-vous me aider? Je serai très reconnaissant!
Je voudrais aussi connaître la meilleure façon de montrer le journal du routeur à l'écran:
$ssh->read();
$ssh->read(NET_SSH2_READ_REGEX);
$ssh->getLog();
$ansi->getScreen();
merci