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 function screenosisgay($host, $username, $password, $command)
27 $connector = ssh2_connect("$host");
28 error_log("attempting connect to $host with $username");
30 error_log("connector true");
32 error_log("connector false");
34 ssh2_auth_password($connector, "$username", "$password");
35 $stream = ssh2_shell($connector, 'ansi');
36 fwrite($stream, PHP_EOL);
37 fwrite($stream, "set console page 0".PHP_EOL);
38 fwrite($stream, "get config".PHP_EOL);
39 fwrite($stream, PHP_EOL);
41 stream_set_blocking($stream, true);
42 //fwrite($stream, "exit".PHP_EOL);
43 //fwrite($stream, "n".PHP_EOL);
49 while($buf = fgets($stream, 4096)) {
51 echo "got buf\n\"$buf\"\n";