Jump to content
Sign in to follow this  
shentino

IPv6 support for spamcop reports

Recommended Posts

I've been getting a lot of spam lately in my inbox that can't be reported because spamcop appears to be choking on IPv6 style addressess in the headers.

Share this post


Link to post
Share on other sites

I dealt with this problem years ago by 'simply' renaming any Received: fields that contained ipv6 addresses to "X-Received-ipv6:" before submitting.

Spamcop then accepts and processes it normally, and the information is preserved.

Share this post


Link to post
Share on other sites

Using perl:

use Regexp::IPv6 qw($IPv6_re);

# prototype
sub filteripv6($);

# get your mail msg into $mail via stdin or open file, then
...
my $newmail = filteripv6($mail);

# do submit or save for submit as you like...
...

exit;
# ~~~~~~~~~~~~~~~~~~~
# replace received fields if ipv6 for spamcop
sub filteripv6($) {
    my $msg=shift;
    my ($header,$body) = split (/\r?\n\r?\n/, $msg, 2);
    $header=~s/\r\n/\n/gs;
    $header=~s/\n[ \t]+/\t/gs; # unwrap
    my $NewHeader="";
    foreach my $line (split(/\n/, $header)) {
        if ($line =~ /^Received:/i && $line =~ /$IPv6_re/) {
            $line =~ s/^Received:/X-Received-ipv6:/i;
        }
        $line=~s/\t/\n\t/sg; # rewrap
        $NewHeader.=$line. "\n";
    }
    $msg=$NewHeader."\n".$body;
    return($msg);
}

 

Share this post


Link to post
Share on other sites
On 6/15/2018 at 1:46 PM, shentino said:

I'm using the "show original" button in my gmail on a spam, and copypasting that into the spamcop report.  That part is where the error shows up.

Gmail seem to be the ONLY loons doing this?
 

presently gmail headers 2nd line needs deleting before submitting. Trouble is ISP's need FULL headers as evidence so past deleted line in comments

Delivered-To: x
Received: by 2002:a9d:21b7:0:0:0:0:0 with SMTP id s52-v6csp2028874otb; DELETE
        Sat, 28 Apr 2018 09:00:41 -0700 (PDT)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×