Changeset 37
- Timestamp:
- 02/18/05 19:42:18
- Files:
-
- trunk/plugins/dnsbl/dnsbl.pl (modified) (5 diffs)
- trunk/plugins/dnsbl/mt-dnsbl.cgi (modified) (15 diffs)
- trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/dnsbl/dnsbl.pl
r34 r37 1 package MT::Plugin:: DNSBL;1 package MT::Plugin::SpamLookup; 2 2 3 3 use strict; … … 8 8 @ISA = qw(MT::Plugin); 9 9 10 # A DNSBL comment filter plugin for Movable Type 11 # MT implementation inspired by http://weblog.sinteur.com/index.php?p=7967 12 13 #use SelfLoader; 14 15 my $plugin = new MT::Plugin::DNSBL({ 16 name => 'DNSBL', 17 config_link => 'mt-dnsbl.cgi', 10 use SelfLoader; 11 12 my $plugin = new MT::Plugin::SpamLookup({ 13 name => 'SpamLookup', 14 config_link => 'mt-spamlookup.cgi', 18 15 description => 'Controls feedback from open proxies and spammy URLs', 19 16 doc_link => undef … … 35 32 } 36 33 34 1; 35 36 __DATA__ 37 37 sub config_params { 38 38 qw( comment_filter ping_filter … … 222 222 $ban->blog_id($obj->blog_id); 223 223 $ban->save; 224 $app->log(" DNSBL: permanently banning IP ".$obj->ip." due to open proxy testing");224 $app->log("SpamLookup: permanently banning IP ".$obj->ip." due to open proxy testing"); 225 225 } 226 226 … … 559 559 s/(&\#(\d+);?)/$2 < 256 ? chr($2) : $1/eg; 560 560 s/(&\#[xX]([0-9a-fA-F]+);?)/$c = hex($2); $c < 256 ? chr($c) : $1/eg; 561 # we don't care about accented characters for this. we're just562 # reversing for simple ASCII characters563 #s/(&(\w+);?)/$entity2char{$2} || $1/eg;564 561 } 565 562 $str; 566 563 } 567 568 1;trunk/plugins/dnsbl/mt-dnsbl.cgi
r36 r37 31 31 } 32 32 33 package MT::App:: DNSBL;33 package MT::App::SpamLookup; 34 34 35 35 use MT::App::CMS; … … 56 56 $app->{cfg}->set('AltTemplatePath', ''); 57 57 $app->{requires_login} = 1; 58 $app->{breadcrumbs} = [ { bc_name => ' DNSBLConfiguration',58 $app->{breadcrumbs} = [ { bc_name => 'SpamLookup Configuration', 59 59 bc_uri => '?__mode=show' } ]; 60 60 $app; … … 66 66 67 67 $app->add_breadcrumb('View Cache' => '?__mode=view_cache'); 68 my $plugin = MT::Plugin:: DNSBL->instance;68 my $plugin = MT::Plugin::SpamLookup->instance; 69 69 require MT::PluginData; 70 70 my $pdata = MT::PluginData->load({ … … 75 75 my @data; 76 76 my %actions = ( 77 MT::Plugin:: DNSBL::BLOCK() => 'Blocked',78 MT::Plugin:: DNSBL::MODERATE() => 'Moderated',79 MT::Plugin:: DNSBL::ACCEPT() => 'Accepted',77 MT::Plugin::SpamLookup::BLOCK() => 'Blocked', 78 MT::Plugin::SpamLookup::MODERATE() => 'Moderated', 79 MT::Plugin::SpamLookup::ACCEPT() => 'Accepted', 80 80 ); 81 81 $param{$_} = 0 foreach (qw(blocked_count moderated_count … … 97 97 $c->{$ip}->{banned} = @ip ? 1 : 0; 98 98 push @data, $c->{$ip}; 99 $param{blocked_count}++ if $result == MT::Plugin:: DNSBL::BLOCK();100 $param{moderated_count}++ if $result == MT::Plugin:: DNSBL::MODERATE();101 $param{blocked_hits} += $hits if $result == MT::Plugin:: DNSBL::BLOCK();102 $param{moderated_hits} += $hits if $result == MT::Plugin:: DNSBL::MODERATE();99 $param{blocked_count}++ if $result == MT::Plugin::SpamLookup::BLOCK(); 100 $param{moderated_count}++ if $result == MT::Plugin::SpamLookup::MODERATE(); 101 $param{blocked_hits} += $hits if $result == MT::Plugin::SpamLookup::BLOCK(); 102 $param{moderated_hits} += $hits if $result == MT::Plugin::SpamLookup::MODERATE(); 103 103 } 104 104 if (scalar(@data)) { … … 117 117 MT::Util::mark_odd_rows(\@data); 118 118 } 119 my $data = MT::Plugin:: DNSBL->instance->get_config_hash();119 my $data = MT::Plugin::SpamLookup->instance->get_config_hash(); 120 120 my $service=$data->{cache_ip_infoservice}; 121 121 if($service =~ /%ip%/) { … … 165 165 my (%param) = @_; 166 166 167 my $plugin = MT::Plugin:: DNSBL->instance;167 my $plugin = MT::Plugin::SpamLookup->instance; 168 168 require MT::PluginData; 169 169 my @pdata = MT::PluginData->load({ … … 178 178 my $is = 0; 179 179 @path_segs = grep { $is++ if $_ eq 'plugins'; $is } @path_segs; 180 $_[0]->path . (join '/', @path_segs, "mt- dnsbl.cgi");180 $_[0]->path . (join '/', @path_segs, "mt-spamlookup.cgi"); 181 181 } 182 182 183 183 sub pre_run { 184 184 my $app = shift; 185 die $app->error("You have no permissions to configure the DNSBLplugin.")185 die $app->error("You have no permissions to configure the SpamLookup plugin.") 186 186 unless $app->{author}->can_create_blog; 187 187 } … … 192 192 my $orig_ip = $ip; 193 193 194 my $data = MT::Plugin:: DNSBL->instance->get_config_hash();194 my $data = MT::Plugin::SpamLookup->instance->get_config_hash(); 195 195 196 196 my $domain; … … 206 206 foreach my $service (@ipbl_service) { 207 207 $service =~ s/^\.//; 208 if (MT::Plugin:: DNSBL::checkdns("$d.$c.$b.$a.$service.")) {208 if (MT::Plugin::SpamLookup::checkdns("$d.$c.$b.$a.$service.")) { 209 209 push @log, { message => "Found IP $ip on service $service" }; 210 210 } … … 213 213 if ($domain && $data->{domainbl_enabled}) { 214 214 my @domainbl_service = split /\s+/, $data->{domainbl_service}; 215 my @domains = MT::Plugin:: DNSBL::extract_urls($domain);216 @domains = MT::Plugin:: DNSBL::extract_urls('http://' . $domain)215 my @domains = MT::Plugin::SpamLookup::extract_urls($domain); 216 @domains = MT::Plugin::SpamLookup::extract_urls('http://' . $domain) 217 217 if !@domains; 218 218 foreach my $domain (@domains) { … … 222 222 foreach my $service (@domainbl_service) { 223 223 $service =~ s/^\.//; 224 if (MT::Plugin:: DNSBL::checkdns("$domain.$service.")) {224 if (MT::Plugin::SpamLookup::checkdns("$domain.$service.")) { 225 225 push @log, { message => "Found domain $domain on service $service" }; 226 226 } … … 236 236 my $app = shift; 237 237 my (%param) = @_; 238 my @config = MT::Plugin:: DNSBL->instance->config_params;239 my $data = MT::Plugin:: DNSBL->instance->get_config_hash();238 my @config = MT::Plugin::SpamLookup->instance->config_params; 239 my $data = MT::Plugin::SpamLookup->instance->get_config_hash(); 240 240 $param{$_} = $data->{$_} foreach @config; 241 $app->build_page(' dnsbl.tmpl', \%param);241 $app->build_page('spamlookup.tmpl', \%param); 242 242 } 243 243 … … 246 246 my $auth = $app->{author}; 247 247 my $q = $app->{query}; 248 my $pd = MT::Plugin:: DNSBL->instance->get_config_obj;248 my $pd = MT::Plugin::SpamLookup->instance->get_config_obj; 249 249 my $config = $pd->data() || {}; 250 my @config = MT::Plugin:: DNSBL->instance->config_params;250 my @config = MT::Plugin::SpamLookup->instance->config_params; 251 251 foreach (@config) { 252 252 $config->{$_} = $q->param($_) || undef; … … 267 267 268 268 eval { 269 my $app = MT::App:: DNSBL->new(269 my $app = MT::App::SpamLookup->new( 270 270 Config => $MT_DIR . 'mt.cfg', 271 271 Directory => $MT_DIR 272 ) or die MT::App:: DNSBL->errstr;272 ) or die MT::App::SpamLookup->errstr; 273 273 local $SIG{__WARN__} = sub { $app->trace ($_[0]) }; 274 274 $app->run; trunk/readme.txt
r30 r37 1 DNSBL 1 SpamLookup 2 2 A plugin for Movable Type 3 3 … … 28 28 will need to create it): 29 29 30 mt/plugins/ dnsbl/31 dnsbl.pl32 mt-dnsbl.cgi33 dnsbltool30 mt/plugins/spamlookup/ 31 spamlookup.pl 32 mt-spamlookup.cgi 33 sltool 34 34 35 35 And these files into this location: 36 36 37 mt/plugins/ dnsbl/tmpl/38 dnsbl.tmpl39 view_cache.tmpl37 mt/plugins/spamlookup/tmpl/ 38 spamlookup.tmpl 39 view_cache.tmpl 40 40 41 Of these files, mt- dnsbl.cgi and dnsbltool should have "execute"41 Of these files, mt-spamlookup.cgi and sltool should have "execute" 42 42 permission. The other files must simply be readable. 43 43 … … 56 56 57 57 Upon installing the plugin, you can go to the Movable Type main menu 58 and click on the ' DNSBL' link now available under the "Plugins" list.58 and click on the 'SpamLookup' link now available under the "Plugins" list. 59 59 If you do not see such a link, the plugin is not installed properly. 60 60 … … 81 81 legitimate cases. 82 82 83 * Link count limitation. Moderate/Block comments and trackbacks83 * Link count limitation. Moderate/Block comments and TrackBacks 84 84 based on the number of links that appear in the message. 85 85 … … 99 99 HISTORY 100 100 101 2/8/2005 - 2.0 release 101 2/18/2005 - 2.0 release 102 * Renamed to SpamLookup. 102 103 * Integrated MT-ProxyPlug functionality by Tobias Hoellrich. 103 104 * Added domain-based blacklisting; extracts URLs mentioned and checks
