Skip to content

Commit

Permalink
Fix some typos, add nobanner option and improve visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
devploit committed May 28, 2023
1 parent 6a13ee2 commit 6e52e2e
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ builds:
- -s -w -X main.Version={{.Version}} -X main.BuildDate={{.CommitDate}}
ignore:
- goos: darwin
goarch: 386
goarch: i386
- goos: windows
goarch: arm64

Expand Down
44 changes: 41 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ Usage:
dontgo403 [flags]

Flags:
-b, --bypassIp string Try bypass tests with a specific IP address (or hostname). i.e.: 'X-Forwarded-For: 192.168.0.1' instead of 'X-Forwarded-For: 127.0.0.1'
-d, --delay int Set a delay (in ms) between each request. Default: 0ms
-i, --bypassIp string Try bypass tests with a specific IP address (or hostname). i.e.: 'X-Forwarded-For: 192.168.0.1' instead of 'X-Forwarded-For: 127.0.0.1'
-d, --delay int Set a delay (in ms) between each request (default 0ms)
-f, --folder string Define payloads folder (if it's not in the same path as binary)
-H, --header strings Add a custom header to the requests (can be specified multiple times)
-h, --help help for dontgo403
--http Set HTTP schema for request-file requests (default HTTPS)
-t, --httpMethod string HTTP method to use (default 'GET')
-m, --max_goroutines int Set the max number of goroutines working at same time. Default: 50 (default 50)
-m, --max_goroutines int Set the max number of goroutines working at same time (default 50)
--nobanner Set nobanner ON (default OFF)
-p, --proxy string Proxy URL. For example: http://127.0.0.1:8080
-r, --request-file string Path to request file to load flags from
-u, --uri string Target URL
Expand All @@ -46,6 +47,43 @@ Flags:
### Usage
Output example:
```bash
.#%%: -#%%%*. +#%%#+.
=@*#@: =@+ .%%.:+- =@*
:::. ... .#@= *@: *@: *@: :##%@-
:::. :::. .. -:..-. .. :: =%%%%@@%:=@*. :%% =*- :@%
.::::::::::. .::::::. .:::::::::. ::::::::. .:::::::::. .=::..:==-=+++:. +#. -*#%#+. =*###+.
.:::....::::. .:::....:::. .::::...:::. ..::::.. ::::....::: --::..-=+*=:.
:::. :::. :::. .::: .::: .::: :::. :::: .::: -=::-*#+=:
:::: .:::. :::: :::: .::: .::: :::. .:::. :::. +-:::=::.
:::::.:::::. ::::..:::: .::: .::: .:::.:. .:::::::::. .+=:::::.
..::::.::: ..::::.. .::: ::: ..:::. .....::::. -=:.::
.::: ::::
:::::..::::.
Target: https://domain.com/admin
Headers: false
User Agent: dontgo403
Proxy: false
Method: GET
Payloads folder: payloads
Custom bypass IP: false
Verbose: false
━━━━━━━━━━━━━ DEFAULT REQUEST ━━━━━━━━━━━━━
403 429 bytes https://domain.com/admin
━━━━━━━━━━━━━ VERB TAMPERING ━━━━━━━━━━━━━━
━━━━━━━━━━━━━ HEADERS ━━━━━━━━━━━━━━━━━━━━━
━━━━━━━━━━━━━ CUSTOM PATHS ━━━━━━━━━━━━━━━━
200 2047 bytes https://domain.com/;///..admin
━━━━━━━━━━━━━ CASE SWITCHING ━━━━━━━━━━━━━━
200 2047 bytes https://domain.com/%61dmin
```
Basic usage:
```bash
./dontgo403 -u https://domain.com/admin
Expand Down
29 changes: 20 additions & 9 deletions cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"bufio"
"crypto/tls"
"io"
"io/ioutil"
"log"
"net"
Expand All @@ -20,9 +21,14 @@ func parseFile(filename string) ([]string, error) {
if err != nil {
return nil, err
}
defer file.Close()
defer func(file *os.File) {
err := file.Close()
if err != nil {
log.Fatalf("{#err}")
}
}(file)

lines := []string{}
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
Expand Down Expand Up @@ -83,7 +89,12 @@ func request(method, uri string, headers []header, proxy *url.URL) (int, []byte,
if err != nil {
return 0, nil, err
}
defer res.Body.Close()
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
log.Fatalf("{#err}")
}
}(res.Body)

resp, err := httputil.DumpResponse(res, true)
if err != nil {
Expand All @@ -100,10 +111,10 @@ func loadFlagsFromRequestFile(requestFile string, schema bool, verbose bool) {
if err != nil {
log.Fatalf("Error reading request file: %v", err)
}
http_schema := "https://"
httpSchema := "https://"

if schema != false {
http_schema = "http://"
httpSchema = "http://"
}

// Split the request into lines
Expand All @@ -114,16 +125,16 @@ func loadFlagsFromRequestFile(requestFile string, schema bool, verbose bool) {

// Extract the HTTP method and URL from the first line of the request
parts := strings.Split(firstLine, " ")
uri := http_schema + host[1] + parts[1]
uri := httpSchema + host[1] + parts[1]

// Extract headers from the request and assign them to the req_headers slice
req_headers := []string{}
var reqHeaders []string
for _, h := range headers {
if len(h) > 0 {
req_headers = append(req_headers, h)
reqHeaders = append(reqHeaders, h)
}
}

// Assign the extracted values to the corresponding flag variables
requester(uri, proxy, useragent, req_headers, bypassIp, folder, httpMethod, verbose)
requester(uri, proxy, useragent, reqHeaders, bypassIp, folder, httpMethod, verbose, nobanner)
}
Loading

0 comments on commit 6e52e2e

Please sign in to comment.