maraudir/common/args.go

44 lines
1006 B
Go
Raw Normal View History

2024-11-21 06:16:20 +00:00
package common
import (
flag "github.com/spf13/pflag"
2024-11-21 06:16:20 +00:00
)
type Params struct {
List string
Cidr string
Pathlist string
UserAgent string
Threads int
Tmout int
Delay int
Silent bool
2024-11-21 06:16:20 +00:00
}
var (
list = flag.StringP("list", "l", "", "")
cidr = flag.StringP("range", "r", "", "")
pathlist = flag.StringP("pathlist", "p", "", "")
ua = flag.StringP("useragent", "u", "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)", "")
threads = flag.IntP("threads", "t", 100, "") // concurrent workers (green threads) not full threads. semantic preference.
tmout = flag.Int("timeout", 1000, "")
delay = flag.Int("delay", 200, "")
silent = flag.BoolP("silent", "s", false, "")
Conf Params
2024-11-21 06:16:20 +00:00
)
func LoadParams() {
flag.Usage = Usage
flag.Parse()
Conf = Params{
List: *list,
Cidr: *cidr,
Pathlist: *pathlist,
UserAgent: *ua,
Threads: *threads,
Tmout: *tmout,
Delay: *delay,
Silent: *silent,
2024-11-21 06:16:20 +00:00
}
}