Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added count to search output

  • Loading branch information...
commit 82005933a0ccc165794d3bd17650c791928799e4 1 parent b517a8b
gamelinux authored
Showing with 9 additions and 7 deletions.
  1. +2 −0  tools/pdns2db.pl
  2. +7 −7 tools/search-pdns.pl
View
2  tools/pdns2db.pl
@@ -282,6 +282,8 @@ sub parseLogfile {
put_dns_to_db(@elements) if $NODB == 0;
} elsif (not defined $HASH_DBONLYLIST) {
put_dns_to_db(@elements) if $NODB == 0;
+ } else {
+ put_dns_to_db(@elements) if $NODB == 0;
}
}
close(LOGFILE);
View
14 tools/search-pdns.pl
@@ -93,7 +93,7 @@ =head1 SYNOPSIS
our ($QUERY, $QUERY1, $QUERY2) = q();
-$QUERY = qq[SELECT query, answer, first_seen, last_seen, ttl, maptype FROM pdns WHERE ];
+$QUERY = qq[SELECT query, answer, first_seen, last_seen, ttl, count, maptype FROM pdns WHERE ];
if (defined $FROM_DATE ) {
if ($FROM_DATE=~ /^\d\d\d\d\-\d\d\-\d\d$/) {
@@ -151,14 +151,14 @@ =head1 SYNOPSIS
my $cnt = 0;
print " === PassiveDNS ===\n\n";
-print " FirstSeen | LastSeen | TYPE | TTL | Query | Answer\n";
-print "---------------------------------------------------------------------------------------------------------------------\n";
-while (my ($query, $answer, $firstseen, $lastseen, $ttl, $maptype) = $pri->fetchrow_array()) {
+print " FirstSeen | LastSeen | TYPE | TTL | Query | Answer | Count\n";
+print "------------------------------------------------------------------------------------------------------------------------------\n";
+while (my ($query, $answer, $firstseen, $lastseen, $ttl, $count, $maptype) = $pri->fetchrow_array()) {
next if not defined $query or not defined $answer;
$cnt++;
- #my $FS = strftime "%Y-%m-%d %H:%M:%S", localtime($firstseen);
- #my $LS = strftime "%Y-%m-%d %H:%M:%S", localtime($lastseen);
- printf("%20s | %20s | %5s | %6s | %-34s | %12s\n", $firstseen, $lastseen, $maptype, $ttl, $query, $answer);
+ #printf("%20s | %20s | %5s | %6s | %-34s | %12s\n", $firstseen, $lastseen, $maptype, $ttl, $query, $answer);
+ printf("%20s | %19s | %5s | %6s | %-34s | %14s | %8s\n", $firstseen, $lastseen, $maptype, $ttl, $query, $answer, $count);
+
}
print "Displayed $cnt (sql limit: $DLIMIT)\n";
Please sign in to comment.
Something went wrong with that request. Please try again.