zmap/zdns

Passing domains that have a comma as part of the string

warwickhadley opened this issue · 5 comments

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

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

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 commented

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 😉

@warwickhadley can you test with #330