NetworkMagpie is a robust Python-based automation tool designed to perform comprehensive configuration and security audits on network devices across multiple vendors. Currently supporting Cisco IOS-XE and Aruba OS-CX, it aims to provide network administrators with clear, actionable reports to ensure compliance, security, and optimal performance of their infrastructure.
- Multi-Vendor Support: Seamlessly audits Cisco IOS/IOS-XE and Aruba OS-CX devices.
- Comprehensive Data Collection:
- Detailed interface inventory (physical, virtual, management) with status and IP addressing.
- VLAN configuration analysis.
- ARP table extraction.
- Security Auditing: Performs extensive checks against best practices, including:
- AAA configuration.
- SSH and access management.
- Password policies and encryption.
- Service hardening (HTTP, CDP/LLDP, etc.).
- Logging, NTP, and SNMP configuration.
- Layer 2 security features.
- Flexible Reporting: Generates reports in multiple formats:
- Excel: Formatted multi-tab reports with color-coded compliance status (Green/Orange/Red).
- HTML: printer-friendly reports for easy sharing and review.
- JSON: Raw data export for integration with other tools.
- Configuration Management: Optional export of running configurations to text files.
- Python 3.8 or higher.
- Git.
-
Clone the repository:
git clone https://github.com/ClementLG/networkMagpie.git cd networkMagpie -
Create a Virtual Environment: It is highly recommended to run NetworkMagpie within a virtual environment to manage dependencies securely.
-
Windows:
python -m venv venv .\venv\Scripts\activate -
macOS / Linux:
python3 -m venv venv source venv/bin/activate
-
-
Install Dependencies:
pip install -r requirements.txt
Before running the audit, you need to configure your inventory and credentials.
Create a file named inventory.csv in the root directory. This file defines the devices to be audited.
Format: hostname_or_ip,group_name,device_type
hostname_or_ip: IP address or DNS name of the device.group_name: Logical group name (used to map credentials inpasswords.csv).device_type: Supported OS type (cisco_iosoraruba_os-cx).
Example:
hostname_or_ip,group_name,device_type
192.168.1.10,core-switches,cisco_ios
10.0.0.5,access-aruba,aruba_os-cx
switch-01.local,dist-switches,cisco_iosCreate a file named passwords.csv in the root directory. This file maps credentials to the groups defined in the inventory.
Format: group_name,username,password,enable_password
group_name: Must match a group name frominventory.csv.username: Login username.password: Login password.enable_password: (Optional) Enable secret. Leave empty if not applicable.
Example:
group_name,username,password,enable_password
core-switches,admin,SecretPassword123,EnableSecret456
access-aruba,manager,ArubaPass!,
dist-switches,audit_user,AuditPass2024,SecretKeySecurity Note: Ensure
passwords.csvis secured with appropriate file permissions (e.g., restricted read access) and is excluded from version control (add to.gitignore).
Run the main script to start the audit process. By default, it generates an Excel report.
python main.pyYou can customize the output formats and enable configuration backup using command-line arguments.
| Argument | Description | Default |
|---|---|---|
-o, --output |
Specify output formats. Options: json, excel, html. You can specify multiple formats. |
excel |
-e, --export-config |
Export the running configuration of each device to a text file. | Disabled |
-h, --help |
Show the help message and exit. |
Generate Excel and HTML reports:
python main.py -o excel htmlGenerate JSON report and export device configurations:
python main.py -o json -eRun everything (Excel, HTML, JSON, and Config Export):
python main.py -o excel html json -eAll results are saved in the audit_reports/ directory:
- Excel Reports:
audit_report_YYYYMMDD_HHMMSS.xlsx- Comprehensive audit results with color-coded security assessments. - HTML Reports:
audit_report_YYYYMMDD_HHMMSS.html- Clean, printable summary of the audit. - JSON Data:
audit_data_YYYYMMDD_HHMMSS.json- Full raw data export. - Configurations:
audit_reports/configs/- Individual text files for device configurations (if-eis used).
Contributions are welcome! If you would like to add support for new vendors (Extreme, Fortinet, etc.) or improve existing audit checks:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the GNU General Public License v3 (GPLv3). See LICENSE for more information.
