Skip to main content

Python Wrapper for Firemon APIs

Project description

FireMon-API

This project is for wrapper for the Firemon APIs (Security Manager, etc).

The User Guide available on Read the Docs

Current Design

Everything is basically being coded by hand to a fit a schema that makes sense to me. Endpoints are made and return objects which may have their own functions. For example search and manipulation of devices and their data. This is an attempt to make the API a bit more user friendly without requiring more interaction by the user.

Application Requests

The user may use the /api-doc from your FireMon server to extrapolate the need keys and methods to make and use the request() function for the specific FireMon application. This method is handy to test out what will be returned. This is handy for testing out functions and seeing results before coding up code that tries and fit the rhyme scheme for this module or get results that may yet not be coded.

>>> fm.sm.request(key="device", use_domain=True).get()
[{'id': 27, 'domainId': 1, 'name': 'PA-VM 11.0.1', 'managementIp': <snip...>]

Dynamic API

I have attempted to create a dynamic interface for all API calls if there is something needed that does not currently fit within the re-imagining of the API schema for user friendliness. Each application should automatically create these. Unfortunately many of the operationId for the API are not helpful in what they actually do:

ex: (get_1, get_2, get_3, ...)

Probably best to avoid this unless you are a sadist.

Usage

Import module. Disable unverfied https certificate warnings. Switch https verification off.

>>> import firemon_api as fmapi
>>> fmapi.disable_warnings()
>>> fm = fmapi.api('saffron', verify=False).auth('firemon', 'firemon')
>>> fm
<Firemon(url='https://saffron', version='10.0.0')>
>>> for dev in fm.sm.devices.all():
...   print(dev.name)
...
asa-2961.lab.firemon.com
ASA5505-8-3-2
ciscoASA8dot2
CSM-2
vSRX-3

Create a new Device. Newer versions of Firemon require we specify which Collector Group and ID to use. Grab the first Collector Group.

Use all the default information from the device pack for our device.

Add in some required information and other settings to our dictionary.

Create the device.

>>> cg = fm.sm.collectorgroups.all()[0]
>>> config = fm.sm.dp.get('juniper_srx').template()
>>> config['name'] = 'Conan'
>>> config['description'] = 'A test of the API'
>>> config['managementIp'] = '10.2.2.2'
>>> config['collectorGroupId'] = cg.id
>>> config['collectorGroupName'] = cg.name
>>> config['extendedSettingsJson']['password'] = 'abc12345'
>>> dev = fm.sm.devices.create(config)
>>> dev
<Device(Conan)>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firemon_api-0.3.9.tar.gz (81.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

firemon_api-0.3.9-py3-none-any.whl (76.6 kB view details)

Uploaded Python 3

File details

Details for the file firemon_api-0.3.9.tar.gz.

File metadata

  • Download URL: firemon_api-0.3.9.tar.gz
  • Upload date:
  • Size: 81.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for firemon_api-0.3.9.tar.gz
Algorithm Hash digest
SHA256 dab1b86a770987e165ecb5d5d79c39188883a4f24b9e0b218efcc5b14c5896ae
MD5 0f70a03110170755597b69621e44c642
BLAKE2b-256 0765a799d8e78eb9f48e1aa06f03b6b07ee2def12d888b95803da4f6f3fdad73

See more details on using hashes here.

File details

Details for the file firemon_api-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: firemon_api-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 76.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for firemon_api-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 70dfa1e947b8a4676ecd4debe3b06732178064d482097293c648675f1874a9ec
MD5 370ef024f13e50ee03793d3e6feca706
BLAKE2b-256 59fcc4e8cc7f39351dd31eca5057858d97bf836703665df0e188418b5a17bce6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page