1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-23 15:44:16 +03:00

Merge pull request #837 from gamagoat/mask-pass

Mask password in logs
This commit is contained in:
Zack 2024-11-12 18:25:49 -08:00 committed by GitHub
commit d616b8fff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,7 +76,17 @@ func Run(debugLevel, host, port, password string, banner ...string) (err error)
func (s *server) start() (err error) {
log.SetLevel(s.debugLevel)
log.Debugf("starting with password '%s'", s.password)
// Mask our password in logs
maskedPassword := ""
if len(s.password) > 2 {
maskedPassword = fmt.Sprintf("%c***%c", s.password[0], s.password[len(s.password)-1])
} else {
maskedPassword = s.password
}
log.Debugf("starting with password '%s'", maskedPassword)
s.rooms.Lock()
s.rooms.rooms = make(map[string]roomInfo)
s.rooms.Unlock()