Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing domains that have a comma as part of the string #329

Closed
warwickhadley opened this issue May 5, 2023 · 5 comments · Fixed by #330
Closed

Passing domains that have a comma as part of the string #329

warwickhadley opened this issue May 5, 2023 · 5 comments · Fixed by #330

Comments

@warwickhadley
Copy link

Is it possible to submit a request for a domain that has a comma as part of the domain name ie abc.edg,hij.com . When I pass this it treats the part of the string after the comma as the resolver to be used.

thanks

@stklcode
Copy link
Contributor

stklcode commented May 5, 2023

Seems this is only possible in --name-server-mode for a single domain, like this:

echo my-nameserver | zdns A --name-server-mode --override-name "ex,ample.com"

Otherwise, the parser will always split the input line at the first comma:

zdns/pkg/zdns/lookup.go

Lines 115 to 125 in ac6c7f3

if gc.AlexaFormat == true {
rawName, rank = parseAlexa(line)
res.AlexaRank = rank
} else if gc.MetadataFormat {
rawName, entryMetadata = parseMetadataInputLine(line)
res.Metadata = entryMetadata
} else if gc.NameServerMode {
nameServer = util.AddDefaultPortToDNSServerName(line)
} else {
rawName, nameServer = parseNormalInputLine(line)
}

zdns/pkg/zdns/lookup.go

Lines 70 to 77 in ac6c7f3

func parseNormalInputLine(line string) (string, string) {
s := strings.SplitN(line, ",", 2)
if len(s) == 1 {
return s[0], ""
} else {
return s[0], util.AddDefaultPortToDNSServerName(s[1])
}
}

So echo "ex,ample.com" | zdns A will query ex at ample.com:53

Funny side effect: Is is possible to use a comma in the nameserver's domain...
echo "ex,ample.com,my-nameserver" | zdns A will query ex at ample.com,my-nameserver:53

@secastro
Copy link

secastro commented May 5, 2023

Just poking my nose on this, a comma "," is not a valid character on a domain name, seems like an error on Warwick's data.

@zakird
Copy link
Member

zakird commented May 5, 2023 via email

@stklcode
Copy link
Contributor

stklcode commented May 5, 2023

Just poking my nose on this, a comma "," is not a valid character on a domain name, seems like an error on Warwick's data.

It could also be intentional. While most of the time there is no practical use for it, out-of-spec requests sometimes reveal interesting stuff 😉

@dadrian
Copy link
Member

dadrian commented May 5, 2023

@warwickhadley can you test with #330

dadrian added a commit that referenced this issue Sep 10, 2023
Fixes #329

Co-authored-by: Zakir Durumeric <zakird@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants