|
| 1 | +# GoHTTPProbe |
| 2 | + |
| 3 | +GoHTTPProbe is a modern HTTP methods testing tool written in Go. It allows you to test various HTTP methods against a URL to discover HTTP verb tampering vulnerabilities and "dangerous" HTTP methods. |
| 4 | + |
| 5 | +This tool is a reimplementation of the Python [HTTPMethods](https://github.com/ShutdownRepo/httpmethods) utility, as there were difficulties getting it to work in modern python environments and because I just like go :) |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Test multiple HTTP methods against target URLs |
| 10 | +- Detect supported and potentially dangerous HTTP methods |
| 11 | +- Automatic discovery of server-supported methods via OPTIONS request |
| 12 | +- Concurrent request handling for fast results |
| 13 | +- Support for custom headers and cookies |
| 14 | +- Option to read target URLs from a file |
| 15 | +- JSON export for results |
| 16 | +- Low dependencies and simple installation |
| 17 | + |
| 18 | +## Installation |
| 19 | + |
| 20 | +If you have Go installed, you may use: |
| 21 | + |
| 22 | +```sh |
| 23 | +go install github.com/byte/gohttpprobe/cmd/ghp@latest |
| 24 | +``` |
| 25 | + |
| 26 | +### From Source |
| 27 | + |
| 28 | +```sh |
| 29 | +# Clone the repository |
| 30 | +git clone https://github.com/ByteSizedMarius/GoHTTPProbe |
| 31 | +cd GoHTTPProbe |
| 32 | + |
| 33 | +# Option 1: Build the binary |
| 34 | +go build -o ghp ./cmd/ghp |
| 35 | +# This builds a binary named 'ghp' in the current directory |
| 36 | + |
| 37 | +# Option 2: Install to your GOPATH/bin |
| 38 | +go install ./cmd/ghp |
| 39 | +# This installs the binary named 'ghp' to your GOPATH/bin directory |
| 40 | +``` |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +**Basic usage:** |
| 45 | + |
| 46 | +```sh |
| 47 | +ghp -u example.com |
| 48 | +``` |
| 49 | + |
| 50 | +If no protocol is specified, `https://` is used. |
| 51 | + |
| 52 | +**Full options:** |
| 53 | + |
| 54 | +``` |
| 55 | +[~] GoHTTPProbe - HTTP Methods Tester v0.0.1 |
| 56 | +
|
| 57 | +Usage: ghp -u URL [options] |
| 58 | +
|
| 59 | +Options: |
| 60 | + # Target selection: |
| 61 | + -u, --url string Target URL (e.g., https://example.com:port/path) |
| 62 | + -i, --input string Read target URLs from a file (one per line) |
| 63 | +
|
| 64 | + # Output control: |
| 65 | + -v, --verbose Enable verbose output |
| 66 | + -q, --quiet Show no information at all |
| 67 | + -o, --output string Save results to specified JSON file |
| 68 | +
|
| 69 | + # Connection options: |
| 70 | + -k, --insecure Allow insecure server connections (skip SSL verification) |
| 71 | + -f, --follow Follow redirects |
| 72 | + -p, --proxy string Use proxy for connections (e.g., http://localhost:8080) |
| 73 | + -n, --concurrent int Number of concurrent requests (default: 5) |
| 74 | + -t, --timeout int Timeout in seconds for HTTP requests (default: 10) |
| 75 | +
|
| 76 | + # Request customization: |
| 77 | + -H, --header strings Headers to include (e.g., -H "User-Agent: test" or -H headers.txt) |
| 78 | + -b, --cookies string Cookies to use (e.g., -b "session=abc" or -b cookies.txt) |
| 79 | + -c, --cookie-jar string Write received cookies to specified file |
| 80 | + -A, --user-agent string User-Agent string to send |
| 81 | +
|
| 82 | + # Method testing options: |
| 83 | + -s, --safe-only Only test safe methods (exclude PUT, DELETE, etc.) |
| 84 | + -m, --methods string Custom HTTP methods wordlist file |
| 85 | +``` |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +### Examples |
| 90 | + |
| 91 | +Test a single URL: |
| 92 | +```sh |
| 93 | +ghp -u example.com |
| 94 | +``` |
| 95 | + |
| 96 | +Test with custom headers: |
| 97 | +```sh |
| 98 | +ghp -u example.com -H "User-Agent: MyCustomAgent" -H "Authorization: Bearer token123" |
| 99 | +``` |
| 100 | + |
| 101 | +Test with headers from a file: |
| 102 | +```sh |
| 103 | +ghp -u example.com -H headers.txt |
| 104 | +``` |
| 105 | + |
| 106 | +Test with cookies: |
| 107 | +```sh |
| 108 | +ghp -u example.com -b "session=abc123; token=xyz456" |
| 109 | +``` |
| 110 | + |
| 111 | +Test multiple URLs from a file: |
| 112 | +```sh |
| 113 | +ghp -i urls.txt |
| 114 | +``` |
| 115 | + |
| 116 | +Save results to JSON: |
| 117 | +```sh |
| 118 | +ghp -u example.com -o results.json |
| 119 | +``` |
| 120 | + |
| 121 | +Only test safe methods: |
| 122 | +```sh |
| 123 | +ghp -u example.com --safe-only |
| 124 | +``` |
| 125 | + |
| 126 | +Use custom HTTP methods list: |
| 127 | +```sh |
| 128 | +ghp -u example.com -m custom-methods.txt |
| 129 | +``` |
| 130 | + |
| 131 | +Set concurrency level for faster testing: |
| 132 | +```sh |
| 133 | +ghp -u example.com -n 10 |
| 134 | +``` |
| 135 | + |
| 136 | +## Attribution |
| 137 | + |
| 138 | +This project is based on the [HTTPMethods](https://github.com/ShutdownRepo/httpmethods) Python utility by ShutdownRepo. |
| 139 | + |
| 140 | +## Notes |
| 141 | + |
| 142 | +### Terminal Colors |
| 143 | + |
| 144 | +The tool uses ANSI escape sequences for colorized output in the terminal: |
| 145 | +- Green: 200 OK responses |
| 146 | +- Cyan: 3xx redirection responses |
| 147 | +- Red: 4xx client error responses |
| 148 | +- Yellow: 5xx server error responses |
| 149 | + |
| 150 | +Colors may not display correctly in all terminals, particularly on Windows command prompt. Consider using a terminal that supports ANSI colors like Windows Terminal, PowerShell, or WSL. |
| 151 | + |
| 152 | +### Default Wordlist |
| 153 | + |
| 154 | +The tool includes a default wordlist of HTTP methods to test located at `wordlists/default.txt`. You can specify your own wordlist using the `-m` flag. |
| 155 | + |
| 156 | +### OPTIONS Request |
| 157 | + |
| 158 | +By default, the tool sends an OPTIONS request to the target server to discover additional supported HTTP methods, which are then added to the test list. This helps in finding methods that might not be in the default wordlist but are supported by the server. |
| 159 | + |
| 160 | +### Dangerous Methods |
| 161 | + |
| 162 | +By default, the tool tests all HTTP methods, including potentially dangerous ones like PUT, DELETE, etc. These methods could modify server content if the server allows them. Use the `--safe-only` flag to exclude these methods from testing. |
| 163 | + |
| 164 | +The following methods are considered potentially dangerous: |
| 165 | +- DELETE - Can delete resources on the server |
| 166 | +- PUT - Can create or replace resources on the server |
| 167 | +- PATCH - Can modify resources on the server |
| 168 | +- COPY - Can copy resources on the server |
| 169 | +- UNCHECKOUT - Can affect version control on the server |
| 170 | + |
| 171 | +### Method Selection |
| 172 | + |
| 173 | +The default list of HTTP methods tested is based on the original Python implementation, with some common methods that might be useful for security testing. Alternative wordlists are available: |
| 174 | + |
| 175 | +- Default wordlist: `wordlists/default.txt` |
| 176 | +- Burp Suite methods: `wordlists/burp.txt` - A more comprehensive list of methods used by Burp Suite |
| 177 | + |
| 178 | +You can use these wordlists with the `-m` flag: |
| 179 | + |
| 180 | +```sh |
| 181 | +ghp -u example.com -m wordlists/burp.txt |
| 182 | +``` |
| 183 | + |
| 184 | +You can also create your own custom wordlist file with HTTP methods and use it with the `-m` flag. |
| 185 | + |
| 186 | +## Development |
| 187 | + |
| 188 | +### Running Tests |
| 189 | + |
| 190 | +Run all tests: |
| 191 | +```sh |
| 192 | +go test ./... |
| 193 | +``` |
| 194 | + |
| 195 | +Run tests with verbose output: |
| 196 | +```sh |
| 197 | +go test -v ./... |
| 198 | +``` |
| 199 | + |
| 200 | +Check test coverage: |
| 201 | +```sh |
| 202 | +go test -cover ./... |
| 203 | +``` |
| 204 | + |
| 205 | +Generate a detailed coverage report: |
| 206 | +```sh |
| 207 | +go test -coverprofile=coverage.out ./... |
| 208 | +go tool cover -html=coverage.out |
| 209 | +``` |
| 210 | + |
| 211 | +## License |
| 212 | + |
| 213 | +MIT License |
0 commit comments