Skip to content

Commit 87f73be

Browse files
committed
updates to the collection function
1 parent cb9b043 commit 87f73be

File tree

5 files changed

+19
-57
lines changed

5 files changed

+19
-57
lines changed

cmd/amass/enum.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func defineEnumOptionFlags(enumFlags *flag.FlagSet, args *enumArgs) {
122122
enumFlags.BoolVar(&args.Options.Alterations, "alts", false, "Enable generation of altered names")
123123
enumFlags.BoolVar(&args.Options.NoColor, "nocolor", false, "Disable colorized output")
124124
enumFlags.BoolVar(&args.Options.NoRecursive, "norecursive", false, "Turn off recursive brute forcing")
125-
enumFlags.BoolVar(&args.Options.Passive, "passive", false, "Disable DNS resolution of names and dependent features")
125+
enumFlags.BoolVar(&args.Options.Passive, "passive", false, "Deprecated since passive is the default setting")
126126
enumFlags.BoolVar(&args.Options.Silent, "silent", false, "Disable all output during execution")
127127
enumFlags.BoolVar(&args.Options.Verbose, "v", false, "Output status / debug / troubleshooting info")
128128
}
@@ -176,12 +176,6 @@ func runEnumCommand(clArgs []string) {
176176
os.Exit(1)
177177
}
178178

179-
if cfg.Passive {
180-
fmt.Fprintf(color.Error, "%s\n", green("Passive mode does not generate output during the enumeration"))
181-
fmt.Fprintf(color.Error, "\t%s\n", green("Obtain your list of FQDNs using the following command:"))
182-
fmt.Fprintf(color.Error, "\t%s\n", green("amass db -names -d "+strings.Join(cfg.Domains(), ",")))
183-
}
184-
185179
// Setup the new enumeration
186180
e := enum.NewEnumeration(cfg, sys, sys.GraphDatabases()[0])
187181
if e == nil {
@@ -362,7 +356,7 @@ func printOutput(e *enum.Enumeration, args *enumArgs, output chan string, wg *sy
362356
total++
363357
}
364358

365-
if !e.Config.Passive && total == 0 {
359+
if total == 0 {
366360
r.Println("No assets were discovered")
367361
}
368362
}
@@ -623,12 +617,6 @@ func (e enumArgs) OverrideConfig(conf *config.Config) error {
623617
conf.Active = true
624618
conf.Passive = false
625619
}
626-
if e.Options.Passive {
627-
conf.Passive = true
628-
conf.Active = false
629-
conf.BruteForcing = false
630-
conf.Alterations = false
631-
}
632620
if e.Blacklist.Len() > 0 {
633621
conf.Scope.Blacklist = e.Blacklist.Slice()
634622
}

cmd/amass/io.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ func extractAssetName(a *types.Asset) string {
9393

9494
// ExtractOutput is a convenience method for obtaining new discoveries made by the enumeration process.
9595
func ExtractOutput(ctx context.Context, g *netmap.Graph, e *enum.Enumeration, filter *stringset.Set, asinfo bool) []*requests.Output {
96-
if e.Config.Passive {
97-
return EventNames(ctx, g, e.Config.Domains(), e.Config.CollectionStartTime, filter)
98-
}
9996
return EventOutput(ctx, g, e.Config.Domains(), e.Config.CollectionStartTime, filter, asinfo, e.Sys.Cache())
10097
}
10198

enum/enum.go

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,20 @@ func (e *Enumeration) Start(ctx context.Context) error {
6565
defer cancel()
6666
go e.manageDataSrcRequests()
6767

68-
if !e.Config.Passive {
69-
e.dnsTask = newDNSTask(e, false)
70-
e.valTask = newDNSTask(e, true)
71-
e.store = newDataManager(e)
72-
e.subTask = newSubdomainTask(e)
73-
defer e.subTask.Stop()
74-
defer e.dnsTask.stop()
75-
defer e.valTask.stop()
76-
}
68+
e.dnsTask = newDNSTask(e, false)
69+
e.valTask = newDNSTask(e, true)
70+
e.store = newDataManager(e)
71+
e.subTask = newSubdomainTask(e)
72+
defer e.subTask.Stop()
73+
defer e.dnsTask.stop()
74+
defer e.valTask.stop()
7775

7876
var stages []pipeline.Stage
79-
if !e.Config.Passive {
80-
stages = append(stages, pipeline.FIFO("root", e.valTask.rootTaskFunc()))
81-
stages = append(stages, pipeline.FIFO("dns", e.dnsTask))
82-
stages = append(stages, pipeline.FIFO("validate", e.valTask))
83-
stages = append(stages, pipeline.FIFO("store", e.store))
84-
stages = append(stages, pipeline.FIFO("", e.subTask))
85-
}
77+
stages = append(stages, pipeline.FIFO("root", e.valTask.rootTaskFunc()))
78+
stages = append(stages, pipeline.FIFO("dns", e.dnsTask))
79+
stages = append(stages, pipeline.FIFO("validate", e.valTask))
80+
stages = append(stages, pipeline.FIFO("store", e.store))
81+
stages = append(stages, pipeline.FIFO("", e.subTask))
8682

8783
p := pipeline.NewPipeline(stages...)
8884
// The pipeline input source will receive all the names
@@ -99,14 +95,9 @@ func (e *Enumeration) Start(ctx context.Context) error {
9995
go e.submitKnownNames()
10096
go e.submitProvidedNames()
10197

102-
var err error
103-
if e.Config.Passive {
104-
err = p.Execute(e.ctx, e.nameSrc, e.makeOutputSink())
105-
} else {
106-
err = p.ExecuteBuffered(e.ctx, e.nameSrc, e.makeOutputSink(), 50)
107-
// Ensure all data has been stored
108-
<-e.store.Stop()
109-
}
98+
err := p.ExecuteBuffered(e.ctx, e.nameSrc, e.makeOutputSink(), 50)
99+
// Ensure all data has been stored
100+
<-e.store.Stop()
110101
return err
111102
}
112103

@@ -219,16 +210,6 @@ func (e *Enumeration) fireRequest(srv service.Service, req interface{}, finished
219210

220211
func (e *Enumeration) makeOutputSink() pipeline.SinkFunc {
221212
return pipeline.SinkFunc(func(ctx context.Context, data pipeline.Data) error {
222-
if !e.Config.Passive {
223-
return nil
224-
}
225-
226-
req, ok := data.(*requests.DNSRequest)
227-
if ok && req != nil && req.Name != "" && e.Config.IsDomainInScope(req.Name) {
228-
if _, err := e.graph.UpsertFQDN(e.ctx, req.Name); err != nil {
229-
e.Config.Log.Print(err.Error())
230-
}
231-
}
232213
return nil
233214
})
234215
}

enum/input.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (r *enumSource) Next(ctx context.Context) bool {
135135
case <-t.C:
136136
count := r.pipeline.DataItemCount()
137137
if !r.enum.requestsPending() && count <= 0 {
138-
if r.enum.Config.Passive || r.enum.store.queue.Len() == 0 {
138+
if r.enum.store.queue.Len() == 0 {
139139
r.markDone()
140140
return false
141141
}

systems/local.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ func NewLocalSystem(cfg *config.Config) (*LocalSystem, error) {
4848
return nil, errors.New("the system was unable to build the pool of trusted resolvers")
4949
}
5050

51-
pool, num := trusted, num
52-
if !cfg.Passive {
53-
pool, num = untrustedResolvers(cfg)
54-
}
55-
51+
pool, num := untrustedResolvers(cfg)
5652
if pool == nil || num == 0 {
5753
return nil, errors.New("the system was unable to build the pool of untrusted resolvers")
5854
}

0 commit comments

Comments
 (0)