All Projects → shenbowei → switch-ssh-go

shenbowei / switch-ssh-go

Licence: MIT License
A packaged SSH library for switches (huawei,h3c,cisco)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to switch-ssh-go

FastTunnel
expose a local server to the internet. 高性能跨平台的内网穿透解决方案 远程内网计算机 域名访问内网站点 反向代理内网服务 端口转发 http代理
Stars: ✭ 815 (+1437.74%)
Mutual labels:  ssh
lobbyboy
A lobby boy will create a VPS server when you need one, and destroy it after using it.
Stars: ✭ 212 (+300%)
Mutual labels:  ssh
piv-agent
An SSH and GPG agent which you can use with your PIV hardware security device (e.g. a Yubikey).
Stars: ✭ 31 (-41.51%)
Mutual labels:  ssh
Homebrew-Guide
Guide for getting CFW setup on your Nintendo Switch (And Wii U)
Stars: ✭ 104 (+96.23%)
Mutual labels:  switch
backup-action
🗄️ Github Action to backup MySQL, MongoDB and PostgreSQL databases
Stars: ✭ 27 (-49.06%)
Mutual labels:  ssh
cl
Concurrently run commands across multiple servers via SSH
Stars: ✭ 45 (-15.09%)
Mutual labels:  ssh
synpse
Synpse is an all-in-one solution to manage your servers and IoT devices providing declarative app deployment, SSH access and TCP tunnels
Stars: ✭ 17 (-67.92%)
Mutual labels:  ssh
sshlatex
A collection of hacks to efficiently run LaTeX via ssh
Stars: ✭ 32 (-39.62%)
Mutual labels:  ssh
OnlySwitch
⚙️ All-in-One menu bar app, hide 💻MacBook Pro's notch, dark mode, AirPods, Shortcuts
Stars: ✭ 1,288 (+2330.19%)
Mutual labels:  switch
OctopathTraveler
Switch OctopathTraveler SaveDate Editor
Stars: ✭ 32 (-39.62%)
Mutual labels:  switch
tmuxpair
Command line script for setting up a temporary tmux session for pair programming
Stars: ✭ 34 (-35.85%)
Mutual labels:  ssh
e-commerce-microservices
REST Microservices architecture for E-commerce with Spring boot, Cloud and multiple modules
Stars: ✭ 102 (+92.45%)
Mutual labels:  session-management
ssh-am
SSH ACCOUNT MANAGEMENT
Stars: ✭ 15 (-71.7%)
Mutual labels:  ssh
ssh
golang ssh lib simple for use
Stars: ✭ 15 (-71.7%)
Mutual labels:  ssh
rustica
An SSHCA that uses a standard Yubikey to issue new host and user certificates.
Stars: ✭ 24 (-54.72%)
Mutual labels:  ssh
dystopia
Low to medium multithreaded Ubuntu Core honeypot coded in Python.
Stars: ✭ 59 (+11.32%)
Mutual labels:  ssh
SwiTAS
A usable toolkit for creating Nintendo Switch TASes with homebrew
Stars: ✭ 54 (+1.89%)
Mutual labels:  switch
Kali-Linux-Tools-Interface
Graphical Web interface developed to facilitate the use of security information tools.
Stars: ✭ 169 (+218.87%)
Mutual labels:  ssh
Nintendo-Switch-JoyCon-Hack
Hardwiring a push button in a JoyCon to grant bootloader access
Stars: ✭ 44 (-16.98%)
Mutual labels:  switch
piping-ssh-web
SSH over HTTPS via Piping Server on Web browser
Stars: ✭ 60 (+13.21%)
Mutual labels:  ssh

switch-ssh-go

A packaged SSH library for switches (huawei,h3c,cisco). A session pool is implemented to avoid repeated connection devices and automatically clear sessions that are not used for 10 minutes.

Installation

$ go get github.com/shenbowei/switch-ssh-go

Basic Usage

In Code

switch-ssh-go implemented a connection pool to save the session, and each session verifies its availability before executing the commands, so you can call the following method repeatedly (not repeatedly connecting the device).

//get the switch brand(vendor), include h3c,huawei and cisco
brand, err := ssh.GetSSHBrand(user, password, ipPort)

//run the cmds in the switch, and get the execution results
result, err := ssh.RunCommands(user, password, ipPort, cmds...)

//run the cmds in the switch with the device brand(the first connection will be faster), and get the execution results
result, err := ssh.RunCommandsWithBrand(user, password, ipPort, ssh.CISCO, cmds...)

example

package main

import (
    "fmt"
    "github.com/shenbowei/switch-ssh-go"
)

func main() {
    user := "your device ssh name"
    password := "your device ssh password"
    ipPort := "ip:22"

    //get the switch brand(vendor), include h3c,huawei and cisco
    brand, err := ssh.GetSSHBrand(user, password, ipPort)
    if err != nil {
        fmt.Println("GetSSHBrand err:\n", err.Error())
    }
    fmt.Println("Device brand is:\n", brand)

    //run the cmds in the switch, and get the execution results
    cmds := make([]string, 0)
    cmds = append(cmds, "dis clock")
    cmds = append(cmds, "dis vlan")
    result, err := ssh.RunCommands(user, password, ipPort, cmds...)
    if err != nil {
        fmt.Println("RunCommands err:\n", err.Error())
    }
    fmt.Println("RunCommands result:\n", result)
}

Licenses

switch-ssh-go is released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].