Skip to content

Commit

Permalink
Merge pull request #294 from hahwul/dev
Browse files Browse the repository at this point in the history
v2.5.4
  • Loading branch information
hahwul authored Oct 12, 2021
2 parents 6a4c9be + 7bd0447 commit 923aba9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
44 changes: 26 additions & 18 deletions cmd/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,43 @@ var fileCmd = &cobra.Command{
ff, err := readLinesOrLiteral(args[0])
_ = err
var path, body, host, target string
var headers []string
bodyswitch := false
for index, line := range ff {
if index == 0 {
parse := strings.Split(line, " ")
path = parse[1]
}
_ = headers
if strings.Index(line, "Host: ") != -1 {
host = line[6:]
}
if strings.Index(line, "Cookie: ") != -1 {
options.Cookie = line[9:]
}
if strings.Index(line, "User-Agent: ") != -1 {
options.UserAgent = line[12:]
}
if bodyswitch {
body = body + line
}
if len(line) == 0 {
bodyswitch = true
if len(parse) > 1 {
options.Method = parse[0]
path = parse[1]
} else {
printing.DalLog("ERROR", "HTTP Raw Request Format Error", options)
os.Exit(1)
}
} else {
if strings.Index(line, "Host: ") != -1 {
host = line[6:]
} else {
parse := strings.Split(line,":")
if len(parse) > 1 {
options.Header = append(options.Header, line)
}
}
if bodyswitch {
body = body + line
}
if len(line) == 0 {
bodyswitch = true
}
}
}
options.Data = body
http, _ := cmd.Flags().GetBool("http")
if strings.Index(path, "http") == 0 {
target = path
} else {
if host == "" {
printing.DalLog("ERROR", "HTTP Raw Request Format Error - Not found Host", options)
os.Exit(1)
}
if http {
target = "http://" + host + path
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/printing/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package printing

// VERSION is version of dalfox
const VERSION = "v2.5.3"
const VERSION = "v2.5.4"

0 comments on commit 923aba9

Please sign in to comment.