1 Star 0 Fork 0

gscsd5 / K8tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
WinrmCmd.go 880 Bytes
一键复制 编辑 原始数据 按行查看 历史
k8gege 提交于 2020-06-05 09:09 . Add files via upload
package main
import (
"github.com/masterzen/winrm"
"fmt"
"os"
"strconv"
)
//Winrm Remote Shell by k8gege
//http://k8gege.org/Ladon/WinrmScan.html
#C:\Users\k8gege\Desktop\>winrmcmd.exe 192.168.1.116 5985 k8gege k8gege520 whoami
#k8gege
var help = func () {
fmt.Println("Winrm Shell by k8gege")
fmt.Println("====================================================")
fmt.Println("winrmcmd host port user pass cmd")
}
func main() {
args := os.Args
if len(args) < 5 || args == nil {
help()
return
}
host := args[1]
port,err := strconv.Atoi(args[2])
user := args[3]
pass := args[4]
cmd := args[5]
endpoint := winrm.NewEndpoint(host, port, false, false, nil, nil, nil, 0)
client, err := winrm.NewClient(endpoint, user, pass)
if err != nil {
panic(err)
}
client.Run(cmd, os.Stdout, os.Stderr)
}
1
https://gitee.com/gscsd5/K8tools.git
git@gitee.com:gscsd5/K8tools.git
gscsd5
K8tools
K8tools
master

搜索帮助