X-Git-Url: http://git.pjr.cc/?p=configmanager.git;a=blobdiff_plain;f=lib%2Fscreenos.plugin.php;h=75287c66686ba3fbb96d4c3947ca6b2f3ef0da96;hp=30da6078c5aba68162b8fd76de9f5034d1fe7168;hb=HEAD;hpb=779ccbdea52a495b9150c12c6d69af2aa370d8f1
diff --git a/lib/screenos.plugin.php b/lib/screenos.plugin.php
index 30da607..75287c6 100644
--- a/lib/screenos.plugin.php
+++ b/lib/screenos.plugin.php
@@ -1,60 +1,8 @@
-Note: If your router/firewall/device uses a one-time password, leave these blank and manually update from the
-home page
-Name
-Password
-Method
- ";
-
- echo "Attempting first config grab, i see
";
- echo "
"; - echo $config; - echo ""; - } else { - echo "No username and password set, you can update manually from the home page\n"; - $hconfig["username"] = ""; - $hconfig["password"] = ""; - db_updateData("hosts", "hostconfig", base64_encode(serialize($hconfig)), "hostip", "$hip"); - } - - - echo "
"; - print_r($_REQUEST); - echo ""; -} +$HOST_TYPE["screenos"]["needsenable"] = false; function nsos_getConfigFromDB($hip, $cid) @@ -64,71 +12,52 @@ function nsos_getConfigFromDB($hip, $cid) return base64_decode($data[0]["configdata"]); } -function nsos_detail($hip) +function nsos_updateConfig($hip, $hostconfig) { - $data = db_selectData("configs", "hostip", "$hip", "configtime desc"); - - echo "
Config Data | Compare |
---|---|
$lupdate Get Download | Tick |
"; - echo $config; - echo ""; + return genericssh_ssh($host, $username, $password, "cli show configuration"); } -function nsos_getConfig($host, $username, $password) +// remembver this: +// pscp -scp -pw 'password' -l admin so-f2:ns_sys_config +function screenosisgay($host, $username, $password, $command) { - return genericssh_ssh($host, $username, $password, "cli show configuration"); + $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