Skip to content

Commit

Permalink
Added feature: Send URLs via pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
devploit committed Jun 30, 2022
1 parent 99365e1 commit cafde25
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Flags:
-h, --help help for dontgo403
-p, --proxy string Proxy URL. For example: http://127.0.0.1:8080
-u, --uri string Target URL
-a, --useragent string Set the User-Agent string (default 'dontgo403/0.4')
-a, --useragent string Set the User-Agent string (default 'dontgo403/0.5')
```


Expand Down
2 changes: 1 addition & 1 deletion cmd/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func requester(uri string, proxy string, userAgent string, req_headers []string,
uri += "/"
}
if len(userAgent) == 0 {
userAgent = "dontgo403/0.4"
userAgent = "dontgo403/0.5"
}

headers := []header{
Expand Down
28 changes: 22 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package cmd

import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -26,12 +28,26 @@ var rootCmd = &cobra.Command{
Long: `Command line application that automates different ways to bypass 40X codes.`,

Run: func(cmd *cobra.Command, args []string) {
if len(os.Args) < 3 {
cmd.Help()
log.Fatal()
fi, _ := os.Stdin.Stat()
if (fi.Mode() & os.ModeCharDevice) == 0 {
bytes, _ := ioutil.ReadAll(os.Stdin)
content := string(bytes)
lines := strings.Split(string(content), "\n")
lastchar := (lines[len(lines)-1])
for _, line := range lines {
uri = line
if uri == lastchar {
break
}
requester(uri, proxy, useragent, req_headers, bypassIp)
}
} else {
if len(uri) == 0 {
cmd.Help()
log.Fatal()
}
requester(uri, proxy, useragent, req_headers, bypassIp)
}
requester(uri, proxy, useragent, req_headers, bypassIp)

},
}

Expand All @@ -46,7 +62,7 @@ func init() {

rootCmd.PersistentFlags().StringVarP(&uri, "uri", "u", "", "Target URL")
rootCmd.PersistentFlags().StringVarP(&proxy, "proxy", "p", "", "Proxy URL. For example: http://127.0.0.1:8080")
rootCmd.PersistentFlags().StringVarP(&useragent, "useragent", "a", "", "Set the User-Agent string (default 'dontgo403/0.3')")
rootCmd.PersistentFlags().StringVarP(&useragent, "useragent", "a", "", "Set the User-Agent string (default 'dontgo403/0.5')")
rootCmd.PersistentFlags().IntVarP(&delay, "delay", "d", 0, "Set a delay (in ms) between each request")
rootCmd.PersistentFlags().StringSliceVarP(&req_headers, "header", "H", []string{""}, "Add a custom header to the requests (can be specified multiple times)")
rootCmd.PersistentFlags().StringVarP(&bypassIp, "bypassIp", "b", "", "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'")
Expand Down

0 comments on commit cafde25

Please sign in to comment.