Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user: format clientRandom string in gotls module #557

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions user/module/probe_gotls.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,28 +242,30 @@ func (g *GoTLSProbe) saveMasterSecret(secretEvent *event.MasterSecretGotlsEvent)
return
}

// TODO 保存多个lable 整组里???
// 保存到多个lable 整组里
// save to file
var b string
var b, cr string
var e error
b = fmt.Sprintf("%s %02x %02x\n", label, clientRandom, secret)
cr = fmt.Sprintf("%02x", clientRandom)
b = fmt.Sprintf("%s %s %02x\n", label, cr, secret)

switch g.eBPFProgramType {
case TlsCaptureModelTypeKeylog:
var l int
l, e = g.keylogger.WriteString(b)
if e != nil {
g.logger.Warn().Err(e).Str("clientRandom", clientRandom).Msg("save masterSecrets to keylog error")
g.logger.Warn().Err(e).Str("clientRandom", cr).Msg("save masterSecrets to keylog error")
return
}
g.logger.Info().Str("clientRandom", clientRandom).Str("label", label).Int("bytes", l).Msg("save CLIENT_RANDOM success")
g.logger.Info().Str("clientRandom", cr).Str("label", label).Int("bytes", l).Msg("save CLIENT_RANDOM success")
case TlsCaptureModelTypePcap:
e = g.savePcapngSslKeyLog([]byte(b))
if e != nil {
g.logger.Warn().Err(e).Str("clientRandom", clientRandom).Msg("save masterSecrets to pcapNG error")
g.logger.Warn().Err(e).Str("clientRandom", cr).Msg("save masterSecrets to pcapNG error")
return
}
default:
g.logger.Warn().Str("clientRandom", clientRandom).Uint8("eBPFProgramType", uint8(g.eBPFProgramType)).Msg("unhandled default case with eBPF Program type")
g.logger.Warn().Str("clientRandom", cr).Uint8("eBPFProgramType", uint8(g.eBPFProgramType)).Msg("unhandled default case with eBPF Program type")
}
}

Expand Down
Loading