if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
$server = "10.10.10.10";
$methods = array(
'kex' => 'diffie-hellman-group1-sha1',
'client_to_server' => array(
'crypt' => '3des-cbc',
'comp' => 'none'),
'server_to_client' => array(
'crypt' => 'aes256-cbc,aes192-cbc,aes128-cbc',
'comp' => 'none'));
if(!($con = ssh2_connect($server, 22, $methods))){
echo "<b>chyba2</b>\n";
} else {
if(!ssh2_auth_password($con, "login", "heslo")) {
echo "<b>chyba1</b>";
} else {
echo "<b>ok1</b>"\n;
$command='ip firewall mangle add place-before="Sdilene_end" chain="prerouting" disabled="yes" action="mark-packet" comment="AAAAAAAAAAAAAAA" new-packet-mark="testicek" passthrough="no"';
if(!($stream = ssh2_exec($con, $command)) ){
echo "<b>chyba3</b>\n";
} else{
stream_set_blocking( $stream, true );
$data = "";
while( $buf = fread($stream,4096) ){
$data .= $buf;
}
fclose($stream);
echo '<br/><br/><b>prikaz:</b> '.$command.'<br/><br/>'.NL2BR($data);
}
}
}