<?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: Management API - Rulebase export as .csv in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29361#M1775</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maik,&lt;/P&gt;&lt;P&gt;Kudos for the effort!&lt;/P&gt;&lt;P&gt;Some usefull information:&lt;/P&gt;&lt;P&gt;1. You cannot enter new-line/tab into rule comment in GUI, it is blocked, and GUI replaces"," with ";" when exporting the rulebase into CSV file.&lt;/P&gt;&lt;P&gt;2. The maximum limit for rules query in rulebase is 500, the offset starts at 0, so you can query in loop until the total is reached (advance the offset by the limit).&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2018 11:15:52 GMT</pubDate>
    <dc:creator>Robert_Decker</dc:creator>
    <dc:date>2018-06-14T11:15:52Z</dc:date>
    <item>
      <title>Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29348#M1762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to use the management API to export the rulebase as a .csv file instead of the json format?&lt;/P&gt;&lt;P&gt;I'm thinking about a similar layout as the option within the GUI. So within the "Security Policy" section after you open a policy there is the "Actions" button at the top. After clicking it you are presented with a menu which in the end lists the "export" option:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.checkpoint.com/legacyfs/online/checkpoint/66279_export_rulebase_as_csv.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exported .csv file from a previously selected rulebase is exactly what I am looking for - with the exception that I want to create it automatically and not via the GUI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully there is a possible solution and somebody can help me. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.checkpoint.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2018 12:18:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29348#M1762</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-06-08T12:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29349#M1763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.checkpoint.com/docs/DOC-1089"&gt;https://community.checkpoint.com/docs/DOC-1089&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2018 13:02:34 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29349#M1763</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-08T13:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29350#M1764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2018 13:11:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29350#M1764</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-06-08T13:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29351#M1765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Today I was able to test the script, but unfortunately it does not work as expected.&lt;/P&gt;&lt;P&gt;I put it directly on the management server itself, however, it throws a KeyError each time I try to execute it.&lt;/P&gt;&lt;P&gt;The output below shows what I enter and also the error code which is shown afterwards. Please notice that I changed the input by removing the IP address as well as the username and the rulebase name. Those parameters shouldn't be the cause of my issue, as the login appears to fine &amp;amp; the rulebase that I want to export as a csv can be found (I verified this by entering a wrong rule base name and received a different error which said that the rule base could not be found).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;./rulebasecsv.py -o test.csv -u [MYUSERNAME] -t access -m [MGMT_SERVER_IP] -i [MY_RULEBASE_NAME]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Enter password:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Traceback (most recent call last):&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "./rulebasecsv.py", line 392, in &amp;lt;module&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "./rulebasecsv.py", line 68, in main&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif&amp;nbsp; args.type[0] == "access": print_access_control_rulebase_csv(rulebase, session, args.output[0])&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "./rulebasecsv.py", line 252, in print_access_control_rulebase_csv&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; access_control_rulebase_csv(get_rulebase("access", rulebase, session), session, output_file)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "./rulebasecsv.py", line 260, in access_control_rulebase_csv&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(print_access_rule(rule, parent_prefix=parent_prefix, enabled=enabled), file=outputfile)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; File "./rulebasecsv.py", line 267, in print_access_rule&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string += print_field_csv(rule["rule-number"], parent_prefix=parent_prefix, enabled=(enabled and rule["enabled"]))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;KeyError: 'rule-number'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried several rule bases but the "KeyError: 'rule-number' is shown for each one. I also tried to change the IP address to 127.0.0.1 instead of the actual IP of the servers interface (as I am running this script locally from the management server), but this does not change anything as well. The management server runs version 80.10 and Python version 2.7.&lt;/P&gt;&lt;P&gt;Hopefully somebody experienced this issue before and can help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any advice!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 07:17:48 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29351#M1765</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-06-11T07:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29352#M1766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maik,&lt;/P&gt;&lt;P&gt;I'll check the script and inform you.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 07:56:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29352#M1766</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-11T07:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29353#M1767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found a bug in source code. This code is two years old...&lt;/P&gt;&lt;P&gt;Will fix and update.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:10:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29353#M1767</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-11T13:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29354#M1768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fixed.&lt;/P&gt;&lt;P&gt;Please download and run again.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:52:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29354#M1768</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-11T14:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29355#M1769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all I want to thank you very much for your effort and help!&lt;/P&gt;&lt;P&gt;Unfortunately I did experiece a few more bugs but was able to fix one of them.&lt;/P&gt;&lt;P&gt;So to start with, in the beginning when I used your new version of the script I received the following error:&lt;/P&gt;&lt;P&gt;"UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position xxx: ordinal not in range(128)"&lt;/P&gt;&lt;P&gt;Due to my (to this day) medium experience with python I was able to handle this one. So the error mentioned that the character "ü" could not be printed. The weird thing for me was, that "ü" or any other special character was not mentioned in any rule at all. Nevertheless, the error mentioned the "print_access_rule" method for the return error. Therefore I added ".encode("utf-8") to line 283 of the script, so that the returned value of the method print_access_rule is encoded in utf-8 which has a more complex characterset after all. (Of course this should also be done for the other two available export options/their related methods: print_nat_rule + print_threat_rule)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now I experience the problem that only the first 50 rules of any tried rulebase are getting exported. After that the script simply stops exporting more. I tried several rulebases and also created a new one for testing purposes with just 51 rules - and also here, the export stops after rule 50. Unfortunately I am not so familiar with the whole script structure and could not find the related issue in the code. But I guess the solution of this one could be pretty simple for someone who knows the whole script. Maybe you can have a look once more - I promise that I won't bother you any more after this is working &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.checkpoint.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Really appreciate your support so far!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 07:20:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29355#M1769</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-06-12T07:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29356#M1770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maik,&lt;/P&gt;&lt;P&gt;The magic 50 is the default limit when querying objects/rules in API.&lt;/P&gt;&lt;P&gt;I'll fix it to return all data, and also the unicode problem.&lt;/P&gt;&lt;P&gt;You are not&amp;nbsp;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;bothering me - it is your full right to ask and it is my job to answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 09:18:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29356#M1770</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-12T09:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29357#M1771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maik,&lt;/P&gt;&lt;P&gt;This fix may take some time, so if you have less than 500 rules in your policy, you can have a quick and dirty fix, as follows:&lt;/P&gt;&lt;P&gt;in method "get_rulebase" on lines 243 and 244, add this parameter to the "data"&amp;nbsp;container -&amp;nbsp;&lt;/P&gt;&lt;PRE class="" style="color: #191919; background: #efefef; border: 0px none; margin: 0px 0px 10px; padding: 9.5px;"&gt;"limit" : 500&lt;/PRE&gt;&lt;P&gt;This will return up to 500 rules.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 09:39:49 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29357#M1771</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-12T09:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29358#M1772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer and suggestion! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.checkpoint.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;The addition of the limit parameter within the data container did the job for now.&lt;/P&gt;&lt;P&gt;All the rules are getting exported (I used the value 1000 instead of 500, not recommended I know, but the rulebase is quite big and sits on top of a 64000 appliance). Now that I was able to create a first csv files via the script I saw, that new lines are getting exported in the rule strings as well. This means, that if a rule has e.g. a comment which contains the following information...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Comment...&lt;/P&gt;&lt;P&gt;Comment...&lt;/P&gt;&lt;P&gt;Comment!"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...the related entry in the csv file will have "Comment" in the same line as the rest of the rule, but "Comment..." and&amp;nbsp; "Comment!" in the next two lines. Such a format makes the csv file itself quite unusable. Maybe you can also check the for new lines and basically ignore them when writing the csv file, so that each rule is really represented as only one line within the csv?&lt;/P&gt;&lt;P&gt;I am starting to feel really bad for all the requests I have, don't hesitate to tell me if there is any way I can help with the script modification.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 10:56:17 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29358#M1772</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-06-12T10:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29359#M1773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maik, no problem, don't feel uncomfortable.&lt;/P&gt;&lt;P&gt;I'll look at it tomorrow at work.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2018 16:57:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29359#M1773</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-12T16:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29360#M1774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a temporary solution I have updated the script to also handle the issue with new lines, tabs and commas within the comment section of rules.&lt;/P&gt;&lt;P&gt;I guess in the eyes of a developer my solution is not the prettiest one, but for now it works.&lt;/P&gt;&lt;P&gt;Nevertheless one important feature that still does not work is the verification of the actual rule numbers and the related, correct, polling. For now my changes to the script just poll the first 4000 rules which currently is more than enough to achieve my plans (seems like the counter starts from 0 for each sub layer - maybe you can verify that?).&lt;/P&gt;&lt;P&gt;By the way, in addition one more thing that I added is that the exported csv file now also contains the custom fields of the rules. If you want to change the "header" of the csv to represent the correct name of the fields (as used in the individual envorinemnt) you need to change them correspondingly in the method "print_access_control_rulebase_csv" (no other changes needed as the name of these fields is always "field-1" etc. within the actual json data that the api is sending).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So long story short, here is my version of the script with the changes that I have added, maybe it is helping someone during the time window of the official script change:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 09:45:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29360#M1774</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-06-14T09:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29361#M1775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maik,&lt;/P&gt;&lt;P&gt;Kudos for the effort!&lt;/P&gt;&lt;P&gt;Some usefull information:&lt;/P&gt;&lt;P&gt;1. You cannot enter new-line/tab into rule comment in GUI, it is blocked, and GUI replaces"," with ";" when exporting the rulebase into CSV file.&lt;/P&gt;&lt;P&gt;2. The maximum limit for rules query in rulebase is 500, the offset starts at 0, so you can query in loop until the total is reached (advance the offset by the limit).&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 11:15:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29361#M1775</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-06-14T11:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29362#M1776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After the API you can send to jq to further parse it. pipe jq then at the end use jq to create a csv.&lt;BR /&gt;|&lt;STRONG&gt;jq&lt;/STRONG&gt; 'some-example-of-filter)|&lt;STRONG&gt;@csv&lt;/STRONG&gt;'&lt;/P&gt;&lt;P&gt;For example, one I use for printing out unused rules that have not been modified within the last 6 months:&lt;/P&gt;&lt;P&gt;mgmt_cli show access-rulebase name "$NAME" use-object-dictionary true show-hits true --format json|&lt;STRONG&gt;jq&lt;/STRONG&gt; -r '.rulebase[].rulebase[]|select(.hits.value == 0)|select(."meta-info"."last-modify-time".posix &amp;lt;$POSIX)| (."rule-number", ."name", ."uid", ."meta-info" ."last-modify-time" ."iso-8601")|&lt;STRONG&gt;@csv&lt;/STRONG&gt;'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2018 18:23:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/29362#M1776</guid>
      <dc:creator>Thomas_Arrowsmi</dc:creator>
      <dc:date>2018-06-14T18:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70375#M4200</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In R80.30 i receive the following error:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;[Expert@MGMT:0]# ./export_rulebase_csv.py -o test.csv -u admin -t access -m 192.168.1.2 -i Standard -d&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Enter password:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Traceback (most recent call last):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "./export_rulebase_csv.py", line 401, in &amp;lt;module&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;main()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "./export_rulebase_csv.py", line 66, in main&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;session = connect(ip_address=management, username=username, password=password, session_id=session_id, readonly="true", fingerprint=fingerprint, verify=(False if management == "127.0.0.1" else not args.ignore_ssl))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "./export_rulebase_csv.py", line 233, in connect&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;session.login(username=username, password=password, session_id=session_id, readonly=readonly)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "./export_rulebase_csv.py", line 159, in login&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;self.headers["X-chkp-sid"] = api_call(command="login", session=self, data={"user": username, "password": password, "continue-last-session": "false", "read-only": readonly}, level=level)["sid"]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "./export_rulebase_csv.py", line 173, in api_call&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;body = json.loads(body)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "/opt/CPsuite-R80.30/fw1/Python/lib/python2.7/json/__init__.py", line 339, in loads&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;return _default_decoder.decode(s)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "/opt/CPsuite-R80.30/fw1/Python/lib/python2.7/json/decoder.py", line 364, in decode&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;obj, end = self.raw_decode(s, idx=_w(s, 0).end())&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;File "/opt/CPsuite-R80.30/fw1/Python/lib/python2.7/json/decoder.py", line 382, in raw_decode&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;raise ValueError("No JSON object could be decoded")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;ValueError: No JSON object could be decoded&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me to solve this?&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 09:04:21 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70375#M4200</guid>
      <dc:creator>RPdeBeer</dc:creator>
      <dc:date>2019-12-13T09:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70418#M4203</link>
      <description>That looks like you haven't enabled the API server properly.&lt;BR /&gt;See: &lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Enabling-web-api/m-p/32641#M2011" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Enabling-web-api/m-p/32641#M2011&lt;/A&gt;</description>
      <pubDate>Fri, 13 Dec 2019 16:10:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70418#M4203</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-12-13T16:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70422#M4207</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I restarted the API but that solved partially the problem. I receive now the following errors:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;[Expert@MGMT:0]# ./export_rulebase_csv.py -o test.csv -u admin -t access -m 192.168.1.2 -i standard&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Enter password:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Please wait, the script is currently creating the csv file of your choice: access-rulebase...&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;|--- &amp;gt;&amp;gt;&amp;gt; Error occured: Requested object [standard] not found. Error type: generic_err_object_not_found.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;|--- Headers: {'transfer-encoding': 'chunked', '_reason': 'Not Found', 'strict-transport-security': 'max-age=31536000; includeSubDomains', '_version': 11, 'server': 'CPWS', 'x-ua-compatible': 'IE=EmulateIE8', 'date': 'Fri, 13 Dec 2019 16:25:47 GMT', 'x-frame-options': 'SAMEORIGIN', 'x-forwarded-host-port': '443', 'content-type': 'application/json', '_status': 404}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;|--- Body: {u'message': u'Requested object [standard] not found', u'code': u'generic_err_object_not_found'}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Script aborted.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;All objects were restored to their previous state.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Standard is the name of the rulebase, but it seems like he is not able to find this object..&lt;/P&gt;&lt;P&gt;Greetings, Rutger&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 16:30:17 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70422#M4207</guid>
      <dc:creator>RPdeBeer</dc:creator>
      <dc:date>2019-12-13T16:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70437#M4208</link>
      <description>Try Standard with a capital S.&lt;BR /&gt;Some API calls are case-sensitive.</description>
      <pubDate>Fri, 13 Dec 2019 18:24:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70437#M4208</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-12-13T18:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Management API - Rulebase export as .csv</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70485#M4213</link>
      <description>&lt;P&gt;I already tried that &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Didn't solve the problem...&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 18:29:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Management-API-Rulebase-export-as-csv/m-p/70485#M4213</guid>
      <dc:creator>RPdeBeer</dc:creator>
      <dc:date>2019-12-14T18:29:36Z</dc:date>
    </item>
  </channel>
</rss>

