mirror of
https://github.com/ffuf/ffuf
synced 2024-11-10 06:04:17 +00:00
Save POST body correctly (#161)
This commit is contained in:
parent
7fcef5a331
commit
a19741daa6
2 changed files with 8 additions and 1 deletions
|
@ -2,7 +2,9 @@
|
|||
|
||||
- master
|
||||
- New
|
||||
|
||||
- Changed
|
||||
- Write POST request data properly to file when ran with `-od`
|
||||
|
||||
- v1.0.1
|
||||
- Changed
|
||||
|
|
|
@ -87,6 +87,7 @@ func (r *SimpleRunner) Prepare(input map[string][]byte) (ffuf.Request, error) {
|
|||
func (r *SimpleRunner) Execute(req *ffuf.Request) (ffuf.Response, error) {
|
||||
var httpreq *http.Request
|
||||
var err error
|
||||
var rawreq []byte
|
||||
data := bytes.NewReader(req.Data)
|
||||
httpreq, err = http.NewRequest(req.Method, req.Url, data)
|
||||
if err != nil {
|
||||
|
@ -104,6 +105,11 @@ func (r *SimpleRunner) Execute(req *ffuf.Request) (ffuf.Response, error) {
|
|||
for k, v := range req.Headers {
|
||||
httpreq.Header.Set(k, v)
|
||||
}
|
||||
|
||||
if len(r.config.OutputDirectory) > 0 {
|
||||
rawreq, _ = httputil.DumpRequestOut(httpreq, true)
|
||||
}
|
||||
|
||||
httpresp, err := r.client.Do(httpreq)
|
||||
if err != nil {
|
||||
return ffuf.Response{}, err
|
||||
|
@ -123,7 +129,6 @@ func (r *SimpleRunner) Execute(req *ffuf.Request) (ffuf.Response, error) {
|
|||
}
|
||||
|
||||
if len(r.config.OutputDirectory) > 0 {
|
||||
rawreq, _ := httputil.DumpRequestOut(httpreq, true)
|
||||
rawresp, _ := httputil.DumpResponse(httpresp, true)
|
||||
resp.Request.Raw = string(rawreq)
|
||||
resp.Raw = string(rawresp)
|
||||
|
|
Loading…
Reference in a new issue