Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 

Formatted Connection Table - ONELINER

HeikoAnkenbrand
Champion Champion
Champion

It is not nice when the "fw ctl conntab" is displayed in an unformatted format. In this way, one always searches for the correct connections with the parameters in the output. I have created a nice overview "sorted by rule numbers". An easy connection table version:-)

When you execute this oneliner, a new cli command "econntab" is created:

 


   cat <<EOT > /usr/bin/econntab printf '%.s-' {1..132};echo -e "\nRule Proto Source IP S-Port Destination IP D-Port Timeout State";printf 
...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free

Disclaimer: Check Point does not provide maintenance services or technical or customer support for third party content provided on this Site, including in CheckMates Toolbox. See also our Third Party Software Disclaimer.




(3)
4 Replies

IgorWeller
Participant


@HeikoAnkenbrand  very nice script. 👍

There is a small issue present. In the state field I see an Ifncin=21 in some lines.

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


HeikoAnkenbrand
Champion Champion
Champion

 

I have added the following to the latest version to eliminate the bug.

| sed -e 's/Ifn[c,s]in\=[0-9]*//g' | sed -e 's/Ifn[c,s]out\=[0-9]*//g'

 

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

Ralf_Schirmer
Participant

Great oneliner!

;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos

JuPo
Employee Employee
Employee

@HeikoAnkenbrand love the script.

BTW Is there any reason for not making the oneliner shorter using sed 's///g;s///g;s///g' instead of sed s///g | s///g | s ///g ?

printf '%.s-' {1..132};echo -e "\nRule Proto Source IP S-Port Destination IP D-Port Timeout State";printf '%.s-' {1..132};fw ctl conntab | awk '{print \$6 " "\$2 \$3 \$4 " "\$5 " "\$8}' | sed -e 's/src=//g;s/\],dest=\[/ /g;s/\],/ /g;s/)\;//g;s/\[//g;s/rule\=/ /g;s/\,/ /g;s/state\=/ /g;s/Ifn[c,s]in\=[0-9]*//g;s/Ifn[c,s]o

...;
TO ACCESS CHECKMATES TOOLBOX it's simple and free


0 Kudos