maaaaz / fgpoliciestocsv Goto Github PK
View Code? Open in Web Editor NEWA simple script to extract policies from a FortiGate configuration file to CSV
License: GNU Lesser General Public License v3.0
A simple script to extract policies from a FortiGate configuration file to CSV
License: GNU Lesser General Public License v3.0
Hi can you create a script to convert "config user local" to csv? I would I collect all user data into spreadsheet.
Hope you can help
Thanks in advance
This was a welcome find which greatly helps exporting FortiGate configs for PCI. Thank you for this!
A nice improvement would be the ability to specify the delimiter within a given field in a record. For example, if I have a firewall policy which allows multiple ports, currently the exported file separates each port with a space, however I may have custom ports that have spaces in their names, which can cause confusion. It would be nice to be able to specify a comma or other custom character to separate them.
Keep up the good work!
Hi ,
I m trying to use your python script and getting the following error. Can you please help asap?
D:\Users\somaniv>csvparse.py -i rules1.cfg
Traceback (most recent call last):
File "D:\Users\somaniv\csvparse.py", line 160, in
main(options, arguments)
File "D:\Users\somaniv\csvparse.py", line 145, in main
results, keys = parse(options.input_file)
File "D:\Users\somaniv\csvparse.py", line 77, in parse
if p_entering_policy_block.search(line):
TypeError: cannot use a string pattern on a bytes-like object
Please convert the txt file to cfg file.
Good afternoon,
Took me some time on the Internet to find a useful script like this. But for some reason, I'm getting errors. I've tried to search on Google for this error, encountered some fixes too ... But I'm afraid I have no idea how to apply them.
Y:\Test>fgaddressestocsv.py -i "Y:\Test\sys_config_10.36.25.9.txt" -n
Traceback (most recent call last):
File "Y:\Test\fgaddressestocsv.py", line 159, in <module>
main(options, arguments)
File "Y:\Test\fgaddressestocsv.py", line 145, in main
results, keys = parse(options.input_file)
File "Y:\Test\fgaddressestocsv.py", line 77, in parse
if p_entering_address_block.search(line):
TypeError: cannot use a string pattern on a bytes-like object
This error happens also at other Python files in this repository.
This is the Python version I'm using;
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:16:59) [MSC v.1900 32 bit (Intel)] on win32
Hi Maaaaz,
i was trying to execute the python which u have created in terminal or output console Please specify a valid input file is printing the output. can u plz help me the how to insert input file in that code.
Thanks.
Hi,
In fgaddressestocsv.py, if the address contains "tagging" the script stop to parse the file.
edit "Test"
set uuid *****
config tagging
edit "UPG_TAGGING"
set category "default"
set tags "SERVER"
next
end
set subnet 192.168.1.1 255.255.255.255
next
Hi, thank's for your work
possible to create script for export Virtual ip en ip pool to csv file?
thank's
Good afternoon,
I find a useful script : fgaddressestocsv.py (Also fgpoliciestocsv.py , and it works ok).
But for some reason, I'm getting errors.
I've tried to search on Google for this error, But I'm afraid I have no idea how to apply them.
C:\PYTHON_POLICY_FORTIGATE\fgpoliciestocsv-master>python fgaddressestocsv.py -i prueba-address.cfg -n
Traceback (most recent call last):
File "fgaddressestocsv.py", line 179, in
main()
File "fgaddressestocsv.py", line 174, in main
generate_csv(results, keys, options)
File "fgaddressestocsv.py", line 151, in generate_csv
spamwriter.writerow(output_line)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)
This is the Python version I'm using;
python --version
Python 2.7.18
Is it possible , you give me some advice , please?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.