From b9960f42edb60968b7283ef653c97b9610945e3d Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 19 Sep 2011 22:58:36 +0200 Subject: [PATCH] tweaks --- _examples/q/fp.go | 19 +++++++++++++++---- _examples/q/lex.go | 8 +++++--- _examples/q/q.go | 4 ++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/_examples/q/fp.go b/_examples/q/fp.go index 28bfebfc..9cd138bc 100644 --- a/_examples/q/fp.go +++ b/_examples/q/fp.go @@ -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: // ... diff --git a/_examples/q/lex.go b/_examples/q/lex.go index 831d0751..71932408 100644 --- a/_examples/q/lex.go +++ b/_examples/q/lex.go @@ -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 } diff --git a/_examples/q/q.go b/_examples/q/q.go index 74a4e0c0..d873922b 100644 --- a/_examples/q/q.go +++ b/_examples/q/q.go @@ -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()