2017-08-01 23:13:28 +00:00
|
|
|
package zmodules
|
|
|
|
|
|
|
|
import (
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/zmap/zgrab2/zgrab2"
|
|
|
|
)
|
|
|
|
|
2017-08-10 19:10:34 +00:00
|
|
|
type SSHModule struct {
|
2017-08-09 20:13:18 +00:00
|
|
|
zgrab2.BaseModule
|
2017-08-01 23:13:28 +00:00
|
|
|
Client string `long:"client" description:"Mimic behavior of a specific SSH client"`
|
|
|
|
KexAlgorithms string `long:"kex-algorithms" description:"Set SSH Key Exchange Algorithms"`
|
|
|
|
HostKeyAlgorithms string `long:"host-key-algorithms" description:"Set SSH Host Key Algorithms"`
|
|
|
|
NegativeOne bool `long:"negative-one" description:"Set SSH DH kex value to -1 in the selected group"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2017-08-10 19:10:34 +00:00
|
|
|
var sshModule SSHModule
|
|
|
|
cmd, err := zgrab2.AddCommand("ssh", "SSH Banner Grab", "Grab a banner over SSH", &sshModule)
|
2017-08-01 23:13:28 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2017-08-10 19:10:34 +00:00
|
|
|
sshModule.SetDefaultPortAndName(cmd, uint(22), "ssh")
|
2017-08-01 23:13:28 +00:00
|
|
|
}
|
|
|
|
|
2017-08-07 21:51:15 +00:00
|
|
|
// per module per routine initialization call
|
2017-08-10 19:10:34 +00:00
|
|
|
func (x SSHModule) PerRoutineInitialize() {
|
2017-08-07 21:51:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-08-10 19:10:34 +00:00
|
|
|
// Execute validates the options sent to SSHModule and then passes operation back to main
|
|
|
|
func (x *SSHModule) Validate(args []string) error {
|
2017-08-03 19:55:15 +00:00
|
|
|
zgrab2.RegisterLookup(x.Name, *x)
|
2017-08-01 23:13:28 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-08-10 19:10:34 +00:00
|
|
|
func (x SSHModule) Scan() (interface{}, error) {
|
2017-08-01 23:13:28 +00:00
|
|
|
return x, nil
|
|
|
|
}
|