Skip to content

Commit

Permalink
Bug fix... curl was crashing when no parameters were given.
Browse files Browse the repository at this point in the history
  • Loading branch information
JayBeale committed Aug 14, 2020
1 parent ce5f871 commit 7cb254e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions peirates.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ func banner(connectionString ServerInfo) {
,,,,,,,,,,,,:.............,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
________________________________________
Peirates v1.0.28 by InGuardians
Peirates v1.0.28a by InGuardians
https://www.inguardians.com/peirates
----------------------------------------------------------------`)

Expand Down Expand Up @@ -1558,26 +1558,27 @@ Leave off the "kubectl" part of the command. For example:
method = strings.TrimSpace(strings.ToUpper(input))
}

input_parameter := "--undefined--"
inputParameter := "--undefined--"

// Store the parameters in a map
params := map[string]string{}

for input_parameter != "" {
for inputParameter != "" {
// Request a parameter name

fmt.Println("[+] Enter a parameter or a blank line to finish entering parameters: ")
fmt.Scanln(&input)
input_parameter = strings.TrimSpace(input)

if input_parameter != "" {
input, _ = readLine()

inputParameter = strings.TrimSpace(input)

if inputParameter != "" {
// Request a parameter value
fmt.Println("[+] Enter a value for " + input_parameter + ":")
fmt.Println("[+] Enter a value for " + inputParameter + ":")
fmt.Scanln(&input)
parameter_value := url.QueryEscape(input)

// Add the parameter pair to the list
params[input_parameter] = parameter_value
input = ""
params[inputParameter] = url.QueryEscape(input)
}

}
Expand All @@ -1587,9 +1588,8 @@ Leave off the "kubectl" part of the command. For example:

// Create a data structure for values sent in the body of the request.

var dataSection *strings.Reader
dataSection = nil
contentLength := ""
var dataSection *strings.Reader = nil
var contentLength string

// Construct GET or POST request based on variables
if method == "GET" {
Expand Down Expand Up @@ -1623,9 +1623,9 @@ Leave off the "kubectl" part of the command. For example:

fmt.Println("[+] Using method " + method + " for URL " + urlWithData)

request, err := http.NewRequest(method, fullURL, dataSection)
request, err := http.NewRequest(method, fullURL, nil)
if method != "GET" {

request, err = http.NewRequest(method, fullURL, dataSection)
request.Header.Add("Content-Length", contentLength)
}

Expand Down

0 comments on commit 7cb254e

Please sign in to comment.