mirror of
https://github.com/mariocandela/beelzebub.git
synced 2025-07-01 18:47:26 -04:00
Configured Description filed into Event and Service configuration
This commit is contained in:
@ -24,8 +24,8 @@ type Logging struct {
|
||||
}
|
||||
|
||||
type Tracing struct {
|
||||
RabbitMQEnabled bool `yaml:"rabbitMQEnabled,omitempty"`
|
||||
RabbitMQURI string `yaml:"rabbitMQURI,omitempty"`
|
||||
RabbitMQEnabled bool `yaml:"rabbitMQEnabled"`
|
||||
RabbitMQURI string `yaml:"rabbitMQURI"`
|
||||
}
|
||||
|
||||
type BeelzebubServiceConfiguration struct {
|
||||
@ -37,6 +37,7 @@ type BeelzebubServiceConfiguration struct {
|
||||
ServerName string `yaml:"serverName"`
|
||||
DeadlineTimeoutSeconds int `yaml:"deadlineTimeoutSeconds"`
|
||||
PasswordRegex string `yaml:"passwordRegex"`
|
||||
Description string `yaml:"description"`
|
||||
}
|
||||
|
||||
type Command struct {
|
||||
|
@ -21,7 +21,7 @@ func (httpStrategy HypertextTransferProtocolStrategy) Init(beelzebubServiceConfi
|
||||
serverMux := http.NewServeMux()
|
||||
|
||||
serverMux.HandleFunc("/", func(responseWriter http.ResponseWriter, request *http.Request) {
|
||||
traceRequest(request, tr)
|
||||
traceRequest(request, tr, beelzebubServiceConfiguration.Description)
|
||||
for _, command := range httpStrategy.beelzebubServiceConfiguration.Commands {
|
||||
matched, err := regexp.MatchString(command.Regex, request.RequestURI)
|
||||
if err != nil {
|
||||
@ -51,7 +51,7 @@ func (httpStrategy HypertextTransferProtocolStrategy) Init(beelzebubServiceConfi
|
||||
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)
|
||||
body := ""
|
||||
if err == nil {
|
||||
@ -70,6 +70,7 @@ func traceRequest(request *http.Request, tr tracer.Tracer) {
|
||||
Status: tracer.Stateless.String(),
|
||||
RemoteAddr: request.RemoteAddr,
|
||||
ID: uuid.New().String(),
|
||||
Description: HoneypotDescription,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,14 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse
|
||||
uuidSession := uuid.New()
|
||||
|
||||
tr.TraceEvent(tracer.Event{
|
||||
Msg: "New SSH Session",
|
||||
Protocol: tracer.SSH.String(),
|
||||
RemoteAddr: sess.RemoteAddr().String(),
|
||||
Status: tracer.Start.String(),
|
||||
ID: uuidSession.String(),
|
||||
Environ: strings.Join(sess.Environ(), ","),
|
||||
User: sess.User(),
|
||||
Msg: "New SSH Session",
|
||||
Protocol: tracer.SSH.String(),
|
||||
RemoteAddr: sess.RemoteAddr().String(),
|
||||
Status: tracer.Start.String(),
|
||||
ID: uuidSession.String(),
|
||||
Environ: strings.Join(sess.Environ(), ","),
|
||||
User: sess.User(),
|
||||
Description: beelzebubServiceConfiguration.Description,
|
||||
})
|
||||
|
||||
term := terminal.NewTerminal(sess, buildPrompt(sess.User(), beelzebubServiceConfiguration.ServerName))
|
||||
@ -43,12 +44,13 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse
|
||||
break
|
||||
}
|
||||
tr.TraceEvent(tracer.Event{
|
||||
Msg: "New SSH Command",
|
||||
RemoteAddr: sess.RemoteAddr().String(),
|
||||
Status: tracer.Interaction.String(),
|
||||
Command: commandInput,
|
||||
ID: uuidSession.String(),
|
||||
Protocol: tracer.SSH.String(),
|
||||
Msg: "New SSH Command",
|
||||
RemoteAddr: sess.RemoteAddr().String(),
|
||||
Status: tracer.Interaction.String(),
|
||||
Command: commandInput,
|
||||
ID: uuidSession.String(),
|
||||
Protocol: tracer.SSH.String(),
|
||||
Description: beelzebubServiceConfiguration.Description,
|
||||
})
|
||||
if commandInput == "exit" {
|
||||
break
|
||||
@ -74,14 +76,15 @@ func (SSHStrategy *SecureShellStrategy) Init(beelzebubServiceConfiguration parse
|
||||
},
|
||||
PasswordHandler: func(ctx ssh.Context, password string) bool {
|
||||
tr.TraceEvent(tracer.Event{
|
||||
Msg: "New SSH attempt",
|
||||
Protocol: tracer.SSH.String(),
|
||||
Status: tracer.Stateless.String(),
|
||||
User: ctx.User(),
|
||||
Password: password,
|
||||
Client: ctx.ClientVersion(),
|
||||
RemoteAddr: ctx.RemoteAddr().String(),
|
||||
ID: uuid.New().String(),
|
||||
Msg: "New SSH attempt",
|
||||
Protocol: tracer.SSH.String(),
|
||||
Status: tracer.Stateless.String(),
|
||||
User: ctx.User(),
|
||||
Password: password,
|
||||
Client: ctx.ClientVersion(),
|
||||
RemoteAddr: ctx.RemoteAddr().String(),
|
||||
ID: uuid.New().String(),
|
||||
Description: beelzebubServiceConfiguration.Description,
|
||||
})
|
||||
matched, err := regexp.MatchString(beelzebubServiceConfiguration.PasswordRegex, password)
|
||||
if err != nil {
|
||||
|
@ -40,6 +40,7 @@ type Event struct {
|
||||
Body string
|
||||
HTTPMethod string
|
||||
RequestURI string
|
||||
Description string
|
||||
}
|
||||
|
||||
type Protocol int
|
||||
|
Reference in New Issue
Block a user