🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

github.com/xiaoliuxiao6/sshClient

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/xiaoliuxiao6/sshClient

v1.0.0
Source
Go
Version published
Created
Source

使用示例

package main

import (
	"fmt"

	customizeSSHClient "github.com/customize-ssh-client"
)

func main() {
	// 定义需要连接的远程主机信息(修改 IP 和端口信息)
	sshHost := "10.100.0.21"
	sshPort := "22"
	sshUser := "root"
	sshAddr := fmt.Sprintf("%v:%v", sshHost, sshPort)

	// 使用秘钥方式连接(修改私钥地址)
	id_rsa := "/root/.ssh/id_rsa"
	client := customizeSSHClient.SSHPrivateKey(sshAddr, sshUser, id_rsa)

	// 定义需要在远程服务器上执行的命令
	shellList := []string{
		"whoami",
		"ls -lha /root",
	}
	customizeSSHClient.ExecShell(client, shellList)
}

FAQs

Package last updated on 10 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts