X-Git-Url: http://git.pjr.cc/?p=configmanager.git;a=blobdiff_plain;f=lib%2Fscreenos.plugin.php;h=75287c66686ba3fbb96d4c3947ca6b2f3ef0da96;hp=7739cfed3b0e3e5f59a7f61cd4bedcd2d3bedc50;hb=HEAD;hpb=336d9ee4a2c84e3029a7f40b4ac759d592733c78 diff --git a/lib/screenos.plugin.php b/lib/screenos.plugin.php index 7739cfe..75287c6 100644 --- a/lib/screenos.plugin.php +++ b/lib/screenos.plugin.php @@ -1,27 +1,63 @@ -Name
-Password
-Method - "; - echo "
";
-	print_r($_REQUEST);
-	echo "
"; } -function nsos_getConfig($istest) +function nsos_getConfig($host, $username, $password, $enable) { - + return genericssh_ssh($host, $username, $password, "cli show configuration"); +} + +// remembver this: +// pscp -scp -pw 'password' -l admin so-f2:ns_sys_config +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