From 151d4b2d300ccb5a10966f4067bd2ef0bf301733 Mon Sep 17 00:00:00 2001 From: otuki <58715442+tttfrfr2@users.noreply.github.com> Date: Wed, 12 May 2021 18:30:26 +0900 Subject: [PATCH] fix(scan): Avoid panic when SSH connection refused (#1236) * fix(fix-ssh-fata): Avoid panic when SSH connection refused * chore(fix-ssh-fata): fix typo --- scanner/debian.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scanner/debian.go b/scanner/debian.go index ea6d9fc2..35eabc02 100644 --- a/scanner/debian.go +++ b/scanner/debian.go @@ -48,7 +48,8 @@ func detectDebian(c config.ServerInfo) (bool, osTypeInterface, error) { return false, nil, nil } if r.ExitStatus == 255 { - return false, nil, xerrors.Errorf("Unable to connect via SSH. Scan with -vvv option to print SSH debugging messages and check SSH settings. If you have never SSH to the host to be scanned, SSH to the host before scanning in order to add the HostKey. %s@%s port: %s\n%s", c.User, c.Host, c.Port, r) + deb := newDebian(c) // Panic occur when return value 2 is nil and 3 is non-nil + return false, deb, xerrors.Errorf("Unable to connect via SSH. Scan with -vvv option to print SSH debugging messages and check SSH settings. If you have never SSH to the host to be scanned, SSH to the host before scanning in order to add the HostKey. %s@%s port: %s\n%s", c.User, c.Host, c.Port, r) } logging.Log.Debugf("Not Debian like Linux. %s", r) return false, nil, nil