cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
355
Views
3
Helpful
2
Comments
Anupam Pavithran
Cisco Employee
Cisco Employee

Introduction
Managing Intrusion Policies on Cisco's Firepower Management Center (FMC) can be a daunting task, especially when dealing with large datasets. To streamline this process, we’ve developed a Python script that leverages FMC’s API to list all Intrusion Policies and export the Snort Rules of a selected policy to a CSV file. This article will guide you through the functionalities of the script and how to run it effectively.

What the Script Does
The script performs the following tasks:

1.Authenticates with FMC: Uses the provided FMC credentials to generate an authentication token.
2.Fetches Intrusion Policies: Retrieves a list of all Intrusion Policies configured in FMC.
3.Handles User Selection: Allows the user to select a specific Intrusion Policy from the list.
4.Fetches Intrusion Policy Rules: Retrieves all rules associated with the selected Intrusion Policy, handling large datasets efficiently using pagination.
5.Exports to CSV: Writes the rules, including details like Rule ID, Name, Default State, Message, and Rule Data, to a CSV file named after the selected policy with the current date and time appended to the filename.

How to Run the Scripts
Follow these steps to run the scripts:

1.Download the Scripts: Save the following Python scripts to files named requirements.py and fmc_intrusion_policy_exporter.py.
https://github.com/anupamx47/fmc_intrusion_policy_management

2.Run the Requirements Script: Before running the main script, ensure that all required libraries are installed by running:

python3 requirements.py

3.Run the Main Script: Open a terminal or command prompt, navigate to the directory where you saved fmc_intrusion_policy_exporter.py, and run:

python3 fmc_intrusion_policy_exporter.py

4.Enter FMC Details: When prompted, enter the FMC host, username, and password.

5.Select an Intrusion Policy: The script will display a list of all intrusion policies. Select a policy by entering the corresponding number.

6.CSV File Output: The script will fetch all rules for the selected policy and write them to a CSV file named after the policy, with the current date and time appended to the filename. The file will be saved in the same directory as the script.

Conclusion
This Python script simplifies the management of Intrusion Policies on Cisco’s Firepower Management Center by automating the retrieval and export of policy rules. By following the steps outlined in this guide, you can efficiently manage and review your Intrusion Policies, ensuring your network security measures are both comprehensive and up-to-date.

Comments
ccieexpert
Level 4
Level 4

Good job.. but does this required same versions of VDB etc ? you could also do a access control policy export and it restore but the version had to be the same...

Anupam Pavithran
Cisco Employee
Cisco Employee

@ccieexpert , Here we're just exporting the Script. I'm working on the import part, will update soon.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: