Skip to content

Commit

Permalink
steps
Browse files Browse the repository at this point in the history
  • Loading branch information
cn-kali-team committed Oct 22, 2024
1 parent d6b989a commit bf792d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (iwe *InternalWrappedEvent) SetOperatorResult(operatorResult *operators.Res
iwe.OperatorsResult = operatorResult
}

type RequestResponse struct {
type Steps struct {
// Request is the optional, dumped request for the match.
Request string `json:"request,omitempty"`
// Response is the optional, dumped response for the match.
Expand Down Expand Up @@ -178,7 +178,7 @@ type ResultEvent struct {
// Response is the optional, dumped response for the match.
Response string `json:"response,omitempty"`
// Storage request and response list.
RequestResponse []RequestResponse `json:"request_response,omitempty"`
Steps []Steps `json:"steps,omitempty"`
// Metadata contains any optional metadata for the event
Metadata map[string]interface{} `json:"meta,omitempty"`
// IP is the IP address for the found result event.
Expand Down Expand Up @@ -298,7 +298,7 @@ func (w *StandardWriter) Write(event *ResultEvent) error {
event.Matched = redactKeys(event.Matched, w.KeysToRedact)
}
if !w.includeChain {
event.RequestResponse = make([]RequestResponse, 0)
event.Steps = make([]Steps, 0)
}
event.Timestamp = time.Now()

Expand Down
8 changes: 4 additions & 4 deletions pkg/protocols/common/helpers/writer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ func WriteResult(data *output.InternalWrappedEvent, outputs output.Writer, progr
return false
}
var matched bool
request_response := make([]output.RequestResponse, 0)
steps := make([]output.Steps, 0)
if types, ok := data.InternalEvent["type"]; ok {
switch types.(string) {
case "dns":
request, request_ok := data.InternalEvent["request"]
response, response_ok := data.InternalEvent["raw"]
if request_ok && response_ok {
request_response = append(request_response, output.RequestResponse{Request: fmt.Sprintf("%v", request), Response: fmt.Sprintf("%v", response)})
steps = append(steps, output.Steps{Request: fmt.Sprintf("%v", request), Response: fmt.Sprintf("%v", response)})
}
case "http":
index := 0
Expand All @@ -37,7 +37,7 @@ func WriteResult(data *output.InternalWrappedEvent, outputs output.Writer, progr
if !request_ok || !response_ok {
break
}
request_response = append(request_response, output.RequestResponse{Request: request.(string), Response: response.(string)})
steps = append(steps, output.Steps{Request: request.(string), Response: response.(string)})
if index > 10 {
break
}
Expand All @@ -47,7 +47,7 @@ func WriteResult(data *output.InternalWrappedEvent, outputs output.Writer, progr
}
}
for _, result := range data.Results {
result.RequestResponse = request_response
result.Steps = steps
if issuesClient != nil {
if err := issuesClient.CreateIssue(result); err != nil {
gologger.Warning().Msgf("Could not create issue on tracker: %s", err)
Expand Down

0 comments on commit bf792d1

Please sign in to comment.