Skip to main content

A lightweight PanOS (Palo Alto Netoworks) firewall Management utility.

Project description

EZPanos

An Ergonomic and lightweight PanOS Utility Library

Installation

pip install ezpanos

Quick Start

You may provide a username and password, or an API key.

If the username and password parameters are not populated without an API key, you will be prompted for them.

from ezpanos.ezpanos import EzPanOS
import getpass

creds = {
    "username": input("Username: "),
    "password": getpass.getpass("Password: ")
}
endpoint = "<Management interface IP"
connection = EzPanOS(endpoint, username=creds["username"], password=creds["password"])
print(connection.execute("show system info"))

Using an API token

By default, the EzPanOS class will use username/password to generate an authentication token from PanOS. This can however, be overridden if you already have it.

from ezpanos.ezpanos import EzPanOS

endpoint = "x.x.x.x"
connection = EzPanOS(endpoint, api_key="xxxxxxxxxxxx")
print(connection.execute("show system info"))

Retrieving a Device Configuration:

Warning: Each configuration can exceed 80+Mb each. Be mindful of memory leaks.

Memory utilization has been optimized during configuration retrieval using streaming output and tempfile utilization.

configuration_dictionary = connection.get_configuration()

Saving a Device Configuration to Disk

To save a configuration to a file, use the export_configuration method.

from ezpanos.ezpanos import PanOS

endpoint = "x.x.x.x"
# or username/password outlined above
connection = EzPanOS(endpoint, api_key="xxxxxxxxxxxx") 
connection.export_configuration(output_filename="my_panos_configuration.json")
# if output_filename is null, default is:
# ./<endpoint_name>_yyy:mm:dd_hh:mm:ss.json 

Getting the entire Device Configuration as a dictionary

for random access to a particular configuration item in the configuration, ruleset, network, interfaces, etc. Use the get_configuration method.

from ezpanos.ezpanos import PanOS
from getpass import getpass
endpoint = "x.x.x.x"

# do NOT use this method on an untrusted system.
connection = EzPanOS(endpoint, username="user", password=getpass(f"Password: ")) 
configuration = connection.get_configration()

Currently an ideal platform for executing arbitrary PanOS commands against firewalls and Panorama instances for a wide variety of use cases.

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

ezpanos-0.2.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

ezpanos-0.2.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file ezpanos-0.2.2.tar.gz.

File metadata

  • Download URL: ezpanos-0.2.2.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for ezpanos-0.2.2.tar.gz
Algorithm Hash digest
SHA256 4692dbb7c68b876416e12fe58b55f270ae86fc320a807115d7a2657d028a4eea
MD5 50c71d0ee0472c1a1dd0a717df0b993e
BLAKE2b-256 5742c15fe942a28a457d9c2b67b5b3ced9f179ddaa44e8d8be7ef08849c67c8a

See more details on using hashes here.

File details

Details for the file ezpanos-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ezpanos-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for ezpanos-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8deb8d8e7c47e9e38b639da2c853525a09836e482e0ffc665223f1eec60cd25f
MD5 09f7932aa1e01f02145396af86e5a10d
BLAKE2b-256 3cb693f5befb08b9e7ae074039c41c44c51f9529e9701c6e986d5c4d4b1f622e

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