Skip to content
Snippets Groups Projects
Unverified Commit 3df1a1fc authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Connect to DB only for a short while

parent 2d1627dd
No related branches found
No related tags found
No related merge requests found
......@@ -58,13 +58,15 @@ my @private = (
qr/^f[ed]..:/
);
my $bl_stm = $dbh->prepare('SELECT server, remote, clients_total, score_total, mode FROM fake_blacklist');
$bl_stm->execute;
my $result = $dbh->selectall_arrayref('SELECT server, remote, clients_total, score_total, mode FROM fake_blacklist');
$dbh->rollback;
$dbh->disconnect;
#local $\ = "\n";
#local $, = ",";
my $gi = Geo::IP->new(GEOIP_MEMORY_CACHE);
print "server,ip,clients,score,mode,as,nic,email,country\n";
while (my ($server, $remote, @rest) = $bl_stm->fetchrow_array) {
for my $row (@$result) {
my ($server, $remote, @rest) = @$row;
if ($turris_addresses{$remote}) {
warn "Address $remote belongs to a turris router\n";
$forbidden = 1;
......@@ -81,6 +83,4 @@ while (my ($server, $remote, @rest) = $bl_stm->fetchrow_array) {
print "\n";
}
$dbh->rollback;
store $whois_cache, 'whois.cache';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment