toolchain

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package toolchain manages the Go compiler for building standalone exploits. Auto-downloads Go if not available on the system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(opts BuildOpts) error

Build compiles a Go program. Downloads the toolchain if needed.

func RenderToFile

func RenderToFile(path, tplName string, data any) error

RenderToFile renders a template to a file.

func Scaffold

func Scaffold(opts ScaffoldOpts) (string, func(), error)

Scaffold creates a temp directory with main.go and go.mod for a standalone build. Returns the dir path and a cleanup function.

Types

type BuildOpts

type BuildOpts struct {
	Dir    string // source directory (contains main.go + go.mod)
	Output string // output binary path
	OS     string // GOOS (empty = native)
	Arch   string // GOARCH (empty = native)
}

BuildOpts configures a compilation.

type ScaffoldOpts added in v0.1.3

type ScaffoldOpts struct {
	ImportPath      string // Go import path of the module package
	ModuleName      string // Full module name for sdk.Get() lookup
	Proto           string // Protocol to import: "http" or "tcp"
	ModRoot         string // Local repo root (empty = fetch from proxy)
	Version         string // Module version tag (used when ModRoot is empty)
	NeedsXML        bool   // Import pkg/xmlutil for XPath support
	NeedsFaker      bool   // Import pkg/fake for realistic fake data
	NeedsHTTPServer bool   // Import pkg/httpsrv for exploit HTTP server
}

ScaffoldOpts configures standalone scaffold generation.

func (ScaffoldOpts) TemplateData added in v0.5.0

func (o ScaffoldOpts) TemplateData() map[string]string

TemplateData returns the template variables for standalone_main.go.tpl.

Jump to

Keyboard shortcuts

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