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

Export a rulebase as a CSV file

Overview

Export a security policy as a standard csv file.

Supports Access, NAT and Threat policies.

Description

A python 2.7 code that demonstrate how to use the show-access/NAT/threat-rulebase api

Instructions

Run rulebasecsv.py

Use -h flag for available options.

Code Version

Code version 1.0.1

Tested on version

R80, API version 1.0

R80.10, API version 1.1

NOTICE: By using this sample code you agree to terms and conditions in this Terms and Conditions

...

6 Replies
SDE_License_Acc
Participant

Does any one have an example working syntax for exporting different policy packages. at the moment I only seem to be able to extract the current open policy?

0 Kudos
_Val_
Admin
Admin

Quoting from above:

Instructions

Run rulebasecsv.py

Use -h flag for available options.

0 Kudos
SDE_License_Acc
Participant

That does not help as it does not give you the option to change the rulebase. 

I have found the only working Syntax to be rulebasecsv.py -o test.4 -u XXXXX -t access -p XXXXXXXX -m XX.XX.XX.XX -i Network this will pull the Standard policy only you try and specify the rulebase name you get the following output:

C:\>rulebasecsv.py -o test -u XXXXX -t access -p XXXXXXXX -m XX.XX.XX.XX -i "Phil_Test"
|--- >>> Error occured: Requested object [Phil_Test] not found. Error type: generic_err_object_not_found.
|--- Headers: {'transfer-encoding': 'chunked', '_reason': 'Not Found', '_version': 11, 'server': 'CPWS', 'x-ua-compatible': 'IE=EmulateIE8', 'date': 'Thu, 09 Aug 2018 09:54:59 GMT', 'x-frame-options': 'SAMEORIGIN', 'x-forwarded-host-port': '443', 'content-type': 'application/json', '_status': 404}
|--- Body: {u'message': u'Requested object [Phil_Test] not found', u'code': u'generic_err_object_not_found'}
Script aborted.
All objects were restored to their previous state.

it appears you can not specify specific policy packages to extract unless I am missing the syntax

0 Kudos
Robert_Decker
Advisor

You are correct, this prints the rulebases from the Standard package.

Please note that this is only an example script from 3 years ago to show management API capabilities.

If you've some Python scripting knowledge, you can add a package parameter to make it work.

If not, I can do this for you next week.

Robert.

0 Kudos
SDE_License_Acc
Participant

My python skills are 0 but I will give it a go when I get five minutes no time like the present to learn.

Ron_Izraeli
Employee
Employee

Check out SmartConsole Extensions platform to integrate this as a web page inside SmartConsole

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events