| skipped 52 lines |
53 | 53 | | var compareFile string |
54 | 54 | | flag.StringVar(&compareFile, "compare", "", "Compare data with a JSON file") |
55 | 55 | | |
| 56 | + | var url bool |
| 57 | + | flag.BoolVar(&url, "url", false, "Show URLs only") |
| 58 | + | |
56 | 59 | | flag.Parse() |
57 | 60 | | |
58 | 61 | | |
| skipped 29 lines |
88 | 91 | | |
89 | 92 | | if jsonFile == "" && compareFile == "" { |
90 | 93 | | for i := 0; i < len(targets); i++ { |
91 | | - | printResult(<-channel, noCPEs, noHostnames, noTags, noVulns, noColor) |
| 94 | + | printResult(<-channel, noCPEs, noHostnames, noTags, noVulns, noColor, url) |
92 | 95 | | } |
93 | 96 | | } |
94 | 97 | | |
| skipped 181 lines |
276 | 279 | | } |
277 | 280 | | |
278 | 281 | | |
279 | | - | func printResult(jsonData Response, noCPEs bool, noHostnames bool, noTags bool, noVulns bool, noColor bool) { |
| 282 | + | func printResult(jsonData Response, noCPEs bool, noHostnames bool, noTags bool, noVulns bool, noColor bool, url bool) { |
280 | 283 | | |
281 | 284 | | builder := &strings.Builder{} |
282 | 285 | | |
| skipped 1 lines |
284 | 287 | | return |
285 | 288 | | } |
286 | 289 | | |
287 | | - | fmt.Println(jsonData.IP) |
| 290 | + | ports := strings.Trim(strings.Join(strings.Fields(fmt.Sprint(jsonData.Ports)), ", "), "[]") |
288 | 291 | | |
289 | | - | ports := strings.Trim(strings.Join(strings.Fields(fmt.Sprint(jsonData.Ports)), ", "), "[]") |
| 292 | + | if url { |
| 293 | + | if (jsonData.Ports == nil) { |
| 294 | + | return |
| 295 | + | } |
| 296 | + | for _, port := range jsonData.Ports { |
| 297 | + | fmt.Println(jsonData.IP + ":" + fmt.Sprint(port)) |
| 298 | + | } |
| 299 | + | return |
| 300 | + | } |
| 301 | + | |
| 302 | + | fmt.Println(jsonData.IP) |
290 | 303 | | |
291 | 304 | | if !noColor { |
292 | 305 | | builder.WriteString("Ports: " + aurora.Green(ports).String() + "\n") |
| skipped 42 lines |