From 3f5cb3b7ccdeca87fb5eaaf66436c93aa50280dc Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Mon, 17 May 2021 23:02:53 +0200 Subject: [PATCH] remote.cgi: Use new system methods Signed-off-by: Stefan Schantl --- html/cgi-bin/remote.cgi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/remote.cgi b/html/cgi-bin/remote.cgi index c76f5129ea..576e7628d9 100644 --- a/html/cgi-bin/remote.cgi +++ b/html/cgi-bin/remote.cgi @@ -254,7 +254,10 @@ sub viewkey if ( -e $key ) { - my @temp = split(/ /,`/usr/bin/ssh-keygen -l -f $key`); + # Use safe system_output function to call ssh-keygen and get the output from the tool. + my @ssh_keygen = &General::system_output("/usr/bin/ssh-keygen", "-l", -"-f", "$key"); + + my @temp = split(/ /, @ssh_keygen); my $keysize = &Header::cleanhtml($temp[0],"y"); my $fingerprint = &Header::cleanhtml($temp[1],"y"); print "$key$name$fingerprint$keysize\n"; @@ -264,8 +267,7 @@ sub viewkey sub printactivelogins() { # print active SSH logins (grep outpout of "who -s") - my $command = "who -s"; - my @output = `$command`; + my @output = &General::system_output("who", "-s"); chomp(@output); my $id = 0; -- 2.39.2