This commit is contained in:
Miek Gieben 2011-09-19 22:58:36 +02:00
parent e38ebda0cc
commit b9960f42ed
3 changed files with 24 additions and 7 deletions

View File

@ -8,15 +8,26 @@ import (
)
const (
// Detected software types
// Detected software types
NSD = "nsd"
BIND = "bind"
// Vendors
ISC = "ISC"
NLNETLABS = "NLnet Labs"
// Vendors
ISC = "ISC"
NLNETLABS = "NLnet Labs"
)
func startParse(addr string) {
l := new(lexer)
l.addr = addr
l.client = new(dns.Client)
l.fp = new(fingerprint)
l.items = make(chan item)
for l.state = lexDoBitMirror; l.state != nil; l.state = l.state(l) {
// l.state = l.state(l)
}
}
// SendProbe creates a packet and sends it to the nameserver.
// Connection errors are returned as:
// ...

View File

@ -45,13 +45,15 @@ func (l *lexer) emit(i *item) {
// "Lexer" functions
// Check if the server returns the DO-bit when set in the request.
func lexDoBitMirorred(l *lexer) stateFn {
func lexDoBitMirror(l *lexer) stateFn {
// The important part here is that the DO bit is on
l.fp.SetString("QUERY,NOERROR,qr,aa,tc,RD,ad,cd,z,1,0,0,0,DO,0")
l.q = dns.Question{".", dns.TypeNS, dns.ClassINET}
if l.probe().Do {
l.emit(&item{itemSoftware, NSD})
println(NSD)
// l.emit(&item{itemSoftware, NSD})
}
l.emit(&item{itemSoftware, BIND})
//l.emit(&item{itemSoftware, BIND})
println(BIND)
return nil
}

View File

@ -110,6 +110,10 @@ Flags:
if *dnssec || *nsid {
m.SetEdns0(dns.DefaultMsgSize, true)
}
if *fp {
startParse(nameserver)
return
}
for _, v := range qname {
m.Question[0] = dns.Question{v, qtype, qclass}
m.Id = dns.Id()