requestMethods makes HTTP requests using a list of methods from a file and prints the results.
(options RequestOptions)
| 1706 | |
| 1707 | // requestMethods makes HTTP requests using a list of methods from a file and prints the results. |
| 1708 | func requestMethods(options RequestOptions) { |
| 1709 | lines, err := parseFile(options.folder + "/httpmethods") |
| 1710 | if err != nil { |
| 1711 | log.Printf("[!] Skipping verb tampering: %v", err) |
| 1712 | return |
| 1713 | } |
| 1714 | if len(lines) == 0 { |
| 1715 | return |
| 1716 | } |
| 1717 | |
| 1718 | w := goccm.New(maxGoroutines) |
| 1719 | var verbTamperingResultsMutex = &sync.Mutex{} |
| 1720 | p := newProgress("verb-tampering", len(lines)) |
| 1721 | |
| 1722 | for _, line := range lines { |
| 1723 | time.Sleep(time.Duration(delay) * time.Millisecond) |
| 1724 | w.Wait() |
| 1725 | go func(line string) { |
| 1726 | defer w.Done() |
| 1727 | defer p.done() |
| 1728 | resp, err := requestWithRetry(line, options.uri, options.headers, options.proxy, options.rateLimit, options.timeout, options.redirect) |
| 1729 | if err != nil { |
| 1730 | if errors.Is(err, ErrRateLimited) { |
| 1731 | log.Printf("[!] Rate limited, stopping verb tampering") |
| 1732 | return |
| 1733 | } |
| 1734 | logVerbose(err) |
| 1735 | return |
| 1736 | } |
| 1737 | |
| 1738 | contentLength := resp.contentLength |
| 1739 | |
| 1740 | verbTamperingResultsMutex.Lock() |
| 1741 | verbTamperingResults[line] = contentLength |
| 1742 | verbTamperingResultsMutex.Unlock() |
| 1743 | |
| 1744 | if isCalibrationMatch(contentLength) { |
| 1745 | return |
| 1746 | } |
| 1747 | |
| 1748 | result := resultFromResponse(line, false, "verb-tampering", resp) |
| 1749 | attachHTTPReplay(&result, line, options.uri, options.headers, "", options.redirect, options.proxy, options.timeout) |
| 1750 | printResponse(result, "verb-tampering") |
| 1751 | }(line) |
| 1752 | } |
| 1753 | w.WaitAllDone() |
| 1754 | p.finish() |
| 1755 | } |
| 1756 | |
| 1757 | // requestMethodsCaseSwitching makes HTTP requests using a list of methods from a file and prints the results. |
| 1758 | func requestMethodsCaseSwitching(options RequestOptions) { |