X-Git-Url: http://git.pjr.cc/?p=configmanager.git;a=blobdiff_plain;f=lib%2Fscreenos.plugin.php;fp=lib%2Fscreenos.plugin.php;h=1cf491443eff760a10aa85e245f2ecea54fe32ae;hp=20555d34d18b94b2b535f4440aa46f6f2eaf6721;hb=1209bb2b2c42b6f18233a54df684cc27cadfc581;hpb=5882044ae8cee1579bb1e5582497ae8b3b9e85c5 diff --git a/lib/screenos.plugin.php b/lib/screenos.plugin.php index 20555d3..1cf4914 100644 --- a/lib/screenos.plugin.php +++ b/lib/screenos.plugin.php @@ -20,4 +20,43 @@ function nsos_getConfig($host, $username, $password, $enable) { return genericssh_ssh($host, $username, $password, "cli show configuration"); } + +// remembver this: +function screenosisgay($host, $username, $password, $command) +{ + $connector = ssh2_connect("$host"); + error_log("attempting connect to $host with $username"); + if($connector) { + error_log("connector true"); + } else { + error_log("connector false"); + } + ssh2_auth_password($connector, "$username", "$password"); + $stream = ssh2_shell($connector, 'ansi'); + fwrite($stream, PHP_EOL); + fwrite($stream, "set console page 0".PHP_EOL); + fwrite($stream, "get config".PHP_EOL); + fwrite($stream, PHP_EOL); + sleep(1); + stream_set_blocking($stream, true); + //fwrite($stream, "exit".PHP_EOL); + //fwrite($stream, "n".PHP_EOL); + + + $config = ""; + $initline = ""; + $haveinit = false; + while($buf = fgets($stream, 4096)) { + flush(); + echo "got buf\n\"$buf\"\n"; + $initline = $buf; + $config .= $buf; + } + fclose($stream); + + return $config; +} + + + ?> \ No newline at end of file