{"id":16963824,"url":"https://github.com/hellt/cmdo","last_synced_at":"2025-03-22T14:31:00.301Z","repository":{"id":42615521,"uuid":"370993976","full_name":"hellt/cmdo","owner":"hellt","description":"Commando - run commands against networking devices in batch mode","archived":false,"fork":false,"pushed_at":"2024-09-25T07:24:34.000Z","size":110,"stargazers_count":52,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T11:52:01.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hellt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-26T10:27:40.000Z","updated_at":"2024-12-21T21:43:31.000Z","dependencies_parsed_at":"2024-10-28T13:21:47.820Z","dependency_job_id":"0baa23f0-7ad8-4eaf-b4c4-01c8f967b467","html_url":"https://github.com/hellt/cmdo","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fcmdo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fcmdo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fcmdo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fcmdo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellt","download_url":"https://codeload.github.com/hellt/cmdo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244971775,"owners_count":20540853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T23:26:16.754Z","updated_at":"2025-03-22T14:30:59.858Z","avatar_url":"https://github.com/hellt.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=center\u003e\u003cimg src=cmdo_2.svg?sanitize=true/\u003e\u003c/p\u003e\n\n[![Go Report](https://img.shields.io/badge/go%20report-A%2B-blue?style=flat-square\u0026color=424f35\u0026labelColor=bec8d2)](https://goreportcard.com/report/github.com/hellt/cmdo)\n[![Github all releases](https://img.shields.io/github/downloads/hellt/cmdo/total.svg?style=flat-square\u0026color=424f35\u0026labelColor=bec8d2)](https://github.com/hellt/cmdo/releases/)\n---\n\nCommando is a tiny tool that enables users \n* to collect command outputs from a single or a multiple networking devices defined in an inventory file\n* send file-based or string-based configs towards the devices defined in the inventory file\n\nall that with zero dependencies and a 1-click installation.\n\n[![asciicast](https://asciinema.org/a/417792.svg)](https://asciinema.org/a/417792)\n\n\n## Install\nUsing the sudo-less installation script makes it easy to download pre-built binary to the current working directory under `cmdo` name:\n\n```bash\n# for linux and darwin OSes\nbash -c \"$(curl -sL https://raw.githubusercontent.com/hellt/cmdo/master/get.sh)\"\n```\n\nWindows users are encouraged to use WSL, but if it is not possible, the `.exe` file can be found in [Releases](https://github.com/hellt/cmdo/releases) section.\n\nLinux users can leverage pre-built deb/rpm packages that are also available in the Releases section. Either download the package manually, or set `--use-pkg` flag with the install script:\n\n```\nbash -c \"$(curl -sL https://raw.githubusercontent.com/hellt/cmdo/master/get.sh)\" -- --use-pkg\n```\n\n## Quickstart\n**If you want to run commands against multiple devices at once:**\n\n1. Create an inventory file with the devices information. An example [inventory.yml](inventory.yml) file lists three different platforms.\n2. Run `./cmdo -i \u003cpath to inventory\u003e`; the tool will read the inventory file and output the results of the commands in the `./\noutput` directory.\n\n**If you want to run commands against a single device:**\n\n1. Use the CLI flags to define the device and commands to send:  \n    `-a \u003caddress\u003e` - IP/DNS name of the device  \n    `-k \u003cplatform\u003e` - one of the [supported](#supported-platforms) platforms  \n    `-u \u003cusername\u003e -p \u003cpassword\u003e` - SSH credentials  \n    `-c \u003ccommand1 :: command2 :: commandN\u003e` - a single or a list of `::`-delimited commands  \n  an example command could be:  \n  `cmdo -o stdout -a clab-scrapli-srlinux -u admin -p admin -k nokia_srlinux -c \"show version :: show system aaa\"`\n\n\n## Inventory\nAs indicated in the quickstart, `commando` can run commands against many devices as opposed to the _singe-device_ operation.\n\nFor the _bulk_ mode the devices are expressed in the inventory file. The inventory file schema is simple, it consists of the following top-level elements:\n\n```yaml\ncredentials: # container for credentials\ntransports:  # optional container for transport options\ndevices:     # here the devices connection details are\n```\n\n### Credentials\nCommando let's you define many credential parameters which you can later associate with any of the devices. For example, a credential config for access switches might differ from the core routers.\n\n```yaml\ncredentials:\n  # this is a named credential config that you can refer to in the devices settings\n  switches:\n    username: admin\n    password: admin\n  routers:\n    username: ops\n    password: secret123\n\ndevices:\n  sw1:\n    address: some.host.com\n    # credentials info from credentials containers named 'switches' will be used\n    credentials: switches\n  rtr1:\n    address: some.host2.com\n    # credentials info from credentials containers named 'routers' will be used\n    credentials: routers\n```\n\nIf you create a credential named `default`, then you can omit specifying credentials in the device configuration, this will be applied by default:\n\n```yaml\ncredentials:\n  default:\n    username: admin\n    password: admin\n\ndevices:\n  sw1: # sw1 will use `default` credentials configuration\n    address: some.host.com\n```\n\nHere is a full list of credentials configuration options:\n\n```yaml\ncredentials:\n  \u003cname\u003e:\n    username:\n    password:\n    secondary-password:\n    private-key: # takes a path to the private key\n```\n\n### Transports\nDifferent transports can be defined in the inventory and mapped to the devices to support flexible connectivity options.\n\nTransports are defined in the top level of the inventory:\n\n```yaml\ntransports:\n  myssh:\n    port: 5622\n\ndevices:\n  sw1: # sw1 will use port 5622 for SSH connection\n    address: some.host.com\n    transport: myssh\n```\n\nIf the transport is not defined for a given device, the default transport options are assumed:\n\n* port 22\n* no strict host key checking\n* transport type - standard\n* ssh config file is not used\n\nHere is a full list of transport configuration options:\n\n```yaml\ntransports:\n  \u003cname\u003e:\n    port: # ssh port number to use\n    strict-key: # true or false; sets host key checking\n    transport-type: # `standard` or system. standard transport uses Go SSH client, `system` transport uses system's default SSH client (i.e. OpenSSH)\n    ssh-config-file: # takes a path to ssh config file. Can only be used if transport is set to `system`\n```\n\n### Devices\nThe network devices are defined under `.devices` element with each device identified by a `\u003cdevice-name\u003e`:\n\n```yaml\ndevices:\n  \u003cdevice1-name\u003e:\n  \u003cdevice2-name\u003e:\n  \u003cdeviceN-name\u003e:\n```\n\nEach device holds a number of options that define the device platform, its address, and the commands to send:\n\n```yaml\ndevices:\n  \u003cdevice1-name\u003e:\n    # platform is one of arista_eos, cisco_iosxe, cisco_nxos, cisco_iosxr,\n    # juniper_junos, nokia_sros, nokia_sros_classic, nokia_srlinux\n    platform: string \n    address: string\n    credentials: string # optional reference to the defined credentials\n    transport: string # optional reference to the defined transport options\n    send-commands-from-file: /path/to/file/with/show-commands.txt\n    send-commands:\n      - cmd1\n      - cmd2\n      - cmdN\n    send-configs-from-file: /path/to/file/with/config-commands.txt\n    send-configs:\n      - cmd1\n      - cmdN\n    cfg-operations:\n      # Note: cfg operations currently supported only on: arista_eos, cisco_iosxe,\n      # cisco_nxos, cisco_iosxr, juniper_junos\n      - type: load-config\n        replace: false\n        diff: true\n        commit: false\n        # Note: there is also a \"config-from-file\" option to load configurations from a file\n        config: \"interface loopback1\\ndescription tacocat\"\n      - type: get-config\n        source: running\n```\n\n`send-commands` list holds a list of non-configuration commands which will be send towards a device. A non configuration command is a command that doesn't require to have a configuration mode enabled on a device. A typical example is a `show \u003csomething\u003e` command.  \nOutputs from each command of a `send-commands` list will be saved/printed.\n\nIf you want to keep the commands in a separate file, then you can use `send-commands-from-file` element which takes a path to a said file. You can combine `send-commands` and `send-commands-from-file` in a single device.\n\nIn contrast with `send-commands*` options, it is possible to tell `commando` to send configuration commands. For that we have the following configuration elements:\n\n* `send-configs` - takes a list of configuration commands and executes then without printing/saving any output the commands may return\n* `send-configs-from-file` - does the same, but the commands are kept in a file.\n\nEntering in the config mode is handled by commando, so your config commands doesn't need to have any `conf t` or `configure private` commands. Just remember to add the `commit` command if your device needs it.\n\nThe order these options are processed in:\n\n1. \"cfg\" operations\n2. send-configs-from-file\n3. send-configs\n4. send-commands-from-file\n5. send-commands\n\n\nCheck out the attached [example inventory](inventory.yml) file for reference.\n\n## Configuration options\n\n* `--inventory | -i \u003cpath\u003e` - sets the path to the inventory file\n* `--add-timestamp | -t` - appends the timestamp to the outputs directory, which results in the output directory to be named like `outputs_2021-06-02T15:08:00+02:00`.\n* `--output | -o value` - sets the output destination. Defaults to `file` which writes the results of the commands to the per-command files. If set to `stdout`, will print the commands to the terminal.\n* `--filter | -f 'pattern'` - a filter to apply to device name to select the devices to which the commands will be sent. Can be a Go regular expression.\n\nFor the single-device operation mode the following flags must be used to define a device:\n* `--address | -a \u003cip/dns\u003e` - address of the device\n* `--platform | -k \u003cplatform\u003e` - one of the [supported](#supported-platforms) platform names\n* `--username | -u \u003cstring\u003e` - username\n* `--password | -p \u003cstring\u003e` - password\n* `--command | -c \u003ccommand1 :: commandN\u003e` - list of commands to send, can be delimited with `::` to provide a list of commands\n\n## Supported platforms\nCommando leverages [scrapligo](https://github.com/scrapli/scrapligo) project to support the major network platforms:\n| Network OS                       | Platform name                              |\n| -------------------------------- | ------------------------------------------ |\n| Arista EOS                       | `arista_eos`                               |\n| Cisco XR/XE/NXOS                 | `cisco_iosxr`, `cisco_iosxe`, `cisco_nxos` |\n| Juniper JunOS                    | `juniper_junos`                            |\n| Nokia SR OS (MD-CLI and Classic) | `nokia_sros`, `nokia_sros_classic`         |\n\nIn addition to that list, commando has the ability to add community provided scrapli drivers, such as:\n| Network OS     | Platform name                                                  |\n| -------------- | -------------------------------------------------------------- |\n| Nokia SR Linux | [`nokia_srlinux`](https://github.com/srl-labs/srlinux-scrapli) |\n\n## Attributions\n* Bullet icon is made by \u003ca href=\"https://smashicons.com/\" title=\"Smashicons\"\u003eSmashicons\u003c/a\u003e from \u003ca href=\"https://www.flaticon.com/\" title=\"Flaticon\"\u003ewww.flaticon.com\u003c/a\u003e\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellt%2Fcmdo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellt%2Fcmdo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellt%2Fcmdo/lists"}