@@ -15,7 +15,6 @@ import (
1515 "unicode"
1616
1717 "github.com/fatih/color"
18- "github.com/slicingmelon/go-rawurlparser"
1918 "github.com/zenthangplus/goccm"
2019)
2120
@@ -503,7 +502,7 @@ func requestEndPaths(options RequestOptions) {
503502 go func (line string ) {
504503 defer w .Done ()
505504
506- statusCode , response , err := request (options .method , options .uri + line , options .headers , options .proxy , options .rateLimit , options .timeout , options .redirect )
505+ statusCode , response , err := request (options .method , joinURL ( options .uri , line ) , options .headers , options .proxy , options .rateLimit , options .timeout , options .redirect )
507506 if err != nil {
508507 log .Println (err )
509508 }
@@ -515,7 +514,7 @@ func requestEndPaths(options RequestOptions) {
515514 }
516515
517516 result := Result {
518- line : options .uri + line ,
517+ line : joinURL ( options .uri , line ) ,
519518 statusCode : statusCode ,
520519 contentLength : len (response ),
521520 defaultReq : false ,
@@ -538,7 +537,7 @@ func requestMidPaths(options RequestOptions) {
538537 x := strings .Split (options .uri , "/" )
539538 var uripath string
540539
541- parsedURL , err := rawurlparser . RawURLParse (options .uri )
540+ parsedURL , err := url . Parse (options .uri )
542541 if err != nil {
543542 log .Println (err )
544543 }
@@ -595,7 +594,7 @@ func requestMidPaths(options RequestOptions) {
595594func requestDoubleEncoding (options RequestOptions ) {
596595 color .Cyan ("\n ━━━━━━━━━━━━━━━ DOUBLE-ENCODING ━━━━━━━━━━━━━━" )
597596
598- parsedURL , err := rawurlparser . RawURLParse (options .uri )
597+ parsedURL , err := url . Parse (options .uri )
599598 if err != nil {
600599 log .Println (err )
601600 return
@@ -725,7 +724,7 @@ func parseCurlOutput(output string, httpVersion string) Result {
725724func requestPathCaseSwitching (options RequestOptions ) {
726725 color .Cyan ("\n ━━━━━━━━━━━━ PATH CASE SWITCHING ━━━━━━━━━━━━━" )
727726
728- parsedURL , err := rawurlparser . RawURLParse (options .uri )
727+ parsedURL , err := url . Parse (options .uri )
729728 if err != nil {
730729 log .Println (err )
731730 return
@@ -830,6 +829,17 @@ func randomLine(filePath string) (string, error) {
830829 return randomLine , nil
831830}
832831
832+ // joinURL safely joins a base URL and a path, preserving slashes
833+ func joinURL (base string , path string ) string {
834+ if ! strings .HasSuffix (base , "/" ) && ! strings .HasPrefix (path , "/" ) {
835+ return base + "/" + path
836+ }
837+ if strings .HasSuffix (base , "/" ) && strings .HasPrefix (path , "/" ) {
838+ return base + path [1 :]
839+ }
840+ return base + path
841+ }
842+
833843// requester is the main function that runs all the tests.
834844func requester (uri string , proxy string , userAgent string , reqHeaders []string , bypassIP string , folder string , method string , verbose bool , techniques []string , banner bool , rateLimit bool , timeout int , redirect bool , randomAgent bool ) {
835845 // Set up proxy if provided.
0 commit comments