maraudir/common/args.go

44 lines
1006 B
Go

package common
import (
flag "github.com/spf13/pflag"
)
type Params struct {
List string
Cidr string
Pathlist string
UserAgent string
Threads int
Tmout int
Delay int
Silent bool
}
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
)
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,
}
}