🔐 AutoSec - Python Automation

Python-based automation to keep your network configuration fast, repeatable, and secure.

What does the Python script do?

This Python-based automation script manages direct and COM connections, as well as configuration tasks, across network devices. It standardizes settings, reduces manual command-line operations, and enables repeatable workflows for switches, routers, and servers, functioning similarly to SCCM Configuration Manager for Windows.

🔑Multiple Authentication

Supports password-based and secure key-based access methods through automation libraries.

🌐Multi-Host Management

Loop through multiple hosts from a Python list or inventory file, applying the same logic to production, staging, and lab environments.

🚇Consistent Configs

Send standardized configuration commands to switches, routers, and servers, keeping network behavior predictable and documented in code.

⚙️Rapid Deployment

Push updates, patch changes, or new settings to dozens of devices in minutes instead of hours of manual CLI work.

🤖Automation Friendly

Integrate Python scripts into CI/CD pipelines, scheduled tasks, or orchestration tools to automate configuration operations.

🔧Error Reduction

Centralize commands and logic in one script, reducing the chance of mistyped commands or inconsistent setups between devices.

Example Python Automation Script

1. Define your device settings:

device = { "device_type": "cisco_ios", "ip": "192.168.1.100", "username": "admin", "password": "your_password", "secret": "enable_password", }

2. Connect and run commands:

from netmiko import ConnectHandler connection = ConnectHandler(**device) connection.enable() commands = [ "hostname AutoSec-SW1", "interface vlan 1", "ip address 192.168.1.5 255.255.255.0", "no shutdown", ] output = connection.send_config_set(commands) print(output) connection.save_config() connection.disconnect()

3. Extend to multiple devices:

devices = [device1, device2, device3] for dev in devices: with ConnectHandler(**dev) as conn: conn.enable() conn.send_config_set(commands) conn.save_config() print(f"Configured {dev['ip']}")

⚠️ Security Notice

Real passwords or private keys should not be hard-coded in scripts. Instead, utilize environment variables, encrypted vaults, or secret managers. Always test in a controlled lab environment before production deployment.

Why Use Python Automation?

  • 🔧 Repeatable Configuration
    Store configuration changes in code for consistency.
  • 🌍 Scales Across Environments
    One script can target development, testing, and production devices.
  • 🚇 Centralized Access
    Manage configuration workflows from a single automation entry point.
  • 🔑 Secure Credential Handling
    Support for environment-based authentication storage and rotation.
  • 🤖 Integrates With Anything
    Works alongside CI/CD pipelines, orchestration systems, and local tools.

Ready to Get Started?

Build a simple automation script, test it against a lab device, and expand it into a reusable tool for your network environment.

View Usage Guide