Configured Description filed into Event and Service configuration

This commit is contained in:
Mario
2022-05-31 22:39:56 +02:00
parent efefd0fb85
commit 25904ff751
4 changed files with 31 additions and 25 deletions

View File

@ -24,8 +24,8 @@ type Logging struct {
} }
type Tracing struct { type Tracing struct {
RabbitMQEnabled bool `yaml:"rabbitMQEnabled,omitempty"` RabbitMQEnabled bool `yaml:"rabbitMQEnabled"`
RabbitMQURI string `yaml:"rabbitMQURI,omitempty"` RabbitMQURI string `yaml:"rabbitMQURI"`
} }
type BeelzebubServiceConfiguration struct { type BeelzebubServiceConfiguration struct {
@ -37,6 +37,7 @@ type BeelzebubServiceConfiguration struct {
ServerName string `yaml:"serverName"` ServerName string `yaml:"serverName"`
DeadlineTimeoutSeconds int `yaml:"deadlineTimeoutSeconds"` DeadlineTimeoutSeconds int `yaml:"deadlineTimeoutSeconds"`
PasswordRegex string `yaml:"passwordRegex"` PasswordRegex string `yaml:"passwordRegex"`
Description string `yaml:"description"`
} }
type Command struct { type Command struct {

View File

@ -21,7 +21,7 @@ func (httpStrategy HypertextTransferProtocolStrategy) Init(beelzebubServiceConfi
serverMux := http.NewServeMux() serverMux := http.NewServeMux()
serverMux.HandleFunc("/", func(responseWriter http.ResponseWriter, request *http.Request) { serverMux.HandleFunc("/", func(responseWriter http.ResponseWriter, request *http.Request) {
traceRequest(request, tr) traceRequest(request, tr, beelzebubServiceConfiguration.Description)
for _, command := range httpStrategy.beelzebubServiceConfiguration.Commands { for _, command := range httpStrategy.beelzebubServiceConfiguration.Commands {
matched, err := regexp.MatchString(command.Regex, request.RequestURI) matched, err := regexp.MatchString(command.Regex, request.RequestURI)
if err != nil { if err != nil {
@ -51,7 +51,7 @@ func (httpStrategy HypertextTransferProtocolStrategy) Init(beelzebubServiceConfi
return nil return nil
} }
func traceRequest(request *http.Request, tr tracer.Tracer) { func traceRequest(request *http.Request, tr tracer.Tracer, HoneypotDescription string) {
bodyBytes, err := io.ReadAll(request.Body) bodyBytes, err := io.ReadAll(request.Body)
body := "" body := ""
if err == nil { if err == nil {
@ -70,6 +70,7 @@ func traceRequest(request *http.Request, tr tracer.Tracer) {
Status: tracer.Stateless.String(), Status: tracer.Stateless.String(),
RemoteAddr: request.RemoteAddr, RemoteAddr: request.RemoteAddr,
ID: uuid.New().String(), ID: uuid.New().String(),
Description: HoneypotDescription,
}) })
} }

View File

@ -34,6 +34,7 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse
ID: uuidSession.String(), ID: uuidSession.String(),
Environ: strings.Join(sess.Environ(), ","), Environ: strings.Join(sess.Environ(), ","),
User: sess.User(), User: sess.User(),
Description: beelzebubServiceConfiguration.Description,
}) })
term := terminal.NewTerminal(sess, buildPrompt(sess.User(), beelzebubServiceConfiguration.ServerName)) term := terminal.NewTerminal(sess, buildPrompt(sess.User(), beelzebubServiceConfiguration.ServerName))
@ -49,6 +50,7 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse
Command: commandInput, Command: commandInput,
ID: uuidSession.String(), ID: uuidSession.String(),
Protocol: tracer.SSH.String(), Protocol: tracer.SSH.String(),
Description: beelzebubServiceConfiguration.Description,
}) })
if commandInput == "exit" { if commandInput == "exit" {
break break
@ -82,6 +84,7 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse
Client: ctx.ClientVersion(), Client: ctx.ClientVersion(),
RemoteAddr: ctx.RemoteAddr().String(), RemoteAddr: ctx.RemoteAddr().String(),
ID: uuid.New().String(), ID: uuid.New().String(),
Description: beelzebubServiceConfiguration.Description,
}) })
matched, err := regexp.MatchString(beelzebubServiceConfiguration.PasswordRegex, password) matched, err := regexp.MatchString(beelzebubServiceConfiguration.PasswordRegex, password)
if err != nil { if err != nil {

View File

@ -40,6 +40,7 @@ type Event struct {
Body string Body string
HTTPMethod string HTTPMethod string
RequestURI string RequestURI string
Description string
} }
type Protocol int type Protocol int