Skip to content

Commit

Permalink
fixing issue with httpx profile for query params
Browse files Browse the repository at this point in the history
  • Loading branch information
its-a-feature committed Oct 4, 2024
1 parent b2f0841 commit f2ea7f0
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,14 +768,15 @@ func (c *C2HTTPx) CreateDynamicMessage(content []byte, isGetTaskingRequest bool)
utils.PrintDebug(fmt.Sprintf("Error creating new http request: %s", err.Error()))
return nil, err
}
q := req.URL.Query()
switch variation.Client.Message.Location {
case "cookie":
req.AddCookie(&http.Cookie{
Name: variation.Client.Message.Name,
Value: string(agentMessageBytes),
})
case "query":
req.Form.Set(variation.Client.Message.Name, string(agentMessageBytes))
q.Add(variation.Client.Message.Name, string(agentMessageBytes))
case "header":
req.Header.Set(variation.Client.Message.Name, string(agentMessageBytes))
default:
Expand All @@ -795,13 +796,11 @@ func (c *C2HTTPx) CreateDynamicMessage(content []byte, isGetTaskingRequest bool)
}
}
// adding query parameters is a little weird in go
q := req.URL.Query()

for key, _ := range variation.Client.Parameters {
q.Add(key, variation.Client.Parameters[key])
}
if len(variation.Client.Parameters) > 0 {
req.URL.RawQuery = q.Encode()
}
req.URL.RawQuery = q.Encode()
return req, nil
}
func (c *C2HTTPx) GetDynamicMessageResponse(resp *http.Response, isGetTaskingRequest bool) ([]byte, error) {
Expand Down

0 comments on commit f2ea7f0

Please sign in to comment.