The primary mode of support here is peer-to-peer, meaning users helping other users. (please remember this at all times!)
Another try:
This forum is composed of people who have used spamcop and those who are learning about anti-spam efforts.
![]() ![]() |
| william_ |
Oct 27 2009, 04:46 AM
Post
#1
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 27-October 09 Member No.: 9655 |
Hi,
I use reporter.pl http://www.spamcop.net/reporter.pl. Does anyone have an amount of perl knowledge so that they can fix my modifications: CODE #!/usr/bin/perl open(SENDMAIL, "|/usr/sbin/sendmail -oi -t") || die "Cannot open sendmail output"; print SENDMAIL <<"ENDENDEND"; From: root\@mydomain.com To: testaddress\@mydomain.com Subject: report spam MIME-Version: 1.0 Content-Type: message/rfc822 ENDENDEND # check whether the ISP has sent the reply to a junkmail address, and then just cancel my $string = "spamcop"; #added while (defined($_ = <STDIN>)) { my $result = index($_, $string); #added if ($result == -1){ #added close (SENDMAIL); #added exit #added } #added print SENDMAIL; } close (SENDMAIL); The scri_pt above does not work correctly. if the lines with #added are removed then it works perfectly. The aim of the crude changes was to modifiy the behaviour of the scri_pt so that it checked for the presence of the word spamcop and then just abort sending that email. Thinking about it it would be nicer to forward the email to a different location upon finding mention of spamcop. This post has been edited by william_: Oct 27 2009, 04:48 AM |
| rconner |
Oct 27 2009, 08:29 AM
Post
#2
|
|
Advanced Member Group: Memberp Posts: 872 Joined: 23-January 07 From: Maryland, USA Member No.: 7388 |
You didn't say what doesn't work correctly about the program, but I'm guessing that it doesn't cancel the sending of messages when the spam attachment contains "spamcop" as you want it to do. I don't think this scri_pt was meant to be used to do what you are trying to do. Once you open the pipe to sendmail and begin sending it stuff, you can't back out -- even if you stop in the middle it is going to try to send what you've already given it. One could modify this program to collect all the spam data in a local variable and then test it before writing it to sendmail, but I think it might be simpler to run a grep command on your spam before handing it to this scri_pt. If the grep detects the forbidden word, then you can simply decline to send it using this scri_pt. You should be able to do this with a simple shell scri_pt, or perhaps with pipes. -- rick -------------------- Richard C. Conner, P.E.
http://www.rickconner.net/spamweb/ |
| william_ |
Oct 27 2009, 08:32 AM
Post
#3
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 27-October 09 Member No.: 9655 |
you are quite right Rick, i'll try some of your ideas.
|
| william_ |
Oct 28 2009, 09:22 AM
Post
#4
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 27-October 09 Member No.: 9655 |
Here is a working modification:
reporterv2.pl CODE #!/usr/bin/perl my $spamcop_email="--------------\@spam.spamcop.net"; my $admin_email="anaddress\@mydomain.com"; # for testing : # my $spamcop_email="address1\@mydomain.com"; # my $admin_email="address2\@mydomain.com"; my $destination=""; my $search_string = 'spamcop'; my $junk_email = ""; while (defined($_ = <STDIN>)) { $junk_mail = $junk_mail.$_; } my $result = index($junk_mail, $search_string); if ($result == -1){ $destination=$spamcop_email; } else { $destination=$admin_email; } my $message =<<"ENDENDEND"; From: adminaddress\@mydomain.com To: $destination Subject: report spam MIME-Version: 1.0 Content-Type: message/rfc822 $junk_mail ENDENDEND open(SENDMAIL, "|/usr/sbin/sendmail -oi -t") || die "Cannot open sendmail output"; print SENDMAIL $message; close (SENDMAIL); |
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 04:11 AM |