How falconopsllc/goexec works
Project Type and Purpose
• GoExec is an open-source, command-line “remote execution multi-tool” written in Go.
• It bundles multiple Windows remote-execution methods (WMI, DCOM, SCMR, TSCH) under a single CLI.
• It’s a library + CLI tool rather than a web or database application.
File Structure
• cmd/ ← Cobra-based entrypoint and subcommand definitions (root.go, dcom.go, wmi.go, etc.)
• pkg/goexec/ ← Core library implementing each module: wmi, dcom, scmr, tsch, smb, dce, auth, proxy, io, exec abstractions.
• internal/util/ ← Shared utility code (logging, error handling, JSON output).
• main.go ← Instantiates the CLI (goexec binary).
• Dockerfile, .github/workflows, goreleaser config ← Build, CI/CD, and packaging.
README for Additional Insights
• Each subcommand (e.g. goexec wmi proc) wires up:
• Authentication (NT-hash, Kerberos, certificates)
• RPC transport (DCERPC over SMB, named pipes, TCP)
• Execution method (WMI Create, DCOM ShellExec, Service Control, Task Scheduler)
• Optional output retrieval via SMB file transfer
• Dependencies: go-msrpc for DCERPC, adauth for Kerberos/LDAP, standard Go libraries.
a. Main Components
• CLI Layer:
– User / Operator
– Cobra command dispatcher (cmd/)
• Core Library:
– Execution modules (pkg/goexec/{wmi,dcom,scmr,tsch})
– Networking clients (pkg/goexec/dce, pkg/goexec/smb, pkg/goexec/auth, pkg/goexec/proxy)
– I/O and logging (pkg/goexec/io, internal/util)
• External Libraries:
– go-msrpc
– adauth
• Build & CI:
– Docker container
– GitHub Actions / goreleaser
• Target Environment:
– Remote Windows Host
– Windows subsystems: WMI service, DCOM objects, Service Control Manager, Task Scheduler
– SMB share for output retrieval
b. Relationships and Data Flows
1. Operator invokes goexec <module> <method> [flags].
2. Cobra CLI parses args → dispatches to the chosen module.
3. Module configures authentication (Kerberos/NTLM/certs).
4. Module selects transport:
• DCE RPC client (pkg/goexec/dce)
• SMB client for file transfer (pkg/goexec/smb)
5. Module issues RPC calls to the remote host’s Windows service:
• WMI: Win32_Process.Create
• DCOM: ShellExec via MMC20.Application or ShellWindows
• SCMR: CreateService / ChangeServiceConfig
• TSCH: SchRpcRegisterTask, SchRpcRun
6. If --out requested: module pipes stdout/stderr to a temp file, then uses SMB client to download.
7. Core util handles logging (plain text / JSON), error formatting.
8. Optional: Docker container wraps the entire binary for packaging and isolation.
c. Architectural Patterns and Principles
• Modular CLI with plug-in style modules (wmi, dcom, scmr, tsch).
• Clear separation of concerns:
– CLI parsing (cmd/)
– Core business logic (pkg/goexec/)
– Networking layers (dce, smb, auth, proxy)
– Utility & logging (internal/util)
• Interface abstraction for execution, I/O, authentication to facilitate testing and future modules.
• Dependency injection for transport clients and loggers.
d. Key Technologies and Libraries
• Go (1.23+)
• Cobra (CLI framework)
• go-msrpc (DCERPC)
• adauth (Kerberos / LDAP)
• Docker for containerized builds
• goreleaser + GitHub Actions for CI/CD