usr bin php5 conn ssh2_connect 10 22 ssh2_auth_password conn root 123

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/php5
<?
$conn = ssh2_connect("10.0.1.1", 22);
ssh2_auth_password($conn, "root", "123");
$stream = ssh2_exec($conn, "ps");
$data = "";
while($buf = fread($stream, 4096))
{
$data .= $buf;
}
fclose($stream);
var_dump($data)."/n";
?>