From 24ff11099c1f6b760057fed4edeec819c6f78156 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 10 May 2022 22:50:29 +0200 Subject: [PATCH] Improve new field on Event, and refactored the Protocol field with a Protocol enum --- protocols/secureShellStrategy.go | 2 +- tracer/tracer.go | 35 +++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/protocols/secureShellStrategy.go b/protocols/secureShellStrategy.go index 53a58fe..d7117ab 100644 --- a/protocols/secureShellStrategy.go +++ b/protocols/secureShellStrategy.go @@ -28,7 +28,7 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse tr.TraceEvent(tracer.Event{ Msg: "New SSH Session", - Protocol: beelzebubServiceConfiguration.Protocol, + Protocol: tracer.SSH, RemoteAddr: sess.RemoteAddr().String(), Status: tracer.Start, ID: uuidSession.String(), diff --git a/tracer/tracer.go b/tracer/tracer.go index 48dae24..27ec9e0 100644 --- a/tracer/tracer.go +++ b/tracer/tracer.go @@ -2,6 +2,7 @@ package tracer import ( log "github.com/sirupsen/logrus" + "net/http" ) type Tracer struct { @@ -19,18 +20,32 @@ func (tracer *Tracer) TraceEvent(event Event) { } type Event struct { - RemoteAddr string - Protocol string - Command string - Status Status - Msg string - ID string - Environ string - User string - Password string - Client string + RemoteAddr string + Protocol Protocol + Command string + Status Status + Msg string + ID string + Environ string + User string + Password string + Client string + Headers http.Header + Cookies []*http.Cookie + UserAgent string + HostHTTPRequest string + Body string + HTTPMethod string + RequestURI string } +type Protocol int + +const ( + HTTP Protocol = iota + SSH +) + type Status int const (