()
| 58 | } |
| 59 | |
| 60 | func ParseOptions() *Options { |
| 61 | options := &Options{} |
| 62 | flag.IntVar(&options.Mode, "m", 0, "debug mode off (debug mode = 1) default mode = 0") |
| 63 | flag.IntVar(&options.Thread, "t", 50, "threads number ") |
| 64 | flag.StringVar(&options.File, "f", "", "file to read example: -file=test.txt http(s)://host:port/path/ (notes: The last line must be empty)") |
| 65 | flag.StringVar(&options.Url, "u", "", "url to read example: -url=http://www.baidu.com:80/") |
| 66 | flag.StringVar(&options.Proxy, "proxy", "", "proxy example: -proxy=http(socks5)://127.0.0.1:8080 ") |
| 67 | flag.BoolVar(&options.Version, "version", false, "show version") |
| 68 | flag.BoolVar(&options.Verbose, "verbose", false, "show verbose") |
| 69 | flag.BoolVar(&options.SP, "sp", false, "show pocs list") |
| 70 | flag.StringVar(&options.LogFile, "log", "", "log file example: -log=/logs/logs.txt") |
| 71 | flag.IntVar(&options.Retry, "retry", 1, "repeat request times") |
| 72 | //flag.StringVar(&options.IP, "i", "", "ip segment example: -ip=192.168.0.1/24 ") |
| 73 | flag.IntVar(&options.Timeout, "timeout", 10, "timeout") |
| 74 | flag.StringVar(&options.Out, "o", "result.txt", "out file example: -o=result.txt default result.txt") |
| 75 | flag.StringVar(&options.Pocs, "p", "", "pocs example: -p=CVE202222947,CVE202122963,poc3") |
| 76 | flag.StringVar(&options.IP, "i", "", "ip segment example: -i=192.168.1.1/32") |
| 77 | flag.BoolVar(&options.Shell, "shell", false, "whether to enter the interactive shell") |
| 78 | flag.BoolVar(&options.H1, "h1", false, "force to use HTTP 1.1") |
| 79 | flag.BoolVar(&options.Update, "update", false, "update to the latest version") |
| 80 | flag.BoolVar(&options.Redirect, "redirect", false, "whether to follow redirect") |
| 81 | flag.Parse() |
| 82 | |
| 83 | // TODO 修改版本号 |
| 84 | logs.SaveLogs(options.LogFile) |
| 85 | ShowBanner() |
| 86 | showVerbose(options) |
| 87 | confirmAndSelfUpdate() |
| 88 | |
| 89 | if options.Version { |
| 90 | //ShowBanner(v) |
| 91 | } else if url := options.Url; url != "" { |
| 92 | options.Thread = 1 |
| 93 | options.File = "" |
| 94 | //ShowBanner(v) |
| 95 | } else if options.File != "" { |
| 96 | options.Url = "" |
| 97 | //ShowBanner(v) |
| 98 | } else if options.IP != "" { |
| 99 | options.File = "" |
| 100 | options.Url = "" |
| 101 | } else if options.SP { |
| 102 | showPocsList() |
| 103 | } else if options.Update { |
| 104 | } else { |
| 105 | //ShowBanner(v) |
| 106 | flag.PrintDefaults() |
| 107 | } |
| 108 | |
| 109 | return options |
| 110 | |
| 111 | } |
| 112 | |
| 113 | func showPocsList() { |
| 114 | fmt.Println("Pocs list: ") |
no test coverage detected