Skip to content

Commit

Permalink
Modified validation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xGwyn committed Apr 25, 2023
1 parent 273a160 commit 860307e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
9 changes: 7 additions & 2 deletions pkg/runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func ParseOptions() *Options {

flags.CreateGroup("options", "Options",
flags.BoolVarP(&options.fast, "fast", "f", false, "Fast flag for dnsgen"),
flags.BoolVarP(&options.cleanup, "cleanup", "c", false, "Unessential files cleanup"),
flags.BoolVarP(&options.cleanup, "cleanup", "c", false, "Clean up all files except the final result"),
flags.BoolVarP(&options.all, "all", "a", false, "All flag for subfinder"),
flags.BoolVarP(&options.silent, "silent", "s", false, "Show only resolved subdomains"),
flags.BoolVarP(&options.silent, "silent", "s", false, "Only show resolved subdomains"),
flags.BoolVarP(&options.enrich, "enrich", "en", false, "Enrich flag for alterx"),
flags.StringVarP(&options.permutationTool, "permutation-tool", "pt", "alterx", "Permutation tool (dnsgen or alterx)"),
)
Expand Down Expand Up @@ -128,6 +128,11 @@ func (options *Options) validateOptions() error {
return fmt.Errorf("a file under the name %v already exists", options.output)
}

// checks if both silent and verbose flags are used
if options.verbose && options.silent {
return errors.New("can't use both silent and verbose mode")
}

return nil
}

Expand Down
5 changes: 1 addition & 4 deletions pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@ func (runner *Runner) Start() error {
}

//print results to stdout
printResults(
runner.options.silent,
path.Join(runner.options.domain, runner.options.output),
)
printResults(path.Join(runner.options.domain, runner.options.output))

//cleanup only if the flag is set
if runner.options.cleanup {
Expand Down
4 changes: 2 additions & 2 deletions pkg/runner/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func cleanup(dir string) error {

//list of files
files := []string{
"abuseipdb.subs", "subfinder.subs", "generated.subs", "shuffledns_phase1.in",
"abuseipdb.subs", "subfinder.subs", "generated.subs", "shuffledns_phase1.in",
"shuffledns_phase1.out", "shuffledns_phase2.in", "shuffledns_phase2.out", "permutation.in",
}

Expand Down Expand Up @@ -182,7 +182,7 @@ func makeSubsFromWordlist(domain, wordlistFilename, generatedFilename string) er
return nil
}

func printResults(silentFlag bool, file string) error {
func printResults(file string) error {
gologger.Debug().Msg("printing final results")

f, err := os.Open(file)
Expand Down

0 comments on commit 860307e

Please sign in to comment.