2 $HOST_TYPE["screenos"]["name"] = "Netscreen Screen OS";
3 $HOST_TYPE["screenos"]["updateconfig"] = "nsos_updateConfig";
4 $HOST_TYPE["screenos"]["getconfig"] = "nsos_getConfigFromDB";
5 $HOST_TYPE["screenos"]["needsenable"] = false;
8 function nsos_getConfigFromDB($hip, $cid)
10 $data = db_selectData("configs", "configs_id", "$cid");
12 return base64_decode($data[0]["configdata"]);
15 function nsos_updateConfig($hip, $hostconfig)
19 function nsos_getConfig($host, $username, $password, $enable)
21 return genericssh_ssh($host, $username, $password, "cli show configuration");
25 // pscp -scp -pw 'password' -l admin so-f2:ns_sys_config
26 function screenosisgay($host, $username, $password, $command)
28 $connector = ssh2_connect("$host");
29 error_log("attempting connect to $host with $username");
31 error_log("connector true");
33 error_log("connector false");
35 ssh2_auth_password($connector, "$username", "$password");
36 $stream = ssh2_shell($connector, 'ansi');
37 fwrite($stream, PHP_EOL);
38 fwrite($stream, "set console page 0".PHP_EOL);
39 fwrite($stream, "get config".PHP_EOL);
40 fwrite($stream, PHP_EOL);
42 stream_set_blocking($stream, true);
43 //fwrite($stream, "exit".PHP_EOL);
44 //fwrite($stream, "n".PHP_EOL);
50 while($buf = fgets($stream, 4096)) {
52 echo "got buf\n\"$buf\"\n";