From: Xavier Noria Date: 2003-09-20T02:21:22+09:00 Subject: Re: Viruses --Boundary-00=_Zwza/YeCHK8xmuL Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Friday 19 September 2003 19:03, Albert Wagner wrote: > On Sat, 20 Sep 2003 00:02:44 +0900 > Robert Feldt wrote: > > > > I can recommend popfile which has solved my spam problem almost > > totally. It has a 99.35% classification rate when classifying > > incoming messages in 15 different categories. Its a bit of a mem > > hog though but on a modern day computer its not much of an issue. > > I use popfile also; which is fine for sorting them to trash. > However, these things all have huge attachments and my ISP keeps > telling me messages have been bounced because my space on their > server is full. I have to download each twenty minutes to keep it > from exceeding 10Mb. I don't whether we are all receiving the same stuff, my mailbox is flooded with messages that pretend to be security patches from you know who. Each message is +150K and I receiving one per minute or more. The technical service of my ISP was not very... proactive, so I hacked up this Perl POP3 customized filter that I send in case it can help to someone the same is helping me. It's simple, gets a TOP from the POP3 server, if the message has more than 150K or in the headers or first 20 lines of body MS or Microsoft is present prints the Subject and the From and asks whether you want to delete it from the server. MS or Microsoft are highlited in bold red for easy identification. It does not download any mail by any means. You need to install Net::POP3 to run it. -- fxn --Boundary-00=_Zwza/YeCHK8xmuL Content-Type: text/x-perl; charset="iso-8859-1"; name="pop3filter.pl" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pop3filter.pl" use Net::POP3; use Term::ANSIColor qw(:constants); use strict; use warnings; my $server = 'pop.example.com'; my $login = 'login'; my $password = 'password'; sub say { print @_, "\n" } # Constructors my $pop = Net::POP3->new($server); if ($pop->login($login, $password) > 0) { say "logged in"; my %msgnums = %{$pop->list}; # hashref of msgnum => size my $nmails = scalar keys %msgnums; foreach my $msgnum (keys %msgnums) { my @lines = @{$pop->top($msgnum, 20)}; my ($subject) = grep /^Subject:/i, @lines; my ($from) = grep /^From:/i, @lines; if ($msgnums{$msgnum} > 150000 || grep /\bM(?:S|icrosoft)\b/, @lines) { print "\n"; $from =~ s/\bM(?:S|icrosoft)\b/BOLD . RED . $& . RESET/e; $subject =~ s/\bM(?:S|icrosoft)\b/BOLD . RED . $& . RESET/e; print $from, $subject; my $answer = 'n'; do { print "delete that fucking crap? "; $answer = ; chomp $answer; } until $answer eq 'y' or $answer eq 'n'; if ($answer eq 'y') { $pop->delete($msgnum); --$nmails; } } } say "$nmails new mails"; } else { say "no new mails"; } $pop->quit; --Boundary-00=_Zwza/YeCHK8xmuL--