<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to delete an specific entry from the Connections Table with script in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98590#M7679</link>
    <description>&lt;P&gt;Hello Bob,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just tested your script, very good!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 19:20:19 GMT</pubDate>
    <dc:creator>Edilson_Lyrio</dc:creator>
    <dc:date>2020-10-08T19:20:19Z</dc:date>
    <item>
      <title>How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98552#M7671</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;I would like to share to everyone an &lt;STRONG&gt;&lt;U&gt;improvement&lt;/U&gt; &lt;/STRONG&gt;in the script to delete connections automatically.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;U&gt;Credits for original post&lt;/U&gt;: &lt;A href="https://community.checkpoint.com/t5/Enterprise-Appliances-and-Gaia/How-to-manually-delete-an-entry-from-the-Connections-Table/m-p/13122" target="_blank" rel="noopener"&gt;https://community.checkpoint.com/t5/Enterprise-Appliances-and-Gaia/How-to-manually-delete-an-entry-from-the-Connections-Table/m-p/13122&lt;/A&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;The script collects and converts the specific ips ,and delete connection of the table and can be utilized in all version R80.X&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;- create the file (ex:del_conn.sh)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;#!/bin/bash&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;logfile="$0.log"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;help() {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo -e "Drop connection from table\n"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo -e "Usage: "&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo -e "\t $0 &amp;lt;Source&amp;gt; &amp;lt;Destination&amp;gt;"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo -e "e.g."&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo -e "\t $0 10.10.10.10 20.20.20.20"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo -e ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;main() {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;if [[ $# -ne 2 ]]; then&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;help&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;exit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;fi&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;IPA=$1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;IPB=$2&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Are you sure to delete connections on IP $1 and $2? [y/N]"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;read confirm2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;if [ "$confirm2" != "y" -a "$confirm2" != "Y" ]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;then &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Aborted by user!!!!"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;exit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;fi&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;IPAHEX=`printf '%02x' ${IPA//./ }`;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;IPBHEX=`printf '%02x' ${IPB//./ }`;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Parameters: Source: $IPA ($IPAHEX) | Destination: $IPB ($IPBHEX)"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;OIFS=IFS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;IFS=$'\n'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;count=0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Querying table connection"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;for li in `fw tab -t connections -u | grep "$IPAHEX" | grep "$IPBHEX" | grep "^&amp;lt;0000000"`; do&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;count=$((count+1))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Record match: $li"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;for cmd in `echo "$li" | awk '{print $1" "$2" "$3" "$4" "$5" "$6}' |sed 's/ //g' |sed 's/&amp;lt;//g' |sed 's/&amp;gt;//g' |sed 's/;//g'`; do&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Running: fw tab -t connections -x -e $cmd"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;eval "fw tab -t connections -x -e $cmd"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Result: $?"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;done&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;done&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;IFS=OIFS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;echo "Founded: $count record(s)"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;main $1 $2 | tee -a $logfile&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;STRONG&gt;----------------&lt;/STRONG&gt;&lt;U&gt;&lt;STRONG&gt;Set in the file:&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;- dos2unix del_conn.sh&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;- chmod +x del_conn.sh&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;- test the script:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;STRONG&gt;Usage:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;./del_conn.sh &amp;lt;Source&amp;gt; &amp;lt;Destination&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;e.g.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;./del_conn.sh 10.10.10.10 20.20.20.20&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;[Expert@FW2_R8040:0]# ./del_conn.sh 10.10.10.125 8.8.8.8&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Are you sure to delete connections on IP 10.10.10.125 and 8.8.8.8? [y/N]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;y&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Parameters: Source: 10.10.10.125 (&lt;STRONG&gt;0a0a0a7d&lt;/STRONG&gt;) | Destination: 8.8.8.8 (&lt;STRONG&gt;08080808&lt;/STRONG&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Querying table connection&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Record match: &amp;lt;00000001, 08080808, 00000000, 0a0a0a7d, 00005871, 00000001&amp;gt; -&amp;gt; &amp;lt;00000000, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001&amp;gt; (00000805)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Running: fw tab -t connections -x -e 00000001,08080808,00000000,0a0a0a7d,00005871,00000001&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Entry &amp;lt;00000001, 08080808, 00000000, 0a0a0a7d, 00005871, 00000001&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;deleted from table connections&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Result: 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Record match: &amp;lt;00000001, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001&amp;gt; -&amp;gt; &amp;lt;00000000, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001&amp;gt; (00000802)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Running: fw tab -t connections -x -e 00000001,0a0a0a7d,00005871,08080808,00000000,00000001&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;lt;00000001, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001&amp;gt; not found in table connections&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Result: 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Record match: &amp;lt;00000000, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001; 00010001, 40006080, 00000000, 00000176, 00000000, 5f7f12a1, 00000000, c9b5574b, e911ea8e, 00000002, 00000002, 00000001, 00000001, 00000000, 00000000, 80000080, 00000000, 00000000, 956bc748, 00007f91, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, df1f9800, 00000000, 00000000, 00000000, 00000000, 00000000; 7/30&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Running: fw tab -t connections -x -e 00000000,0a0a0a7d,00005871,08080808,00000000,00000001&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;lt;00000000, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001&amp;gt; not found in table connections&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Result: 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Record match: &amp;lt;00000000, 08080808, 00000000, c0a80284, 0000a989, 00000001&amp;gt; -&amp;gt; &amp;lt;00000000, 0a0a0a7d, 00005871, 08080808, 00000000, 00000001&amp;gt; (00000806)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Running: fw tab -t connections -x -e 00000000,08080808,00000000,c0a80284,0000a989,00000001&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;lt;00000000, 08080808, 00000000, c0a80284, 0000a989, 00000001&amp;gt; not found in table connections&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Result: 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Founded: 4 record(s)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;[Expert@FW2_R8040:0]#&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 19:46:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98552#M7671</guid>
      <dc:creator>Edilson_Lyrio</dc:creator>
      <dc:date>2020-10-08T19:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98588#M7677</link>
      <description>&lt;P&gt;I had to do something similar a few years back and arrived at a slightly different solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;#!/bin/env bash

printUsage()
{
	echo "Note: this script must be run as root."
	echo ""
	echo "Usage:"
	echo "$0 [-l|-x] [-s IP] [-S port] [-d IP] [-D port] [-P protocol]"
	echo -e "\t-l\t\tOnly list matching connections. Do not prompt."
	echo -e "\t-x\t\tDelete matching connections without prompting."
	echo -e "\t\t\tDefault is to list matches and prompt for deletion."
	echo ""
	echo -e "\t-s IP\t\tSearch for the specified source IP address."
	echo -e "\t-S port\t\tSearch for the specified source port."
	echo -e "\t-d IP\t\tSearch for the specified destination IP address."
	echo -e "\t-D port\t\tSearch for the specified destination port."
	echo -e "\t-P protocol\tSearch for the specified IP protocol."
	echo -e "\t-h\t\tPrint this usage information."
}

if [ $# -eq 0 ]; then
	printUsage
	exit 1
fi

if [ $EUID -ne 0 ]; then
	echo "ERROR: This script must be run as root." &amp;gt;&amp;amp;2
	echo ""
	printUsage
	exit 1
fi

SOURCE_ADDR="[0-9a-f]+"
SOURCE_PORT="[0-9a-f]+"
DEST_ADDR="[0-9a-f]+"
DEST_PORT="[0-9a-f]+"
PROTOCOL="[0-9a-f]+"
OUTPUT="interactive"

while getopts "lxs:S:d:D:P:h" NUKE_OPTION; do
	case $NUKE_OPTION in
	l)
		OUTPUT="list"
		;;
	x)
		OUTPUT="delete"
		;;
	s)
		SOURCE_ADDR=$(printf '%02x' ${OPTARG//./ })
		;;
	S)
		SOURCE_PORT=$(printf '%08x' ${OPTARG//./ })
		;;
	d)
		DEST_ADDR=$(printf '%02x' ${OPTARG//./ })
		;;
	D)
		DEST_PORT=$(printf '%08x' ${OPTARG//./ })
		;;
	P)
		PROTOCOL=$(printf '%08x' ${OPTARG//./ })
		;;
	h)
		printUsage
		exit 0
		;;
	\?)
		echo "ERROR: Invalid option: -$OPTARG" &amp;gt;&amp;amp;2
		echo ""
		printUsage
		exit 1
		;;
	:)
		echo "ERROR: Option -$OPTARG requires an argument." &amp;gt;&amp;amp;2
		echo ""
		printUsage
		exit 1
		;;
	esac
done

CONNECTIONS=$(\
	fw tab -t connections -u \
	| egrep "&amp;lt;[0-9a-f]+, $SOURCE_ADDR, $SOURCE_PORT, $DEST_ADDR, $DEST_PORT, $PROTOCOL;" \
	| sed -r 's#&amp;lt;([0-9a-f, ]+);.+#\1#' \
	| sed -r 's# ##g')
if [ "$OUTPUT" == "interactive" ]; then
	echo "Matches:"
	echo "$CONNECTIONS"

	echo ""
	read -p "Clear these connections? (yes/[no]) " YN
	case $YN in
		[Yy][Ee][Ss])
			echo "$CONNECTIONS" | xargs -n 1 fw tab -t connections -x -e
			exit 0
			;;
		*)
			echo "Not deleting."
			exit 2
			;;
	esac
elif [ "$OUTPUT" == "list" ]; then
	echo "$CONNECTIONS"
	exit 0
elif [ "$OUTPUT" == "delete" ]; then
	echo "$CONNECTIONS" | xargs -n 1 fw tab -t connections -x -e
	exit 0
fi&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edited&lt;/STRONG&gt;: I split the big CONNECTIONS= pipeline into multiple lines to improve readability.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 16:09:16 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98588#M7677</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2022-03-03T16:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98589#M7678</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/7457"&gt;@Edilson_Lyrio&lt;/a&gt;&amp;nbsp;: Could you please put your code within &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt; tags as &lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/27871"&gt;@Bob_Zimmerman&lt;/a&gt;&amp;nbsp;did?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 19:20:17 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98589#M7678</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2020-10-08T19:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98590#M7679</link>
      <description>&lt;P&gt;Hello Bob,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just tested your script, very good!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 19:20:19 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98590#M7679</guid>
      <dc:creator>Edilson_Lyrio</dc:creator>
      <dc:date>2020-10-08T19:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98809#M7706</link>
      <description>&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;Is this script compatible with R80.X?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 05:00:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98809#M7706</guid>
      <dc:creator>Jarvis_Lin</dc:creator>
      <dc:date>2020-10-12T05:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98815#M7707</link>
      <description>&lt;P&gt;I assume so since nothing pre-R80 is supported any longer.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 05:18:11 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/98815#M7707</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-10-12T05:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99012#M7734</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/4351"&gt;@Jarvis_Lin&lt;/a&gt;&amp;nbsp;, yes the scrit work with the R80.X versions&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 18:12:06 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99012#M7734</guid>
      <dc:creator>Edilson_Lyrio</dc:creator>
      <dc:date>2020-10-13T18:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99013#M7735</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/687"&gt;@Danny&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;SPAN&gt;I tried to adjust the script but I had problems on the page.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 18:13:01 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99013#M7735</guid>
      <dc:creator>Edilson_Lyrio</dc:creator>
      <dc:date>2020-10-13T18:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99022#M7737</link>
      <description>&lt;P&gt;I've tested it on pre-R80.40 firewalls and it works. It should work the same on R80.40 (kernel 3.10), but I haven't tested it yet.&lt;/P&gt;&lt;P&gt;It definitely does not work for VSX right now. Adapting it for pre-R80.40 VSX should be trivial or a little past. Might try that soon.&lt;/P&gt;&lt;P&gt;R80.40 fundamentally changes how VSX works internally, so I don't know how much effort would be involved getting it working there (probably no more, but I haven't poked R80.40 VSX much yet).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Edited to add&lt;/STRONG&gt;: Turns out R80.40 changes where various commands are in the filesystem. The shebang at the top needs to be changed from /bin/env (which works on kernel 2.6) to /usr/bin/env (which is where it is on kernel 3.10). Seems to work just fine otherwise. Preliminary VSX support involved adding 12 lines, and changing five.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 21:08:19 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99022#M7737</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2020-10-13T21:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99025#M7739</link>
      <description>&lt;P&gt;I've found the WYSIWYG editor to be the easiest way to add code blocks. First, you hit the horizontal row of three dots to expand the toolbar. Then on the second row, under the closing quote mark, there is a &amp;lt;/&amp;gt; button. That lets you insert a code snippet. It opens a separate editor within the window just for the code.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 21:12:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99025#M7739</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2020-10-13T21:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99220#M7756</link>
      <description>&lt;P&gt;Here's an updated version with VSX support. As it is in this post, it's suitable for R80.40. I don't have any R80.30 firewalls around, but on R80.20 and earlier, the first line would need to be changed from "#!/usr/bin/env bash" to "#!/bin/env bash". That should be the only change needed between firewall versions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;#!/usr/bin/env bash

printUsage()
{
	echo "Note: this script must be run as root."
	echo ""
	echo "Usage:"
	echo "$0 [-l|-x] [-v &amp;lt;VSID&amp;gt;] [-s IP] [-S port] [-d IP] [-D port] [-P protocol]"
	echo -e "\t-l\t\tOnly list matching connections. Do not prompt."
	echo -e "\t-x\t\tDelete matching connections without prompting."
	echo -e "\t\t\tDefault is to list matches and prompt for deletion."
	echo ""
	echo -e "\t-v VSID\t\tRun in a specific VSID."
	echo -e "\t\t\tDefault is to run in VS 0."
	echo ""
	echo -e "\t-s IP\t\tSearch for the specified source IP address."
	echo -e "\t-S port\t\tSearch for the specified source port."
	echo -e "\t-d IP\t\tSearch for the specified destination IP address."
	echo -e "\t-D port\t\tSearch for the specified destination port."
	echo -e "\t-P protocol\tSearch for the specified IP protocol."
	echo -e "\t-h\t\tPrint this usage information."
}

if [ $# -eq 0 ]; then
	printUsage
	exit 1
fi

if [ $EUID -ne 0 ]; then
	echo "ERROR: This script must be run as root." &amp;gt;&amp;amp;2
	echo ""
	printUsage
	exit 1
fi

OUTPUT="interactive"
VSID=0
SOURCE_ADDR="[0-9a-f]+"
SOURCE_PORT="[0-9a-f]+"
DEST_ADDR="[0-9a-f]+"
DEST_PORT="[0-9a-f]+"
PROTOCOL="[0-9a-f]+"

while getopts "lx:v:s:S:d:D:P:h" NUKE_OPTION; do
	case $NUKE_OPTION in
	l)
		OUTPUT="list"
		;;
	x)
		OUTPUT="delete"
		;;
	v)
		VSID="${OPTARG}"
		;;
	s)
		SOURCE_ADDR=$(printf '%02x' ${OPTARG//./ })
		;;
	S)
		SOURCE_PORT=$(printf '%08x' ${OPTARG//./ })
		;;
	d)
		DEST_ADDR=$(printf '%02x' ${OPTARG//./ })
		;;
	D)
		DEST_PORT=$(printf '%08x' ${OPTARG//./ })
		;;
	P)
		PROTOCOL=$(printf '%08x' ${OPTARG//./ })
		;;
	h)
		printUsage
		exit 0
		;;
	\?)
		echo "ERROR: Invalid option: -$OPTARG" &amp;gt;&amp;amp;2
		echo ""
		printUsage
		exit 1
		;;
	:)
		echo "ERROR: Option -$OPTARG requires an argument." &amp;gt;&amp;amp;2
		echo ""
		printUsage
		exit 1
		;;
	esac
done

if [ $(cpprod_util FwIsVSX) == "0" ]; then
	FW_TAB_CMD="fw tab"
else
	FW_TAB_CMD="fw -vs ${VSID} tab"
fi

CONNECTIONS=$(\
	$FW_TAB_CMD -t connections -u \
	| egrep "&amp;lt;[0-9a-f]+, $SOURCE_ADDR, $SOURCE_PORT, $DEST_ADDR, $DEST_PORT, $PROTOCOL;" \
	| sed -r 's#&amp;lt;([0-9a-f, ]+);.+#\1#' \
	| sed -r 's# ##g')

if [ "$OUTPUT" == "interactive" ]; then
	echo "Matches:"
	echo "$CONNECTIONS"

	echo ""
	read -p "Clear these connections? (yes/[no]) " YN
	case $YN in
	[Yy][Ee][Ss])
		echo "$CONNECTIONS" | xargs -n 1 $FW_TAB_CMD -t connections -x -e
		exit 0
		;;
	*)
		echo "Not deleting."
		exit 2
		;;
	esac
elif [ "$OUTPUT" == "list" ]; then
	echo "$CONNECTIONS"
elif [ "$OUTPUT" == "delete" ]; then
	echo "$CONNECTIONS" | xargs -n 1 $FW_TAB_CMD -t connections -x -e
fi&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 12:34:19 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/99220#M7756</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2020-10-22T12:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete an specific entry from the Connections Table with script</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/142920#M22153</link>
      <description>&lt;P&gt;I made a mistake in the options string on both scripts. 'lx:v:s:S:d:D:P:h' should instead be 'lxv:s:S:d:D:P:h', with no colon after the x. The colon means it expects an argument. If one isn't provided, it will catch the "ERROR: Option -$OPTARG requires an argument." at the bottom.&lt;/P&gt;
&lt;P&gt;I was able to edit the first script, but now the post editor isn't showing up at all, so I can't fix it in the second.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 16:54:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/How-to-delete-an-specific-entry-from-the-Connections-Table-with/m-p/142920#M22153</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2022-03-03T16:54:42Z</dc:date>
    </item>
  </channel>
</rss>

