Skip to main content

Back up Cisco configs over serial

Project description

cisco-conf-helper

Back up or apply Cisco configs over a serial connection.

Install

Run directly with uvx:

uvx cisco-conf-helper --help

Package: cisco-conf-helper on PyPI (publisher: veya).

Quick start

Create a config file:

#:schema https://raw.githubusercontent.com/0xveya/cisco-conf-helper/master/cisco-conf-helper.schema.json

[backup]
output_dir = "backups"
command = "show running-config"
min_expected_bytes = 1000
retry_on_low_bytes = true
print_saved_config = false
wipe_after_backup = false
wipe_delete_vlan_dat = false
wipe_extra_commands = []

[apply]
source_dir = "backups"
save_command = "write memory"
save_after_apply = true

[git]
enabled = true
auto_commit = true
commit_message = "Back up config for {hostname}"
commit_body = """
Devices changed:
- {hostname}

Files changed:
- {path}

Bytes written: {bytes_written}
Command: {command}
Device type: {device_type}
Timestamp: {timestamp}
"""

[jj]
enabled = false
auto_commit = false
commit_message = "Back up config for {hostname}"
commit_body = """
Devices changed:
- {hostname}

Files changed:
- {path}

Bytes written: {bytes_written}
Command: {command}
Device type: {device_type}
Timestamp: {timestamp}
"""

[cli]
mode = "backup"
loop = true
count = 0
stop_on_error = true
dry_run = false

[device]
device_type = "cisco_ios_serial"
password = "cisco"
secret = "class"

[serial]
port = "/dev/ttyUSB0"
baudrate = 9600
bytesize = 8
parity = "N"
stopbits = 1

Examples

Single backup

uvx cisco-conf-helper --no-loop

Backup loop for a lab

uvx cisco-conf-helper --loop

If --wipe-after-backup is not passed, loop mode asks once whether each device should be wiped after backup.

Force wipe after every backup without asking

uvx cisco-conf-helper --loop --wipe-after-backup

This issues:

  • write erase
  • reload

and handles common confirmation prompts automatically.

Also delete vlan.dat

uvx cisco-conf-helper --loop --wipe-after-backup --wipe-delete-vlan-dat

This is useful for school lab switches that should be fully reset at the end of a session. When enabled, the tool also checks the saved config for VLAN definitions and only deletes flash:vlan.dat when VLAN config is detected.

Print the saved config after each backup

uvx cisco-conf-helper --loop --print-saved-config

This prints the exact saved file after backup so you can verify the config was captured.

Do both: print config and wipe after backup

uvx cisco-conf-helper --loop --print-saved-config --wipe-after-backup

Override config defaults from the CLI

uvx cisco-conf-helper \
  --loop \
  --port /dev/ttyUSB0 \
  --baudrate 9600 \
  --output-dir backups

Use config file defaults for lab cleanup

[backup]
print_saved_config = true
wipe_after_backup = true
wipe_delete_vlan_dat = true
wipe_extra_commands = []

Then run:

uvx cisco-conf-helper --loop

Add extra wipe commands

Example config:

[backup]
wipe_after_backup = true
wipe_delete_vlan_dat = true
wipe_extra_commands = [
  "delete flash:multiple-fs",
  "delete flash:private-config.text",
]

Then run:

uvx cisco-conf-helper --loop

Apply saved configs back to devices

uvx cisco-conf-helper --mode apply

Dry-run apply mode

uvx cisco-conf-helper --mode apply --dry-run

Notes

  • Backups are saved as backups/<hostname>.txt by default.
  • If the running config looks too small, the tool can ask whether to retry.
  • In loop mode, --wipe-after-backup overrides the interactive wipe question.
  • --no-wipe-after-backup forces no wipe and also skips the question.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cisco_conf_helper-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cisco_conf_helper-0.1.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file cisco_conf_helper-0.1.0.tar.gz.

File metadata

  • Download URL: cisco_conf_helper-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cisco_conf_helper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b24f0398548b54918d64673505b701c209c8326aeca246223a79e6105ccdb013
MD5 a4d98ccd3831e233409d0372c377a4d7
BLAKE2b-256 2c16143887a3273cb5893272512289c94a2c09b793390e3922e6a7fd6cf9c228

See more details on using hashes here.

File details

Details for the file cisco_conf_helper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cisco_conf_helper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cisco_conf_helper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 871fa738bba0c7ba3f2ad12120c3ded4923b917f2b792241335ab7207aafc2f1
MD5 0f02bfcce7029f8e175290d9b82b9cc3
BLAKE2b-256 6ec9df0661b3269349bf903df54cb1fb53db7a24325b2356fecae04b401e9cd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page