mirror of
https://github.com/aykhans/dodo.git
synced 2025-09-01 00:53:34 +00:00
🔧 Add 'skip-verify' parameter to skip SSL/TLS cert verification
This commit is contained in:
@@ -31,7 +31,7 @@ Usage with all flags:
|
||||
-p "param1=value1" -param "param2=value2" \
|
||||
-c "cookie1=value1" -cookie "cookie2=value2" \
|
||||
-x "http://proxy.example.com:8080" -proxy "socks5://proxy2.example.com:8080" \
|
||||
-y
|
||||
-skip-verify -y
|
||||
|
||||
Flags:
|
||||
-h, -help help for dodo
|
||||
@@ -48,7 +48,8 @@ Flags:
|
||||
-p, -param [string] Parameter for the request (e.g. "key1=value1")
|
||||
-H, -header [string] Header for the request (e.g. "key1:value1")
|
||||
-c, -cookie [string] Cookie for the request (e.g. "key1=value1")
|
||||
-x, -proxy [string] Proxy for the request (e.g. "http://proxy.example.com:8080")`
|
||||
-x, -proxy [string] Proxy for the request (e.g. "http://proxy.example.com:8080")
|
||||
-skip-verify bool Skip SSL/TLS certificate verification (default %v)`
|
||||
|
||||
func (config *Config) ReadCLI() (types.ConfigFile, error) {
|
||||
flag.Usage = func() {
|
||||
@@ -58,6 +59,7 @@ func (config *Config) ReadCLI() (types.ConfigFile, error) {
|
||||
DefaultDodosCount,
|
||||
DefaultTimeout,
|
||||
DefaultMethod,
|
||||
DefaultSkipVerify,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -65,6 +67,7 @@ func (config *Config) ReadCLI() (types.ConfigFile, error) {
|
||||
version = false
|
||||
configFile = ""
|
||||
yes = false
|
||||
skipVerify = false
|
||||
method = ""
|
||||
url types.RequestURL
|
||||
dodosCount = uint(0)
|
||||
@@ -83,6 +86,8 @@ func (config *Config) ReadCLI() (types.ConfigFile, error) {
|
||||
flag.BoolVar(&yes, "yes", false, "Answer yes to all questions")
|
||||
flag.BoolVar(&yes, "y", false, "Answer yes to all questions")
|
||||
|
||||
flag.BoolVar(&skipVerify, "skip-verify", false, "Skip SSL/TLS certificate verification")
|
||||
|
||||
flag.StringVar(&method, "method", "", "HTTP Method")
|
||||
flag.StringVar(&method, "m", "", "HTTP Method")
|
||||
|
||||
@@ -149,6 +154,8 @@ func (config *Config) ReadCLI() (types.ConfigFile, error) {
|
||||
config.Timeout = &types.Timeout{Duration: timeout}
|
||||
case "yes", "y":
|
||||
config.Yes = utils.ToPtr(yes)
|
||||
case "skip-verify":
|
||||
config.SkipVerify = utils.ToPtr(skipVerify)
|
||||
}
|
||||
})
|
||||
|
||||
|
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION string = "0.6.4"
|
||||
VERSION string = "0.6.5"
|
||||
DefaultUserAgent string = "Dodo/" + VERSION
|
||||
DefaultMethod string = "GET"
|
||||
DefaultTimeout time.Duration = time.Second * 10
|
||||
@@ -23,6 +23,7 @@ const (
|
||||
DefaultRequestCount uint = 0
|
||||
DefaultDuration time.Duration = 0
|
||||
DefaultYes bool = false
|
||||
DefaultSkipVerify bool = false
|
||||
)
|
||||
|
||||
var SupportedProxySchemes []string = []string{"http", "socks5", "socks5h"}
|
||||
@@ -35,6 +36,7 @@ type RequestConfig struct {
|
||||
RequestCount uint
|
||||
Duration time.Duration
|
||||
Yes bool
|
||||
SkipVerify bool
|
||||
Params types.Params
|
||||
Headers types.Headers
|
||||
Cookies types.Cookies
|
||||
@@ -51,6 +53,7 @@ func NewRequestConfig(conf *Config) *RequestConfig {
|
||||
RequestCount: *conf.RequestCount,
|
||||
Duration: conf.Duration.Duration,
|
||||
Yes: *conf.Yes,
|
||||
SkipVerify: *conf.SkipVerify,
|
||||
Params: conf.Params,
|
||||
Headers: conf.Headers,
|
||||
Cookies: conf.Cookies,
|
||||
@@ -122,6 +125,8 @@ func (rc *RequestConfig) Print() {
|
||||
t.AppendRow(table.Row{"Proxy", rc.Proxies.String()})
|
||||
t.AppendSeparator()
|
||||
t.AppendRow(table.Row{"Body", rc.Body.String()})
|
||||
t.AppendSeparator()
|
||||
t.AppendRow(table.Row{"Skip Verify", rc.SkipVerify})
|
||||
|
||||
t.Render()
|
||||
}
|
||||
@@ -134,6 +139,7 @@ type Config struct {
|
||||
RequestCount *uint `json:"requests" yaml:"requests"`
|
||||
Duration *types.Duration `json:"duration" yaml:"duration"`
|
||||
Yes *bool `json:"yes" yaml:"yes"`
|
||||
SkipVerify *bool `json:"skip_verify" yaml:"skip_verify"`
|
||||
Params types.Params `json:"params" yaml:"params"`
|
||||
Headers types.Headers `json:"headers" yaml:"headers"`
|
||||
Cookies types.Cookies `json:"cookies" yaml:"cookies"`
|
||||
@@ -220,6 +226,9 @@ func (config *Config) MergeConfig(newConfig *Config) {
|
||||
if newConfig.Yes != nil {
|
||||
config.Yes = newConfig.Yes
|
||||
}
|
||||
if newConfig.SkipVerify != nil {
|
||||
config.SkipVerify = newConfig.SkipVerify
|
||||
}
|
||||
if len(newConfig.Params) != 0 {
|
||||
config.Params = newConfig.Params
|
||||
}
|
||||
@@ -256,5 +265,8 @@ func (config *Config) SetDefaults() {
|
||||
if config.Yes == nil {
|
||||
config.Yes = utils.ToPtr(DefaultYes)
|
||||
}
|
||||
if config.SkipVerify == nil {
|
||||
config.SkipVerify = utils.ToPtr(DefaultSkipVerify)
|
||||
}
|
||||
config.Headers.SetIfNotExists("User-Agent", DefaultUserAgent)
|
||||
}
|
||||
|
Reference in New Issue
Block a user