From 973a06aa7537e74fffdc74629bd4b43e1c0140d9 Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Fri, 12 Dec 2014 22:09:34 -0800 Subject: [PATCH] whois_me fix, I hope. --- client.go | 4 ++-- server.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 618e63a..7cc7fce 100644 --- a/client.go +++ b/client.go @@ -146,9 +146,9 @@ func (c *Client) handleShell(channel ssh.Channel) { if len(parts) == 2 { client := c.Server.Who(parts[1]) if client != nil { - version := client.Conn.ClientVersion() + version := RE_STRIP_TEXT.ReplaceAllString(string(client.Conn.ClientVersion()), "") if len(version) > 100 { - version = []byte("Evil Jerk with a superlong string") + version = "Evil Jerk with a superlong string" } c.Msg <- fmt.Sprintf("-> %s is %s via %s", client.Name, client.Fingerprint(), version) } else { diff --git a/server.go b/server.go index 75d832a..11bd2ff 100644 --- a/server.go +++ b/server.go @@ -15,7 +15,7 @@ import ( const MAX_NAME_LENGTH = 32 const HISTORY_LEN = 20 -var RE_STRIP_NAME = regexp.MustCompile("[^0-9A-Za-z_]") +var RE_STRIP_TEXT = regexp.MustCompile("[^0-9A-Za-z_]") type Clients map[string]*Client @@ -113,7 +113,7 @@ func (s *Server) Remove(client *Client) { func (s *Server) proposeName(name string) (string, error) { // Assumes caller holds lock. var err error - name = RE_STRIP_NAME.ReplaceAllString(name, "") + name = RE_STRIP_TEXT.ReplaceAllString(name, "") if len(name) > MAX_NAME_LENGTH { name = name[:MAX_NAME_LENGTH] @@ -240,9 +240,9 @@ func (s *Server) Start(laddr string) error { return } - version := sshConn.ClientVersion() + version := RE_STRIP_TEXT.ReplaceAllString(string(sshConn.ClientVersion()), "") if len(version) > 100 { - version = []byte("Evil Jerk with a superlong string") + version = "Evil Jerk with a superlong string" } logger.Infof("Connection #%d from: %s, %s, %s", s.count+1, sshConn.RemoteAddr(), sshConn.User(), version)