Skip to main content

FortiFetch is a Python application that gathers information from FortiGate firewalls using the API and saves the information to a SQLite3 database. FortiFetch is built using Typer Python and the rich library for console output, and is designed to be easy to install, configure, and use.

Project description

FortiFetch

alt text

FortiFetch is a Python application that gathers information from FortiGate firewalls' API and saves the information to a SQLite3 database. FortiFetch is built using Python and the rich library for console output, and is designed to be easy to install, configure, and use.

Tested on Fortigate VM version 7.2.4

Tables in SQL database:

  • device
  • interface
  • firewallpolicy
  • webprofile
  • dnsprofile
  • appprofile
  • ipsprofile
  • sslsshprofile
  • avprofile
  • address
  • addressgroup
  • internetservice
  • ippool
  • vip
  • trafficshapers
  • trafficpolicy
  • dns
  • staticroute
  • policyroute
  • snmpv2
  • snmpv3
  • fortiguard
  • admin
  • adminprofile

Installation

To install FortiFetch, follow these steps:

Create a folder and a new virtual environment using venv.

Create a new folder for fortifetch

mkdir fortifetch

Change into the new folder

cd fortifetch

Create a virtualenv

python -m venv .

Activate the virtual environment

source bin/activate

Install FortiFetch using pip

pip install fortifetch

Set up the following environmental variables in your environment:

export FORTIFETCH_USERNAME=your_username
export FORTIFETCH_PASSWORD=your_password
export FORTIFETCH_INVENTORY=/your/path/inventory.yaml
export FORTIFETCH_SCHEME="http" or "https"

You can replace the values with your own FortiGate credentials and inventory file path. These environmental variables are used by FortiFetch to authenticate with your FortiGate devices and retrieve their information.

Create an inventory file in YAML format with a list of your FortiGate devices, using the following format:

---
- hostname: example-hostname-1
  host: 192.168.0.1
- hostname: example-hostname-2
  host: 192.168.0.2
- hostname: example-hostname-3
  host: 192.168.0.3

Replace the values with your own FortiGate device hostnames and IP addresses. Save the file as inventory.yaml and provide its path as the value of FORTIFETCH_INVENTORY environmental variable.

Usage

To use FortiFetch, you can run the following commands in your terminal:

fortifetch create-database: Creates a new SQLite3 database for FortiFetch.
fortifetch delete-database: Deletes the SQLite3 database for FortiFetch.
fortifetch execute-sql: Executes a SQL command on the FortiFetch database.
fortifetch update-all-devices: Retrieves information about all FortiGate devices and saves it to the FortiFetch database.
fortifetch show-devices: Displays a table of all devices in the FortiFetch database.
fortifetch show-dns: Displays a table of DNS information for all devices in the FortiFetch database.
fortifetch show-vpn-status: Displays a table of VPN information for all devices in the FortiFetch database.
fortifetch show-interface: Displays a table of interface information for all devices in the FortiFetch database.
You can also use the --help flag with any command to see more detailed usage instructions.

Example

alt text alt text alt text alt text alt text alt text

Contributing

If you'd like to contribute to FortiFetch, please follow these steps:

Fork the FortiFetch repository. Clone your fork to your local machine. Create a new branch for your changes. Make your changes and commit them. Push your changes to your fork. Create a pull request on the main FortiFetch repository.

License

FortiFetch is licensed under the MIT license. See the LICENSE file for more information.

Contact

If you have any questions or comments about FortiFetch, please feel free to contact me.

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

fortifetch-1.0.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

fortifetch-1.0.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file fortifetch-1.0.0.tar.gz.

File metadata

  • Download URL: fortifetch-1.0.0.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/4.4.0-19041-Microsoft

File hashes

Hashes for fortifetch-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ad1057ec5556eb50bc5a1c25edca6afd0ed28befd81d0dd20173f210acaaee88
MD5 db0e0f79a326de68a6b49c9a424d9246
BLAKE2b-256 8adad7322e8abed8626acad2e3839337fd3644cda51614537011611ebdd3e240

See more details on using hashes here.

File details

Details for the file fortifetch-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fortifetch-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/4.4.0-19041-Microsoft

File hashes

Hashes for fortifetch-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1757d48f97d2087c63bb8b09728e6a470c1a11e96d9321194feec37b35383314
MD5 fa1ac9a04c435c38053c3c38f8b43a0e
BLAKE2b-256 4776af05975063b5559a2f13f9421b79108367808a81db7b84b07ff09a5ac037

See more details on using hashes here.

Supported by

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