GoWinrm

package module
v0.0.0-...-cfab3c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

README

🖧 GoWinrm

This module provides a basic connection and shell setup for a WinRM (Windows Remote Management) client in Go, using NTLM Negotiate SSP Authentication.


⚙️ Basic Usage

args := utils.Arguments{ //map[string]any
    "endpoint": "http://host:5985/wsman",
    "username": "Administrador",
    "password": "miPassword",//Also NTLMHASH 00000000000000000000000000000000:b4b9b02e6f09a9bd760f388b67351e2b
}

conf, err := NewConf(args)
if err != nil {
    log.Fatal(err)
}

conn := NewConnection(conf)
oc, err := conn.Shell.RunCommand("whoami")
	if err != nil {
		Log.Error(err)
	} else {
		Log("STDOUT: ", oc.Stdout.String())
		Log("STDERR: ", oc.Stderr.String())
		Log("EXITCODE: ", oc.ExitCode)
	}

	err = conn.Shell.Close()
	if err != nil {
		Log.Error(err)
	}


🔑 Supported Arguments

Key Type Required Default Value
endpoint string ✅ Yes -
username string ✅ Yes -
password string ✅ Yes -
workstation string ❌ No ""
domain string ❌ No ""
locale string ❌ No "en-US"
maxEnvelopeSize int ❌ No 153600
opTimeout Duration ❌ No 60 * time.Second

Documentation

Index

Constants

View Source
const (
	DEFAULTLOCALE             = "en-US"
	DEFAULT_OPERATION_TIMEOUT = 60 * time.Second
	DEFAULT_MAX_ENV_SIZE      = 153600
)

Valores por defecto para configuración

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnConf

type ConnConf struct {
	*wsmv.SessionOptions     // Opciones específicas de la sesión WinRM (por ejemplo, locale, flags)
	*transport.NegotiateOpts // Opciones relacionadas con la negociación NTLM (endpoint, usuario, etc.)
}

ConnConf encapsula opciones para sesión y negociación NTLM.

func NewConf

func NewConf(arg utils.Arguments) (*ConnConf, error)

NewConf crea una nueva configuración de conexión (ConnConf) a partir de un map de argumentos.

type Connection

type Connection struct {
	Shell shell.Shell // Shell remoto (permite ejecutar comandos)
	// contains filtered or unexported fields
}

Connection representa una conexión activa que encapsula el transporte y el shell.

func NewConnection

func NewConnection(connConf *ConnConf) *Connection

NewConnection establece una nueva conexión usando configuración ConnConf.

Directories

Path Synopsis
internal
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL