generic ssh
[configmanager.git] / lib / genericssh.plugin.php
diff --git a/lib/genericssh.plugin.php b/lib/genericssh.plugin.php
new file mode 100644 (file)
index 0000000..1842d6d
--- /dev/null
@@ -0,0 +1,15 @@
+<?php 
+
+function genericssh_ssh($host, $username, $password, $command)
+{
+       $connector = ssh2_connect("$host");
+       ssh2_auth_password($connector, "$username", "$password");
+       $stream = ssh2_exec($connector, "$command");
+       stream_set_blocking($stream, true);
+
+       $config = stream_get_contents($stream);
+       
+       return $config;
+}
+
+?>
\ No newline at end of file