Changeset 84
- Timestamp:
- 09/11/25 17:37:37 (3 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/uribl/import-cur.pl
r41 r84 3 3 ## 4 4 # $Id$ 5 # Copyright 2010 Kris Deugau <kdeugau@deepnet.cx>5 # Copyright 2010,2025 Kris Deugau <kdeugau@deepnet.cx> 6 6 # 7 7 # This program is free software: you can redistribute it and/or modify … … 23 23 use DBI; 24 24 25 use URIdb; 25 # push "the directory the script is in" into @INC 26 use FindBin; 27 use lib "$FindBin::RealBin/"; 26 28 27 my $uridb = new URIdb;29 use URIdb 2.0; 28 30 29 # default DB info - all other settings should be loaded from the DB. 30 my $dbhost = "localhost"; 31 my $dbname = "uridb"; 32 my $dbuser = "uridb"; 33 my $dbpass = "spambgone"; 31 die "Usage: import-cur.pl <list>\n" 32 if !$ARGV[0] 34 33 35 # Load a config ref containing DB host, name, user, and pass info based on 36 # from the server name + full script web path. This allows us to host 37 # multiple instances without having to duplicate the code. 38 # This file is a Perl fragment to be processed inline. 39 if (-e "/etc/uridb/uridb.conf") { 40 my $cfg = `cat /etc/uridb/uridb.conf`; 41 ($cfg) = ($cfg =~ /^(.+)$/s); # avoid warnings, failures, and general nastiness with taint mode 42 eval $cfg; 43 } 34 my $cfgname = shift @ARGV; 44 35 45 my $dbh = $uridb->connect( $dbhost, $dbname, $dbuser, $dbpass);36 my $dbh = $uridb->connect(configfile => "/etc/uridb/$cfgname.conf"); 46 37 47 38 my $datesth = $dbh->prepare("UPDATE urilist SET added=? WHERE uri=?"); … … 53 44 $config{$key} = $value; 54 45 } 46 $config{blzone} = 'uribl.company.com' if !$config{blzone}; 55 47 56 48 my @months = ('null','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); … … 83 75 my ($domain,$list,$rest) = split /:/; 84 76 ($list) = ($list =~ /\.(\d+)$/); 85 $domain =~ s/ \.uribl\.company\.com$//;77 $domain =~ s/$config{blzone}$//; 86 78 if (!$uridb->exists($domain)) { 87 79 print "adding $domain, $list\n";
Note:
See TracChangeset
for help on using the changeset viewer.