libssh

LibSSH implementation in Crystal lang

libssh

LibSSH implementation in Crystal Lang to execute Cisco commands

Configure the user account with privilege level 15 (full access) to be able to login directly into enabled mode

Switch> enable
Switch# configure terminal
Switch(config)# username YOURUSERNAME privilege 15 secret YOURPASSWORD

Installation

RedHat

sudo yum install libssh-devel

Debian / Ubuntu

sudo apt install libssh-dev

MAC OS

brew install libssh
  1. Add the dependency to your shard.yml:
dependencies:
  libssh:
    github: xtokio/libssh
  1. Run shards install

Usage

require "libssh"

ssh = LibSSH.new("example.com","user","password")

# Execute command
response = ssh.execute_command("show running-config interface gi1/0/1")
puts response

# Execute command in config mode
response ssh.execute_config_command(["do show running-config interface gi1/0/1"])
puts response

# Create VLAN
ssh.execute_config_command(["vlan 10","name vlan10"])

# Remove VLAN
ssh.execute_config_command(["no vlan 10"])

Contributing

  1. Fork it (https://github.com/xtokio/libssh/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

libssh

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • 17 days ago
  • July 11, 2024
License

MIT License

Links
Synced at

Sat, 23 Aug 2025 04:09:18 GMT

Languages