MCPcopy Create free account
hub / github.com/devploit/nomore403 / curlRequest

Function curlRequest

cmd/requester.go:2558–2574  ·  view source on GitHub ↗
(args []string, httpVersion string, timeout int)

Source from the content-addressed store, hash-verified

2556}
2557
2558func curlRequest(args []string, httpVersion string, timeout int) Result {
2559 if len(args) == 0 {
2560 return Result{}
2561 }
2562
2563 ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Millisecond)
2564 defer cancel()
2565
2566 cmd := exec.CommandContext(ctx, "curl", args...)
2567 out, err := cmd.Output()
2568 if err != nil {
2569 log.Printf("[!] Curl command failed: %v", err)
2570 return Result{}
2571 }
2572
2573 return parseCurlOutput(string(out), httpVersion)
2574}
2575
2576func parseCurlOutput(output string, httpVersion string) Result {
2577 httpVersionOutput := strings.ReplaceAll(httpVersion, "--http", "HTTP/")

Callers 2

requestHttpVersionsFunction · 0.85
requestHTTPParserFunction · 0.85

Calls 1

parseCurlOutputFunction · 0.85

Tested by

no test coverage detected