<?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: HowTo - Export a Security Policy to Excel in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234426#M8883</link>
    <description>&lt;P&gt;Thank you&amp;nbsp; very much for your support on this.&lt;/P&gt;&lt;P&gt;We have identified that the number of rules is matching and the first and last hits seem to be correct.&lt;/P&gt;&lt;P&gt;It was confusing that the SmartConsole is showing a later first hit than the "Show Package Tool" exports and also different counters.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;Rule 1 in Smart Console&lt;BR /&gt;- Hits: 6&lt;BR /&gt;- First Hit: 20.07.2023&lt;BR /&gt;- Last Hit: 10.03.2024&lt;/P&gt;&lt;P&gt;Rule 1 in Show Package Tool Export:&lt;BR /&gt;- Hits: 8&lt;BR /&gt;- First Hit: 25.08.2022&lt;BR /&gt;- Last Hit:&amp;nbsp;10.03.2024&lt;/P&gt;&lt;P&gt;Last Hit seems to match for all rules but not the First Hit entries. Show Package Tool seem to have a longer history, thus, may also show higher hit counts related to the longer history.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2024 11:38:00 GMT</pubDate>
    <dc:creator>dunkelmorten</dc:creator>
    <dc:date>2024-12-03T11:38:00Z</dc:date>
    <item>
      <title>HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132296#M6356</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="cpxls.png" style="width: 254px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/14053iFC8F8770040B0BB1/image-dimensions/254x76?v=v2" width="254" height="76" role="button" title="cpxls.png" alt="cpxls.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If you'd like to export your Check Point security policy into Microsoft Excel, look no further.&lt;BR /&gt;Within Excel you can then easily sort rules by their hit count, first hit, last hit, you name it. So let's start.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use Check Point's&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk120342" target="_self"&gt;Show Package Tool&lt;/A&gt; to export your security policy to HTML&lt;/SPAN&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;SSH login into the export mode of your SmartCenter and run&amp;nbsp;&lt;CODE&gt;$MDS_FWDIR/scripts/web_api_show_package.sh -n 443 -c&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;Copy the resulting .tgz to your Admin PC and unarchive to a new folder&lt;/LI&gt;
&lt;LI&gt;Open the exported security policy in your web browser of choice&lt;/LI&gt;
&lt;LI&gt;View the generated html via &lt;A href="https://developer.chrome.com/docs/devtools/dom/" target="_self"&gt;DOM inspect&lt;/A&gt; and save it into a new .html file&lt;/LI&gt;
&lt;LI&gt;Remove unnecessary JavaScript code from that .html with your text editor of choice&lt;/LI&gt;
&lt;LI&gt;Replace&amp;nbsp;&lt;CODE&gt;&amp;lt;div&amp;gt;, &amp;lt;/div&amp;gt;&lt;/CODE&gt;&amp;nbsp;and &lt;CODE&gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;/CODE&gt;with #!%!#&lt;/LI&gt;
&lt;LI&gt;Open the .html file with a web browser and copy all content to your clipboard (crtl-a, crtl-c)&lt;/LI&gt;
&lt;LI&gt;Create an empty Excel sheet and paste your clipboard to it (crtl-v)
&lt;UL&gt;
&lt;LI&gt;Replace the string #!%!# with crtl-j (&lt;EM&gt;creates newlines within the same row&lt;/EM&gt;)&lt;/LI&gt;
&lt;LI&gt;Remove any groupings to make sorting functional&lt;/LI&gt;
&lt;LI&gt;Adjust formatting according to your needs (&lt;EM&gt;freeze title pane, hide section titles to allow sorting by hit count etc. etc.&lt;/EM&gt;)&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;Repeat the steps above for all your security policies&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Want to add &lt;EM&gt;&lt;STRONG&gt;first hit&lt;/STRONG&gt;&lt;/EM&gt; and &lt;EM&gt;&lt;STRONG&gt;last hit&lt;/STRONG&gt;&lt;/EM&gt; columns to your Excel sheet? Here you go:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Unarchive the .tgz from step 1 above into a new directory within expert mode on your SmartCenter Server&lt;/LI&gt;
&lt;LI&gt;Run the following one-liner on the extracted &lt;EM&gt;policy.json&lt;/EM&gt; file
&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;cat policy.json|tr ',' '\n'|egrep -A6 hits|tr -d '"{}'|sed -e '/hits:level:zero/,/--/c\hits:level:zero\nfine\n--'|egrep 'first-date|last-date|posix|fine'|tr -d '\n'|sed 's/fine/\&amp;lt;\/td\&amp;gt;\&amp;lt;\/tr\&amp;gt;\n\&amp;lt;tr\&amp;gt;\&amp;lt;td\&amp;gt;-\&amp;lt;\/td\&amp;gt;\&amp;lt;td\&amp;gt;-\&amp;lt;\/td\&amp;gt;\&amp;lt;td\&amp;gt;-\&amp;lt;\/td\&amp;gt;\&amp;lt;td\&amp;gt;-/g'|sed 's/first-date:iso-8601:/\&amp;lt;\/td\&amp;gt;\&amp;lt;\/tr\&amp;gt;\n\&amp;lt;tr\&amp;gt;\&amp;lt;td\&amp;gt;/g'|sed 's/posix:/\&amp;lt;\/td\&amp;gt;\&amp;lt;td\&amp;gt;/g'|sed 's/last-date:iso-8601:/\&amp;lt;\/td\&amp;gt;\&amp;lt;td\&amp;gt;/g'&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;Copy the output from step 2 into a new .html file and open it with a Web browser on your Admin PC&lt;/LI&gt;
&lt;LI&gt;Copy the web content into your clipboard (crtl-a, crtl-c)&lt;/LI&gt;
&lt;LI&gt;Paste your clipboard into two new colums within your Excel sheet (crtl-v)&lt;/LI&gt;
&lt;LI&gt;Adjust formatting and make sortable&lt;/LI&gt;
&lt;LI&gt;Verify result &amp;gt;&amp;nbsp;&lt;STRONG&gt;Done!&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Want a video that documents the described procedure? Like this thread and I'll create one.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 17:53:34 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132296#M6356</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2023-11-14T17:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132305#M6357</link>
      <description>&lt;P&gt;Thanks Danny, very nice! Man, if you could hit us with a video, that would be superb!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Wed, 20 Oct 2021 23:21:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132305#M6357</guid>
      <dc:creator>the_rock</dc:creator>
      <dc:date>2021-10-20T23:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132317#M6358</link>
      <description>&lt;P&gt;Nice! Add the video,&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/687"&gt;@Danny&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 07:00:53 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132317#M6358</guid>
      <dc:creator>_Val_</dc:creator>
      <dc:date>2021-10-21T07:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132562#M6367</link>
      <description>&lt;P&gt;Interesting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of multiple pipelines to sed, you can use '-e' to chain the expressions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sed -e '/blah/,/foo/s/foo/bar/g' -e '/match/s/thing1/thing2/g' -e 's/etc/var/g'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 17:31:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132562#M6367</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2021-10-25T17:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132568#M6369</link>
      <description>&lt;P&gt;Nice Danny!&lt;/P&gt;
&lt;P&gt;I assume this may need R81.10 so it actually has hit count info, does it also deal with hit count on NAT policy? and a Video would be awesome!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:50:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/132568#M6369</guid>
      <dc:creator>genisis__</dc:creator>
      <dc:date>2021-10-25T19:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/166948#M7401</link>
      <description>&lt;P class="lia-indent-padding-left-30px"&gt;The only issue I find with this is both disabled rules and negated sections are not carried over.&amp;nbsp; In the HTML, the row is highlighted with at tr description.&amp;nbsp; These are shown as:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;lt;tr class="disabled_rule"&amp;gt;&amp;lt;td class="rule_number"&amp;gt;1&amp;lt;/td&amp;gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;BR /&gt;&lt;BR /&gt;.disabled_rule {&lt;BR /&gt;color: lightgray;&lt;BR /&gt;}&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;.disabled_rule .rule_number:after {&lt;BR /&gt;content: "\A[Disabled]";&lt;BR /&gt;display: block;&lt;BR /&gt;}&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;.negate:before {&lt;BR /&gt;content: "---Negated---\A";&lt;BR /&gt;display: block;&lt;BR /&gt;color: red;&lt;BR /&gt;}&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;.negate:after {&lt;BR /&gt;content: "------------------";&lt;BR /&gt;display: block;&lt;BR /&gt;color: red;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;That yields a grey row with disabled following it.&amp;nbsp; It does not change data "1".&amp;nbsp; So there is no indication that the first rule is disabled (or any sections are negated).&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="disabled.png" style="width: 238px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/19026iBB45C8E8AA34ABC9/image-size/large?v=v2&amp;amp;px=999" role="button" title="disabled.png" alt="disabled.png" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Still trying to figure out if I can use the data query tool to tie in the objects and security file jsons to yield a result.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 16:59:27 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/166948#M7401</guid>
      <dc:creator>George_Ellis</dc:creator>
      <dc:date>2023-01-06T16:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234346#M8877</link>
      <description>&lt;P&gt;Thank you very much. Nice approach.&lt;BR /&gt;Tried this on MDS but when comparing output with Hit Counts of the rule set it doesn't seem to match.&lt;/P&gt;&lt;P&gt;Turn it to CSV with ; as delimeter.&lt;BR /&gt;Having a smaller rule set with 312 rules, checking rule 305 examplaric it is showing: First Hit 05.12.2022 08:20, Last Hit 02.12.2024 12:28&lt;BR /&gt;The one liner is returning 312 lines but checking line 305 is showing: 2022-08-26T12:45+0200;1661510725000;2024-12-02T11:53+0100;1733136802000;&lt;/P&gt;&lt;P&gt;Any idea on this?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 15:14:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234346#M8877</guid>
      <dc:creator>dunkelmorten</dc:creator>
      <dc:date>2024-12-02T15:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234348#M8878</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/86502"&gt;@dunkelmorten&lt;/a&gt;&amp;nbsp;: I sent you a PM. Let's check this together. Do you have any global rules in place?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 15:30:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234348#M8878</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2024-12-02T15:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234349#M8879</link>
      <description>&lt;P&gt;There were no global rules in place in this policy, but on other policies in the same domain.&lt;/P&gt;&lt;P&gt;Global object usages were already replaced by local objects across this policy, but other policies in this domain are still using global objects. But I guess as long as the affected policy is not using any global stuff it doesn't matter at all, isn't it?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 15:35:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234349#M8879</guid>
      <dc:creator>dunkelmorten</dc:creator>
      <dc:date>2024-12-02T15:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234426#M8883</link>
      <description>&lt;P&gt;Thank you&amp;nbsp; very much for your support on this.&lt;/P&gt;&lt;P&gt;We have identified that the number of rules is matching and the first and last hits seem to be correct.&lt;/P&gt;&lt;P&gt;It was confusing that the SmartConsole is showing a later first hit than the "Show Package Tool" exports and also different counters.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;Rule 1 in Smart Console&lt;BR /&gt;- Hits: 6&lt;BR /&gt;- First Hit: 20.07.2023&lt;BR /&gt;- Last Hit: 10.03.2024&lt;/P&gt;&lt;P&gt;Rule 1 in Show Package Tool Export:&lt;BR /&gt;- Hits: 8&lt;BR /&gt;- First Hit: 25.08.2022&lt;BR /&gt;- Last Hit:&amp;nbsp;10.03.2024&lt;/P&gt;&lt;P&gt;Last Hit seems to match for all rules but not the First Hit entries. Show Package Tool seem to have a longer history, thus, may also show higher hit counts related to the longer history.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 11:38:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234426#M8883</guid>
      <dc:creator>dunkelmorten</dc:creator>
      <dc:date>2024-12-03T11:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: HowTo - Export a Security Policy to Excel</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234432#M8884</link>
      <description>&lt;P&gt;I'm glad I could be of help.&lt;BR /&gt;It feels good to see taht my oneliner still works and is useful to people.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 09:03:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/HowTo-Export-a-Security-Policy-to-Excel/m-p/234432#M8884</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2024-12-03T09:03:04Z</dc:date>
    </item>
  </channel>
</rss>

