WYAE - FWTOOLS Mailing List Archive


RE: [fwtools] real port numbers in a rules-dump
From:
Date: Thu, 15 Apr 2004 12:46:20 +0200

Hi

I added a few other things to my patch.=20
 - protocols and port numbers are now seperated by a '/'. First I think =
this combination
   is quite often used and second it doesn't conflict with portranges,
   which use the colon to seperate the source- and destionation port.=20
 - patch now works for negated ports (means... it prints it out)
 - new tags: 'from_ip' and 'to_ip'
   print out the source/destination host or network in an numerical way, =
if it's known.
   ex: 192.168.10.13
       192.168.10.0/24
       or 'any'

You can find it on: =
http://bounty.schuettel.ch/~reto/FW1Rules/numeric-pots.patch.gz

Is this stuff useful for anybody else?=20


- reto schuettel

-----Original Message-----
From: Schuettel, Reto=20
Sent: Mittwoch, 14. April 2004 11:20
To: fwtools@wyae.de
Cc: 'Volker Tanger'
Subject: RE: [fwtools] real port numbers in a rules-dump


Hmm..

the attached patch adds two new tags for "rule-templates"

<<>>: prints out the rule numbers. If the script can't determine a =

            service name it prints the servicename itself.=20
            ex: 80 53
<<>>/$rulenegated$txt/g;
=20
+	# Translate servicenames into port numbers
+	my @protocols;
+	my @ports;
+	foreach my $srv (split /=A7/, $access_services[$i]) {=20
+		push @ports,	($svc_dst_port{$srv} || $srv;
+		push @protocols, 	($svc_type{$srv} || "-") . ":" . =
($svc_dst_port{$srv} || $srv),
+	}
+
+	my $port_text 		=3D join($TemplateITEMSEP, @ports);
+	my $protocol_text 	=3D join($TemplateITEMSEP, @protocols);
+
+
+	$line =3D~ s/<<>>/$port_text/g;
+	$line =3D~ s/<<>>/$protocol_text/g;
 	$line =3D~ s/<<>>/$access_action[$i]/g;
 	$line =3D~ s/<<>>/$access_track[$i]/g;
 	$line =3D~ s/<<