func baseAlertMap(metadata ssh.ConnMetadata) map[string]string { meta := make(map[string]string) meta["service"] = "ssh" meta["user"] = metadata.User() meta["remote"] = metadata.RemoteAddr().String() meta["local"] = metadata.LocalAddr().String() return meta }
/* victimName returns the name of the victim (honeypot) */ func victimName(c ssh.ConnMetadata) string { /* Used a cached value */ if "" != ourName { return ourName } /* Try the hostname first */ h, err := os.Hostname() if nil != err { verbose("Unable to determine hostname: %v", err) /* Failing that, use the local address */ return c.LocalAddr().String() } ourName = h return ourName }