Skip to content

Commit

Permalink
print [Old rules] or [New rules] in the fingerprint output so we
Browse files Browse the repository at this point in the history
can get a handle on how well the new rules are working.
  • Loading branch information
wessels committed May 3, 2012
1 parent d48b141 commit ac6ef49
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions lib/Net/DNS/Fingerprint.pm
Expand Up @@ -1980,6 +1980,7 @@ sub string {
push @s, $r{product} if (defined $r{product});
push @s, $r{version} if (defined $r{version});
push @s, "[$r{option}]" if (defined $r{option});
push @s, "[$r{ruleset} Rules]" if (defined $r{ruleset});
}

push @s, $r{vstring} if (defined $r{vstring});
Expand Down Expand Up @@ -2029,18 +2030,23 @@ sub init {
my $qport = shift;

my %match =
$self->process($qserver, $qport, $initrule{header}, $initrule{query},
\@ruleset);

if (defined $match{product}) {
return %match;
} else {

#For backwards compatibility with old fingerprint code which never set the rd
$ignore_recurse = 1;
return $self->process($qserver, $qport, $old_initrule{header},
$old_initrule{query}, \@old_ruleset);
}
$self->process($qserver,
$qport,
$initrule{header},
$initrule{query},
\@ruleset,
"New");

return %match if (defined $match{product});

#For backwards compatibility with old fingerprint code which never set the rd
$ignore_recurse = 1;
return $self->process($qserver,
$qport,
$old_initrule{header},
$old_initrule{query},
\@old_ruleset,
"Old");
}

sub process {
Expand All @@ -2051,6 +2057,7 @@ sub process {
my $qheader = shift;
my $qstring = shift;
my $ruleref = shift;
my $rulenam = shift;
my $ver;
my $id;
my %ret;
Expand Down Expand Up @@ -2097,6 +2104,7 @@ sub process {
$ret{version} = $rule->{result}{version};
$ret{option} = $rule->{result}{option};
$ret{state} = $rule->{result}{state};
$ret{ruleset} = $rulenam;
} else {
$ret{result} = $rule->{result};
}
Expand Down Expand Up @@ -2126,7 +2134,7 @@ sub process {
if (defined $rule->{header} && defined $rule->{ruleset}) {
return $self->process(
$qserver, $qport, $rule->{header},
$qstring, $rule->{ruleset}
$qstring, $rule->{ruleset}, $rulenam
);
}

Expand Down

0 comments on commit ac6ef49

Please sign in to comment.