mirror of
https://github.com/xxjwxc/public.git
synced 2025-09-26 20:01:19 +08:00
26 lines
397 B
Go
26 lines
397 B
Go
package myssh
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestMain(t *testing.T) {
|
|
c, err := New("175.24.103.30", "ubuntu", "qwer@1234", 22)
|
|
if err != nil {
|
|
fmt.Println("err", err)
|
|
}
|
|
|
|
output, err := c.Run("ls")
|
|
fmt.Printf("%v\n%v", output, err) // 返回字符串
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
// c.RunTerminal("top") 交互式
|
|
|
|
// time.Sleep(1 * time.Second)
|
|
|
|
c.Terminal() // 进入
|
|
}
|