Skip to content

Commit

Permalink
Merge branch 'feature/custom_headers' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Inspectre Gadget committed Oct 3, 2016
2 parents f30c0a4 + 600867a commit 5bfe569
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config.toml
Expand Up @@ -15,6 +15,8 @@ verbose = true
# body = "body=text"
# Set the cookie values to send with the request to this target. Must be an array.
cookies = ["PHPSESSIONID=12345","JSESSIONID=67890"]
# Set custom headers to send with the request to this target. Must be an array.
headers = ["X-Originating-IP: 127.0.0.1", "X-Remote-IP: 127.0.0.1"]
# Follow redirects
redirects = true

Expand All @@ -28,5 +30,7 @@ verbose = true
body = "val=1000"
# Set the cookie values to send with the request to this target. Must be an array.
cookies = ["PHPSESSIONID=ABCDE","JSESSIONID=FGHIJ"]
# Set custom headers to send with the request to this target. Must be an array.
headers = ["X-Originating-IP: 127.0.0.1", "X-Remote-IP: 127.0.0.1"]
# Do not follow redirects
redirects = false
15 changes: 13 additions & 2 deletions main.go
Expand Up @@ -47,6 +47,7 @@ type Target struct {
URL string
Body string
Cookies []string
Headers []string
Redirects bool
CookieJar http.CookieJar
}
Expand Down Expand Up @@ -274,8 +275,18 @@ func sendRequests() (responses chan ResponseInfo, errors chan error) {
var client http.Client

// TEMP- append cookies directly to the request
cookieStr := strings.Join(t.Cookies, ";")
req.Header.Add("Cookie", cookieStr)
if len(t.Cookies) > 0 {
cookieStr := strings.Join(t.Cookies, ";")
req.Header.Add("Cookie", cookieStr)
}

// Add custom headers to the request
for _, header := range t.Headers {
split := strings.Split(header, ":")
hKey := split[0]
hVal := split[1]
req.Header.Add(hKey, hVal)
}

// Add content-type to POST requests (some applications require this to properly process POST requests)
// TODO: Find any bugs around other request types
Expand Down

0 comments on commit 5bfe569

Please sign in to comment.