requestHttpVersions makes HTTP requests using a list of HTTP versions from a file and prints the results.
(options RequestOptions)
| 2453 | |
| 2454 | // requestHttpVersions makes HTTP requests using a list of HTTP versions from a file and prints the results. |
| 2455 | func requestHttpVersions(options RequestOptions) { |
| 2456 | if !isCurlAvailable() { |
| 2457 | log.Printf("[!] Skipping HTTP versions technique: curl not found in PATH") |
| 2458 | return |
| 2459 | } |
| 2460 | |
| 2461 | httpVersions := []string{"--http1.0", "--http2"} |
| 2462 | proxyValue := "" |
| 2463 | if options.proxy != nil { |
| 2464 | proxyValue = options.proxy.String() |
| 2465 | } |
| 2466 | |
| 2467 | baselineArgs, _ := buildCurlVersionInvocation(options.method, options.uri, options.headers, proxyValue, "--http1.1", options.redirect) |
| 2468 | baselineResult := curlRequest(baselineArgs, "--http1.1", options.timeout) |
| 2469 | if baselineResult.statusCode != 0 { |
| 2470 | setTechniqueBaseline("http-versions", responseInfoFromResult(baselineResult)) |
| 2471 | } |
| 2472 | |
| 2473 | for _, version := range httpVersions { |
| 2474 | args, display := buildCurlVersionInvocation(options.method, options.uri, options.headers, proxyValue, version, options.redirect) |
| 2475 | res := curlRequest(args, version, options.timeout) |
| 2476 | attachCurlReplay(&res, args, display, options.timeout) |
| 2477 | printResponse(res, "http-versions") |
| 2478 | } |
| 2479 | } |
| 2480 | |
| 2481 | func requestHTTPParser(options RequestOptions) { |
| 2482 | if !isCurlAvailable() { |
no test coverage detected