Skip to content

Commit 1a67fec

Browse files
Initial commit
ref: ShutdownRepo/httpmethods#8
0 parents  commit 1a67fec

19 files changed

+2321
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
bin/
8+
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
16+
# Dependency directories (remove the comment below to include it)
17+
# vendor/
18+
19+
# Go workspace file
20+
go.work
21+
22+
# IDE-specific files
23+
.idea/
24+
.vscode/
25+
*.swp
26+
*.swo
27+
28+
# Build outputs
29+
dist/
30+
31+
# Local configuration
32+
*.local
33+
34+
# Logs
35+
*.log

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 GoHTTPProbe Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
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+
![run](run.png)
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

cmd/ghp/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/byte/gohttpprobe/internal/app"
8+
)
9+
10+
func main() {
11+
if err := app.Execute(); err != nil {
12+
_, _ = fmt.Fprintf(os.Stderr, "Error: %v\n", err)
13+
os.Exit(1)
14+
}
15+
}

go.mod

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module github.com/byte/gohttpprobe
2+
3+
go 1.22.2
4+
5+
require github.com/spf13/cobra v1.9.1
6+
7+
require (
8+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
9+
github.com/spf13/pflag v1.0.6 // indirect
10+
)

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
2+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
5+
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
6+
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
7+
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
8+
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)