Files
Roger eca1f058c6 refactor: move the ABE unit into internal/abe (#670)
crypto/windows and utils/injector were the last public packages, against the no-library-API rule, and
utils/ named nothing. They move as one unit; only import paths and Makefile variables change, and the
built payload is byte-identical.
2026-10-29 16:48:46 +08:00

33 lines
955 B
Go

//go:build windows && abe_embed
// Package payload holds the compiled reflective-injection ABE payload
// binary and exposes it to the rest of HackBrowserData. The `abe_embed`
// build tag selects between a real //go:embed'd binary (this file) and
// a stub (stub_windows.go) so the default `go build ./...` succeeds on
// machines without the zig toolchain.
package payload
import (
_ "embed"
"fmt"
)
//go:generate make -C ../../.. payload
//go:embed abe_extractor_amd64.bin
var abePayloadAmd64 []byte
// Get returns the embedded ABE payload for the given architecture.
// Only "amd64" is supported today; x86 / ARM64 payloads are future work.
func Get(arch string) ([]byte, error) {
switch arch {
case "amd64":
if len(abePayloadAmd64) == 0 {
return nil, fmt.Errorf("abe: amd64 payload is empty (build system bug)")
}
return abePayloadAmd64, nil
default:
return nil, fmt.Errorf("abe: arch %q not supported in this build", arch)
}
}