Hello,
Let's imagine that we have a simple php script that should get ssh_host
, ssh_username
, ssh_port
from $_GET array and try to connect using this parameters to SSH.
$port = escapeshellcmd($_GET['ssh_port']);
$host = escapeshellcmd($_GET['ssh_host']);
$username = escapeshellcmd($_GET['ssh_username']);
$answer = shell_exec("ssh -p " . $port . " " . $user . "@" . $host);
Is escapeshellcmd()
enough or I need something more tricky?
Or maybe I should use escapeshellarg()
in this example?
Thank you.