#!/usr/bin/perl
#Kyoma TAKAHASHI   1999.08.11
#                  1999.09.09
#                  1999.11.09
#Takashi MIKAMI    2015.12.02
#Takahiro YAMAMOTO 2025.09.02

#      list-2-tcp file

$add = ':allow,RELAYCLIENT=""';
$bottom = '127.';

$rulefile = shift;

open(RULEFILE,"> $rulefile");

while(<>) {
        chop($ip = $_);
        if($ip ne '') {
        if(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) {
                ($_) = /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/;
                s/^0+//;
                s/\.0+/\./g;
                s/^\./0\./;
                s/\.$/\.0/;
                s/\.\./\.0\./g; s/\.\./\.0\./g;
                print RULEFILE $_,$add,"\n";
        }}
}

print RULEFILE $bottom,$add,"\n";

for my $i (180 .. 195) {
    print RULEFILE "133.87.1.$i:allow,SPFBEHAVIOR=\"0\"\n";
}

close(RULEFILE);


