sshkeys

package module
v1.13.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 13 Imported by: 4

README

sshkeys

Actions Status Coverage Status PkgGoDev go-report

Get all ssh public keys of an ssh server.

Installation

Docker
$ docker run --rm -ti ghcr.io/eun/sshkeys:latest -algorithm=sha256 -encoding=base64 github.com
Prebuild

Download in the Releases section.

go
$ go install github.com/Eun/sshkeys/cmd/sshkeys

Usage

Usage: sshkeys [options] <host>
Options:
    -a authorized_keys
    -algorithm=authorized_keys
       Algorithm to hash the public keys, valid algorithms are: sha1, sha256, md5, authorized_keys

    -e=
    -encoding=
       Encoding to encode the hashed keys, valid encodings are: hex, base32, base64 (only used for algorithms sha1, sha256 and md5)

    -o=console
    -output=console
       Output format, valid formats are: console, json

    -c=4
    -concurrent=4
       Concurrent workers

    -t=60s
    -timeout=60s
       Connection timeout
Examples
$ sshkeys example.com
$ sshkeys -algorithm=sha256 -encoding=base64 -output=json github.com:22

Build History

Build history

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizedKey added in v1.13.4

func AuthorizedKey(key ssh.PublicKey) (string, error)

AuthorizedKey creates the authorized_key of the provided public key.

func DefaultKeyAlgorithms

func DefaultKeyAlgorithms() []string

DefaultKeyAlgorithms returns the default ssh key algorithms.

func FingerprintMD5 added in v1.13.4

func FingerprintMD5(encoding Encoding, key ssh.PublicKey) (string, error)

FingerprintMD5 creates the md5 fingerprint of the provided public key.

func FingerprintSHA1 added in v1.13.4

func FingerprintSHA1(encoding Encoding, key ssh.PublicKey) (string, error)

FingerprintSHA1 creates the sha1 fingerprint of the provided public key.

func FingerprintSHA256 added in v1.13.4

func FingerprintSHA256(encoding Encoding, key ssh.PublicKey) (string, error)

FingerprintSHA256 creates the sha256 fingerprint of the provided public key.

func GetKeys

func GetKeys(
	ctx context.Context,
	host string,
	concurrentWorkers int,
	timeout time.Duration,
	algorithms ...string,
) (map[string]ssh.PublicKey, error)

GetKeys gets the public keys for a host. Specify the amount of concurrentWorkers and the algorithms that should be used to fetch the keys. If unsure use DefaultKeyAlgorithms.

func GetVersion

func GetVersion(ctx context.Context, host string) (string, error)

GetVersion returns the ssh version of the host.

func SumToHexString added in v1.13.5

func SumToHexString(sum []byte) string

SumToHexString formats a sum in a aa:bb:cc:dd:ee:ff:... pattern.

Types

type Encoding added in v1.13.5

type Encoding uint8
const (
	HexEncoding Encoding = iota
	Base32Encoding
	Base64Encoding
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL