Skip to content

Ido-Don/commander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commander

Commander is a powerful command-line interface (CLI) scraping tool designed for managing and interacting with multiple network devices simultaneously.

Features

  • ⚡Blazingly Fast: Commander is optimized for speed, allowing you to execute commands swiftly across your network devices.
  • 🧵Multi-threaded: Leverage the efficiency of multi-threading to process commands concurrently, ensuring quick and efficient communication with all devices.
  • 🔒Secure by Design: Prioritizing security, Every connection is made from your local machine. in addition, Commander stores sensitive connection information, such as passwords and IPs locally on your computer, in Keepass, a renowned open-source password manager.

Problem Statement

Networks, especially in large-scale environments, often face challenges in maintaining standardization. The complexity grows, making it challenging for networking and IT teams to enforce uniform configurations across devices. Without proper tools, networks may become scattered and prone to inconsistencies, or administrators may spend hours manually configuring each device.

While tools like Ansible, Puppet, and Chef are excellent for maintaining standardization, they come with a steep learning curve, additional infrastructure management, and setup complexities.

Commander aims to provide a simpler alternative, allowing users to swiftly execute commands across multiple devices without the overhead of a complex infrastructure.

Installation

Install Commander with a simple pip command:

pip install NetworkCommander

compile from source

if you want to compile from source you can do that with poetry.

first you have to make sure poetry is installed

poetry --version

after you did that you can start the build.

poetry install
poetry build

a folder named dist will apper with the .tar.gz and .whl files.

pip install ./dist/path/to/.whl

after that you can fully use commander

Usage

Version Check

Check the version of Commander:

commander version

Initialization

Before using Commander, ensure it's initialized. Run the following command to generate the keepass database and provide the password for it:

commander init

Device Management

List Devices

List all devices under your command, optionally filtered by tags:

commander device list --tag <tag_name>

Add Device

Add a new device to the database, specifying the device's password:

commander device add "router1(cisco_ios) -> root@1.1.1.1"

Alternatively, you can provide a file containing device strings:

commander device add --devices_file path/to/devices_file

If you don't enter any device or a device file the program defaultly will read from devices from stdin.

commander device add

r1(cisco_ios) -> root@localhost:5000
^Z

Remove Device

Remove one or more devices from the database:

commander device remove <device_name_1> <device_name_2> ...

Tag Management

Add Tag

Add a tag to devices for better segmentation:

commander device tag add <tag_name> <device_name_1> <device_name_2> ...

Remove Tag

Remove a tag from devices:

commander device tag remove <tag_name> <device_name_1> <device_name_2> ...

List Tags

List all tags applied to devices:

commander device tag list

Device Connectivity

Ping Devices

this command will try to connect to every device in your database, it will not deploy any commands to the device.

optionally filter by tags.

commander device ping --tag <tag_name>

Command Deployment

in order to deploy a command to the devices in your database need to use the deploy command

commander device deploy "<command_1>" "<command_2>" 

in case you want to deploy the commands to some devices but not all you can use tags.

commander device deploy --tag "router" "<command_1>" "<command_2>" 

if there are any spasific devices you need to deploy to you can use the --device option also

commander device deploy --tag "router" --device "device not tagged with router" "<command_1>" "<command_2>" 

By default, the "deploy" command will deploy with the most basic permission level possible.

In order to escalate the permisions you need to specify the --permision_level flag

commander device deploy  --permision_level "configure_terminal" "<command_1>" "<command_2>" 

Output Folder (Optional)

Save command output to a specified folder:

commander device deploy --output_folder <path/to/output_folder> "<command>"

Conclusion

Commander provides a streamlined solution for scraping network devices, offering speed and simplicity without the complexities of traditional configuration management tools. Empower your networking and IT teams to enforce standardization across your network effortlessly.

Have a great experience with Commander!