commit
1bf8af4778
|
@ -139,7 +139,11 @@ func (r *Runner) EnumerateSingleDomain(domain, output string) error {
|
|||
} else if r.options.JSON {
|
||||
err = WriteJSONOutput(foundResults, file)
|
||||
} else {
|
||||
err = WriteHostOutput(uniqueMap, file)
|
||||
if r.options.RemoveWildcard {
|
||||
err = WriteHostOutputNoWildcard(foundResults, file)
|
||||
} else {
|
||||
err = WriteHostOutput(uniqueMap, file)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("Could not write results to file %s for %s: %s\n", output, domain, err)
|
||||
|
|
|
@ -33,6 +33,25 @@ func WriteHostOutput(results map[string]struct{}, writer io.Writer) error {
|
|||
return bufwriter.Flush()
|
||||
}
|
||||
|
||||
// WriteHostOutputNoWildcard writes the output list of subdomain with nW flag to an io.Writer
|
||||
func WriteHostOutputNoWildcard(results map[string]string, writer io.Writer) error {
|
||||
bufwriter := bufio.NewWriter(writer)
|
||||
sb := &strings.Builder{}
|
||||
|
||||
for host := range results {
|
||||
sb.WriteString(host)
|
||||
sb.WriteString("\n")
|
||||
|
||||
_, err := bufwriter.WriteString(sb.String())
|
||||
if err != nil {
|
||||
bufwriter.Flush()
|
||||
return err
|
||||
}
|
||||
sb.Reset()
|
||||
}
|
||||
return bufwriter.Flush()
|
||||
}
|
||||
|
||||
// WriteJSONOutput writes the output list of subdomain in JSON to an io.Writer
|
||||
func WriteJSONOutput(results map[string]string, writer io.Writer) error {
|
||||
encoder := jsoniter.NewEncoder(writer)
|
||||
|
|
Loading…
Reference in New Issue