skipped 28 lines 29 29 scanCmd.Flags().BoolVarP(&options.Scan.NmapOverview, "nmap", "n", false, "Use nmap instead of masscan for overview scan") 30 30 scanCmd.Flags().BoolVarP(&options.Scan.ZmapOverview, "zmap", "z", false, "Only scan range with zmap") 31 31 scanCmd.Flags().BoolVarP(&options.Scan.SkipOverview, "skip-masscan", "s", false, "run nmap from input format like this: 1.2.3.4:443") 32 + scanCmd.Flags().BoolVarP(&options.Scan.InputFromRustScan, "rstd", "R", false, "run nmap from rustscan input format like: 1.2.3.4 -> [80,443,8080,8443,8880]") 32 33 // more nmap options 33 34 scanCmd.Flags().StringVarP(&options.Scan.NmapScripts, "script", "S", "", "nmap scripts") 34 - scanCmd.Flags().StringVar(&options.Scan.NmapTemplate, "nmap-command", "nmap -sSV -p {{.ports}} {{.input}} {{.script}} -T4 --open -oA {{.output}}", "Nmap template command to run") 35 + scanCmd.Flags().StringVar(&options.Scan.NmapTemplate, "nmap-command", "nmap -sSV -sC - p {{.ports}} {{.input}} {{.script}} -T4 --open -oA {{.output}}", "Nmap template command to run") 35 36 scanCmd.Flags().StringVar(&options.Scan.GrepString, "grep", "", "match string to confirm script success") 36 - scanCmd.Flags().StringP ("result-folder" , " R ", "", "Result folder") 37 + scanCmd.Flags().String ("result-folder", "", "Result folder") 37 38 scanCmd.Flags().BoolVar(&options.Scan.IPv4, "4", true, "Filter input to only get ipv4") 38 39 scanCmd.Flags().BoolVar(&options.Scan.Skip80And443, "8", false, "Skip ports 80 and 443. Useful when you want to look for service behind the list of pre-scanned data") 39 40 //scanCmd.Flags().Bool("6", false, "Filter input to only get ipv4") skipped 10 lines 50 51 if resultFolder != "" { 51 52 parseResult(resultFolder, options) 52 53 os.Exit(0) 54 + } 55 + 56 + if options.Scan.InputFromRustScan { 57 + options.Scan.SkipOverview = true 53 58 } 54 59 55 60 if options.Input == "-" || options.Input == "" { skipped 139 lines 195 200 } 196 201 197 202 func directDetail(input string, options core.Options) []string { 203 + var out []string 198 204 if options.Scan.Skip80And443 { 199 205 if strings.HasSuffix(input, ":80") && strings.HasSuffix(input, ":443") { 200 - return []string{} 206 + return out 201 207 } 202 208 } 203 209 204 210 if input == "" { 205 - return []string{} 211 + return out 206 212 } 207 - if len(strings.Split(input, ":")) == 1 { 208 - return []string{} 213 + var host, ports string 214 + 215 + if options.Scan.InputFromRustScan { 216 + // 1.1.1.1 -> [80,443,2095,2096,8080,8443,8880] 217 + if !strings.Contains(input, "->") { 218 + return out 219 + } 220 + host = strings.Split(input, " -> ")[0] 221 + ports = strings.Split(input, " -> ")[1] 222 + ports = strings.TrimLeft(strings.TrimRight(ports, "]"), "[") 223 + } else { 224 + if len(strings.Split(input, ":")) == 1 { 225 + return out 226 + } 227 + host = strings.Split(input, ":")[0] 228 + ports = strings.Split(input, ":")[1] 209 229 } 210 - host := strings.Split(input, ":")[0] 211 - ports := strings.Split(input, ":")[1] 230 + 212 231 core.BannerF("Run detail scan on: ", fmt.Sprintf("%v:%v", host, ports)) 213 - return modules.RunNmap(host, ports, options) 232 + out = modules.RunNmap(host, ports, options) 233 + return out 214 234 } 215 235 216 236 // only parse result skipped 72 lines