(args []string, c cli.Config)
| 85 | } |
| 86 | |
| 87 | func scanMain(args []string, c cli.Config) (err error) { |
| 88 | if c.List { |
| 89 | printJSON(scan.Default) |
| 90 | } else { |
| 91 | if err = scan.LoadRootCAs(c.CABundleFile); err != nil { |
| 92 | return |
| 93 | } |
| 94 | |
| 95 | if len(args) >= c.MaxHosts { |
| 96 | log.Warningf("Only scanning max-hosts=%d out of %d args given", c.MaxHosts, len(args)) |
| 97 | args = args[:c.MaxHosts] |
| 98 | } else if c.CSVFile != "" { |
| 99 | args, err = parseCSV(args, c.CSVFile, c.MaxHosts) |
| 100 | if err != nil { |
| 101 | return |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | ctx := newContext(c, c.NumWorkers) |
| 106 | // Execute for each HOST argument given |
| 107 | for len(args) > 0 { |
| 108 | var host string |
| 109 | host, args, err = cli.PopFirstArgument(args) |
| 110 | if err != nil { |
| 111 | return |
| 112 | } |
| 113 | |
| 114 | ctx.hosts <- host |
| 115 | } |
| 116 | close(ctx.hosts) |
| 117 | ctx.Wait() |
| 118 | } |
| 119 | return |
| 120 | } |
| 121 | |
| 122 | // Command assembles the definition of Command 'scan' |
| 123 | var Command = &cli.Command{UsageText: scanUsageText, Flags: scanFlags, Main: scanMain} |
searching dependent graphs…