util

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: GPL-3.0 Imports: 16 Imported by: 36

README

util

Overview

Shared utilities imported by server and implant code. Contains path helpers, resource identifiers, and crypto wrappers. Utilities focus on cryptography, files, generics, and implant within the util package.

Go Files

  • cryptography.go – Provides shared cryptographic helpers and constants.
  • files.go – File handling utilities for copying, hashing, and temp files.
  • generics.go – Miscellaneous generic helper functions used across packages.
  • implant.go – Utilities for working with implant metadata and artifacts.
  • implant_test.go (tests) – Tests implant utility helpers.
  • paths_generic.go – Platform-neutral path helpers and directories.
  • paths_test.go (tests) – Tests path helper behavior.
  • paths_windows.go – Windows-specific path utilities.
  • resource_ids.go – Generates deterministic resource identifiers.

Sub-packages

  • encoders/ – Common encoder implementations shared across binaries. Offers shared registry wiring and helper encoders.
  • leaky/ – Leak detection helpers for debugging resource usage. Implements buffering utilities to capture leaked output.
  • minisign/ – Minisign signing and verification helpers. Wraps minisign key handling, signature generation, and validation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedName added in v1.5.18

func AllowedName(name string) error

func ByteCountBinary

func ByteCountBinary(b int64) string

ByteCountBinary - Pretty print byte size

func ChmodR

func ChmodR(path string, filePerm, dirPerm os.FileMode) error

ChmodR - Recursively chmod

func Contains added in v1.5.30

func Contains[T comparable](elements []T, v T) bool

func CopyFile added in v1.5.0

func CopyFile(src string, dst string) error

CopyFile - Copy a file from src to dst

func DeflateBuf added in v1.5.22

func DeflateBuf(data []byte) []byte

DeflateBuf - Deflate a buffer using BestCompression (9)

func Float64 added in v1.6.0

func Float64() float64

Float64 returns a uniform float64 in [0.0, 1.0). Panics if crypto/rand fails.

func Int63n added in v1.6.0

func Int63n(n int64) int64

Int63n returns a uniform int64 in [0, n). Panics if n <= 0 or if crypto/rand fails.

func Intn added in v1.6.0

func Intn(n int) int

Intn returns, like math/rand.Intn, a uniform int in [0, n). Panics if n <= 0 or if the OS CSPRNG fails.

func Keys added in v1.6.0

func Keys[M ~map[K]V, K comparable, V any](m M) []K

From the x/exp source code - gets a slice of keys for a map

func PreludeDecrypt added in v1.5.16

func PreludeDecrypt(data []byte, key []byte) []byte

PreludeDecrypt a command

func PreludeEncrypt added in v1.5.16

func PreludeEncrypt(data []byte, key []byte, iv []byte) []byte

PreludeEncrypt the results

func RC4EncryptUnsafe added in v1.5.44

func RC4EncryptUnsafe(data []byte, key []byte) []byte

RC4 encryption - Cryptographically insecure! Added for stage-listener shellcode obfuscation Dont use for anything else!

func ReadFileFromTarGz added in v1.5.0

func ReadFileFromTarGz(tarGzFile string, tarPath string) ([]byte, error)

ReadFileFromTarGz - Read a file from a tar.gz file in-memory

func RemoveElement added in v1.6.0

func RemoveElement(slice []uint64, value uint64) []uint64

func ResolvePath added in v1.5.0

func ResolvePath(in string) string

ResolvePath - Resolve a path from an assumed root path

func Shuffle added in v1.6.0

func Shuffle(n int, swap func(i, j int))

Shuffle does an in-place Fisher–Yates using secure.Intn. Same semantics as math/rand.Shuffle.

Types

This section is empty.

Directories

Path Synopsis
cmd
assets command
basex
Package basex provides fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression.
Package basex provides fast base encoding / decoding of any given alphabet using bitcoin style leading zero compression.
Package lib leakbuf.go is stolen form ss
Package lib leakbuf.go is stolen form ss
Package minisign implements the minisign signature scheme.
Package minisign implements the minisign signature scheme.

Jump to

Keyboard shortcuts

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