Skip to content

Simple Python script to convert FortiGate objects to a CSV

License

Notifications You must be signed in to change notification settings

danwalkeruk/fortigate2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FortiGate to CSV Converter

FortiGate web UI has no easy way to export a CSV (unless you also use FortiManager), so this script can be used to fetch JSON data over the REST API and export it as a CSV.

Some common objects are included, and you can easily modify and extend to your requirements.

Usage

Command line arguments

  • -f - Firewall IP/FQDN
  • -u - Username
  • -v - VDOM
  • -i - Items (interface, policy, snat, address, service, dnat, pool, addrgrp)
  • -o - CSV Outfile (optional)
  • -t - Translate network object names to IPv4 (optional)

Example

% python fortigate2csv.py -f 1.2.3.4 -u dan -v management -i address -o address.csv
Connecting to 1.2.3.4 (management) as dan
Successfully logged in as dan
Fetching data...
Logging out of firewall
Saving to address.csv
Done!

Output:

name,type,subnet,fqdn,associated-interface,visibility,allow-routing,comment
hst-1,ipmask,10.10.10.1 255.255.255.255,,v123,enable,disable,description of host 1
hst-2,ipmask,10.10.10.2 255.255.255.255,,v123,enable,disable,description of host 2
login.microsoft.com,fqdn,,login.microsoft.com,,enable,disable,comment goes here
...

About

Simple Python script to convert FortiGate objects to a CSV

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages