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

Export Policy using python

Jump to solution

Hi all,

 

Good day!!.Am new to check point and am trying to automate few tasks in check point. As a part of it, would like to automate policy export of all check point firewalls and send in mail for monthly review.

https://github.com/CheckPointSW/ExportImportPolicyPackage : Export import package will help to export policies but when i run in python, am getting error as in attached screen shot.  Am sure that something is missed.

Please guide me if am not in right path. 

 

0 Kudos
1 Solution

Accepted Solutions
Maik
Silver

Re: Export Policy using python

Jump to solution

Ah okay I see that you are using python 3 - as far as I know this script has been written to work with python 2.7 only.

Can you try to install version 2.7.x and run the script again, please?

0 Kudos
11 Replies
Admin
Admin

Re: Export Policy using python

Jump to solution

Did you download and install the Check Point API Python SDK repository?
This is required to use this particular script.

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

Hi,

I have installed same. Attached screen shot.

0 Kudos
Admin
Admin

Re: Export Policy using python

Jump to solution

The error message suggests the module is not installed in a place the python interpreter sees it.

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

I have installed in same path and it is reflected in sys.path also.

Interpreter reflecting correct path.  May be am lack in understanding. Could you please guide me.

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

Hi,

Here is the problem what am facing. If i run examples of cp_mgmt_api_python, it is working fine, but from same path if I execute, import_export_package am getting error. Please help me to fix this.

0 Kudos
Maik
Silver

Re: Export Policy using python

Jump to solution

Hey,

 

From your given Output I can see that you try to execute the script with the use of relative module names ("-m" parameter). If you have installed the Check Point API Python SDK as it is mentioned in the linked GitHub page the script execution should be possible by simple typing

 

"python.exe import_export_package.py" [with python in the path variable as a requirement]

 

PS C:\Users\user\Desktop\Check Point Scripts\Scripting_Mgmt_CLI\ExportImportPolicyPackage-masterNEW> python.exe import_export_package.py
 
Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit

As "ExportImportPolicyPackage-master" is your current working directory related to your screenshot the only issue I can think of is a copy/paste mistake. Please double check if the Folder "exporting" within ExportImportPolicyPackage contains the file "Export_access_rulebase" as well as all the other required files. In sum you should see 16 files in there, 8 of these should have the .py ending. In the case of some files being not present, try to download the repository as a zip again and proceed with step one.

 

Regards,

Maik

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

Hi,

As suggested, i have removed directory and downloaded as zip and placed in separate folder, but still am getting same error.

attached screen shots. Please help.

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

Hi, 

Attached list of files post downloading package using zip.

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

Hi

Attached package export path.

0 Kudos
Maik
Silver

Re: Export Policy using python

Jump to solution

Ah okay I see that you are using python 3 - as far as I know this script has been written to work with python 2.7 only.

Can you try to install version 2.7.x and run the script again, please?

0 Kudos
rkalidh
Ivory

Re: Export Policy using python

Jump to solution

Hi,

Yes, it is working fine with python 2.7.9. Thanks.

0 Kudos