Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remote address and scan mode in JSON output #29

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ The scanner supports outputting the scan result as json. To do so, provide the `

```json
{
"RemoteAddr": "127.0.0.1:22",
"IsServer": true,
"Banner": "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.5",
"SupportsChaCha20": true,
"SupportsCbcEtm": false,
Expand Down
6 changes: 6 additions & 0 deletions tscanner/tscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const kexStrictIndicatorServer = "kex-strict-s-v00@openssh.com"

// Report contains the results of a vulnerability scan.
type Report struct {
// Contains the IP address and port of the scanned peer.
RemoteAddr string
// Indicates whether the scanned host was acting as client or server.
IsServer bool
// Banner contains the SSH banner of the remote peer.
Banner string
// SupportsChaCha20 indicates whether the remote peer supports the ChaCha20-Poly1305 cipher.
Expand Down Expand Up @@ -107,6 +111,8 @@ func ScanWithTimeout(address string, scanMode ScanMode, verbose bool, timeout in
}
}
report := new(Report)
report.RemoteAddr = conn.RemoteAddr().String()
report.IsServer = scanMode == ServerScan
report.Banner = remoteBanner
report.SupportsChaCha20 = slices.Contains(remoteKexInit.EncryptionAlgorithmsClientToServer, chaCha20Poly1305) ||
slices.Contains(remoteKexInit.EncryptionAlgorithmsServerToClient, chaCha20Poly1305)
Expand Down