MCPcopy Index your code
hub / github.com/devploit/nomore403 / requestMethodOverrideQuery

Function requestMethodOverrideQuery

cmd/requester.go:2894–2934  ·  view source on GitHub ↗

requestMethodOverrideQuery tests _method query parameter override. Many web frameworks (Rails, Laravel, etc.) support overriding the HTTP method via a _method query parameter when the request is POST.

(options RequestOptions)

Source from the content-addressed store, hash-verified

2892// Many web frameworks (Rails, Laravel, etc.) support overriding the HTTP method
2893// via a _method query parameter when the request is POST.
2894func requestMethodOverrideQuery(options RequestOptions) {
2895 overrideMethods := []string{"GET", "PUT", "PATCH", "DELETE", "OPTIONS"}
2896
2897 w := goccm.New(maxGoroutines)
2898 p := newProgress("method-override-query", len(overrideMethods))
2899
2900 for _, overrideMethod := range overrideMethods {
2901 time.Sleep(time.Duration(delay) * time.Millisecond)
2902 w.Wait()
2903 go func(overrideMethod string) {
2904 defer w.Done()
2905 defer p.done()
2906
2907 // Append _method= query parameter
2908 separator := "?"
2909 if strings.Contains(options.uri, "?") {
2910 separator = "&"
2911 }
2912 targetURI := options.uri + separator + "_method=" + overrideMethod
2913
2914 // Send as POST (frameworks only process _method on POST)
2915 resp, err := requestWithRetry("POST", targetURI, options.headers, options.proxy, options.rateLimit, options.timeout, options.redirect)
2916 if err != nil {
2917 if errors.Is(err, ErrRateLimited) {
2918 return
2919 }
2920 logVerbose(err)
2921 return
2922 }
2923
2924 if isCalibrationMatch(resp.contentLength) {
2925 return
2926 }
2927 result := resultFromResponse("POST "+targetURI, false, "method-override-query", resp)
2928 attachHTTPReplay(&result, "POST", targetURI, options.headers, "", options.redirect, options.proxy, options.timeout)
2929 printResponse(result, "method-override-query")
2930 }(overrideMethod)
2931 }
2932 w.WaitAllDone()
2933 p.finish()
2934}
2935
2936func requestMethodOverrideHeaders(options RequestOptions) {
2937 overrideMethods := []string{"GET", "PUT", "PATCH", "DELETE", "OPTIONS"}

Calls 9

newProgressFunction · 0.85
requestWithRetryFunction · 0.85
logVerboseFunction · 0.85
isCalibrationMatchFunction · 0.85
resultFromResponseFunction · 0.85
attachHTTPReplayFunction · 0.85
printResponseFunction · 0.85
doneMethod · 0.80
finishMethod · 0.80