diff --git a/cmd/amass/intel.go b/cmd/amass/intel.go index b0814f143..1775d06d7 100644 --- a/cmd/amass/intel.go +++ b/cmd/amass/intel.go @@ -168,7 +168,7 @@ func runIntelCommand(clArgs []string) { // Some input validation if !args.Options.ReverseWhois && args.OrganizationName == "" && !args.Options.ListSources && - len(args.Addresses) == 0 && len(args.CIDRs) == 0 && len(args.ASNs) == 0 { + len(args.Addresses) == 0 && len(args.CIDRs) == 0 && len(args.ASNs) == 0 && args.Domains.Len() == 0 { commandUsage(intelUsageMsg, intelCommand, intelBuf) os.Exit(1) } diff --git a/intel/active.go b/intel/active.go index 745234981..ca65d94b5 100644 --- a/intel/active.go +++ b/intel/active.go @@ -111,14 +111,19 @@ func (a *activeTask) certEnumeration(ctx context.Context, req *requests.AddrRequ return } - ip := net.ParseIP(req.Address) - if ip == nil { - return + host := req.Domain + addrinfo := requests.AddressInfo{} + if req.Domain == "" { + host = req.Address + ip := net.ParseIP(req.Address) + if ip == nil { + return + } + addrinfo.Address = ip } c := a.c - addrinfo := requests.AddressInfo{Address: ip} - for _, name := range http.PullCertificateNames(ctx, req.Address, c.Config.Ports) { + for _, name := range http.PullCertificateNames(ctx, host, c.Config.Ports) { if n := strings.TrimSpace(name); n != "" { domain, err := publicsuffix.EffectiveTLDPlusOne(n) if err != nil { diff --git a/intel/intel.go b/intel/intel.go index eff60c5c2..2511a1f98 100644 --- a/intel/intel.go +++ b/intel/intel.go @@ -81,10 +81,7 @@ func (c *Collection) HostedDomains(ctx context.Context) error { c.ctx, cancel = context.WithCancel(ctx) defer cancel() - go func() { - <-ctx.Done() - close(c.Output) - }() + defer close(c.Output) var stages []pipeline.Stage stages = append(stages, pipeline.DynamicPool("", c.makeDNSTaskFunc(), maxDnsPipelineTasks)) @@ -111,6 +108,10 @@ func (c *Collection) HostedDomains(ctx context.Context) error { }(cidr) } + for _, domain := range c.Config.Domains() { + source.InputAddress(&requests.AddrRequest{Domain: domain}) + } + return pipeline.NewPipeline(stages...).Execute(ctx, source, c.makeOutputSink()) } @@ -141,12 +142,12 @@ func (c *Collection) makeDNSTaskFunc() pipeline.TaskFunc { ip := net.ParseIP(req.Address) if ip == nil { - return nil, nil + return data, nil } msg := resolve.ReverseMsg(req.Address) if msg == nil { - return nil, nil + return data, nil } addrinfo := requests.AddressInfo{Address: ip} diff --git a/requests/request.go b/requests/request.go index 8c748275b..205485db5 100644 --- a/requests/request.go +++ b/requests/request.go @@ -216,7 +216,7 @@ func (a *AddrRequest) MarkAsProcessed() {} // Valid performs input validation of the receiver. func (a *AddrRequest) Valid() bool { - if ip := net.ParseIP(a.Address); ip == nil { + if ip := net.ParseIP(a.Address); ip == nil && a.Domain == "" { return false } if a.Domain != "" {