Skip to content

Adding validation to stdin flags #35

@Techbrunch

Description

@Techbrunch

Hello,

I'm running into an issue when trying to run shuffledns inside an Amazon ECS (Fargate) container.

My issue is that shuffledns thinks that there is an stdin input provided where there isn't which then ignores the provided domain flag.

I don't know exactly what the problem is but I think that the function hasStdin could be improved.

func hasStdin() bool {
	fi, err := os.Stdin.Stat()
	if err != nil {
		return false
	}
	if fi.Mode()&os.ModeNamedPipe == 0 {
		return false
	}
	return true
}

If hasStdin returns true the domain flag will be ignored:

// Set the domain in the config if provided by user from the stdin
if options.Stdin && options.Wordlist != "" {
	buffer := &bytes.Buffer{}
	io.Copy(buffer, os.Stdin)
	options.Domain = strings.TrimRight(buffer.String(), "\r\n")
}

One way would be to validate the content of stdin since in my case it is empty, this is kind of a hack and a better solution would be to return false by default and only return true when there is an stdin value passed.

My issue can be "emulated" by running this command:

echo "" | /usr/bin/shuffledns -nC -v -w top100.txt -r /resolvers.txt -d facebook.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: CompletedNothing further to be done with this issue. Awaiting to be closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions