Fix the fingerprinting stuff
This commit is contained in:
parent
aef1004a9d
commit
2ad5598312
|
@ -9,30 +9,6 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// .,IN,NS,QUERY,NOERROR,qr,aa,tc,rd,ra,ad,cd,z,0,0,0,0,do,0,nsid
|
||||
|
||||
const (
|
||||
// Detected software types
|
||||
NSD = "NSD"
|
||||
BIND = "BIND"
|
||||
POWERDNS = "PowerDNS"
|
||||
WINDOWSDNS = "Windows DNS"
|
||||
MARADNS = "MaraDNS"
|
||||
NEUSTARDNS = "Neustar DNS"
|
||||
ATLAS = "Atlas"
|
||||
YADIFA = "Yadifa"
|
||||
|
||||
// Vendors
|
||||
ISC = "ISC"
|
||||
MARA = "MaraDNS.org" // check
|
||||
NLNETLABS = "NLnet Labs"
|
||||
MICROSOFT = "Microsoft"
|
||||
POWER = "PowerDNS.com"
|
||||
NEUSTAR = "Neustar"
|
||||
VERISIGN = "Verisign"
|
||||
EURID = "EurID"
|
||||
)
|
||||
|
||||
// probe creates a packet and sends it to the nameserver. It
|
||||
// returns a fingerprint.
|
||||
func probe(c *dns.Client, addr string, f *fingerprint) *fingerprint {
|
||||
|
@ -70,12 +46,11 @@ type fingerprint struct {
|
|||
// String creates a (short) string representation of a dns message.
|
||||
// If a bit is set we uppercase the name 'AD' otherwise it's lowercase 'ad'.
|
||||
// This leads to strings like: ".,IN,NS,QUERY,NOERROR,qr,aa,tc,RD,ad,cd,z,1,0,0,1,DO,4096,NSID"
|
||||
func (f *fingerprint) String() string {
|
||||
func (f *fingerprint) String() (s string) {
|
||||
if f == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
// Use the same order as in Perl's fpdns. But use much more flags.
|
||||
var s string
|
||||
// The Question.
|
||||
if len(f.Query.Name) == 0 {
|
||||
s = "."
|
||||
|
@ -127,13 +102,6 @@ func (f *fingerprint) String() string {
|
|||
return s
|
||||
}
|
||||
|
||||
// fingerStringNoSections returns the strings representation
|
||||
// without the sections' count and the EDNS0 stuff and the query
|
||||
func (f *fingerprint) StringNoSections() string {
|
||||
s := strings.SplitN(f.String(), ",", 14)
|
||||
return strings.Join(s[2:13], ",")
|
||||
}
|
||||
|
||||
// Return a new fingerprint, set from string
|
||||
func newFingerprint(s string) *fingerprint {
|
||||
f := new(fingerprint)
|
||||
|
@ -239,8 +207,14 @@ func toFingerprint(m *dns.Msg) *fingerprint {
|
|||
}
|
||||
f.Query.Qtype = m.Question[0].Qtype
|
||||
f.Query.Qclass = m.Question[0].Qclass
|
||||
} else {
|
||||
// Default, nil values
|
||||
f.Query.Name = "."
|
||||
f.Query.Qtype = 0
|
||||
f.Query.Qclass = 0
|
||||
}
|
||||
|
||||
|
||||
f.Opcode = h.Opcode
|
||||
f.Rcode = h.Rcode
|
||||
f.Response = h.Response
|
||||
|
|
|
@ -61,7 +61,7 @@ func main() {
|
|||
for i, f := range prints {
|
||||
d := f.compare(results[i])
|
||||
diff += d
|
||||
fmt.Printf("%s\t%d\t%s t%s\n", file, d, f.String(), results[i].String())
|
||||
fmt.Printf("%s\t%d\t%s %s\n", file, d, f.String(), results[i].String())
|
||||
}
|
||||
fmt.Printf("\t\t==\nDifferences:\t%d\n\n", diff)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue