- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: Export a rulebase as a CSV file
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
...
- Labels:
-
Access Policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting from above:
Instructions
Run rulebasecsv.py
Use -h flag for available options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My python skills are 0 but I will give it a go when I get five minutes no time like the present to learn.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check out SmartConsole Extensions platform to integrate this as a web page inside SmartConsole
