Hello!
Firstly, I'd like to introduce myself - I'm Daniel, and I've worked with Check Point for 11(nearly 12!) years.
I'm always interested in making life easier, or more automated - which makes a great paring for Python.
I had a problem, in that I noticed the SmartConsole unused objects view is limited to 500 objects and bulk deletions were slow.. and not that easy to know what has and hasn't been deleted without going in and out of the object view, and publishing.
I wrote this script, which was initially part of a greater project to write a Python related wrap-around to do bulk changes through the Web API. In its current form, it issues the "show-unused-objects" command through the API and loops through the responses in chunks and stores them in dictionaries. Then, it goes through these dictionaries, one object type at a time and issues the delete commands... and a publish for every 200 objects (or when it's done with that iteration).
It doesn't delete VPN communities, but it can with a small change to the script - I did this on purpose because VPN communities are generally more sensitive (as in, most people wouldn't have unused ones) and have other object dependencies such as Interoperable Devices, Cluster nodes etc..
The script doesn't self run, I designed it to run through a Python shell (but, I can possibly change this - and this is a living project for me) copy and paste the code contents to a python shell, ensuring you have IP access to the management and the API is enabled and configured to allow access. You can run the cleanup with 'RunTheCleanUp()'.
https://github.com/dcmarimba/CPAPI_Upload
Happy cleaning!
Daniel
API and CLI Discussion Management Quantum Security Management
Daniel