opsutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package opsutil holds helpers shared by several operations and engines that belong to no one domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesAsLatin1

func BytesAsLatin1(b []byte) string

BytesAsLatin1 maps each byte to its code point, matching CyberChef's Utils.byteArrayToChars. Unlike BytesAsText it never tries UTF-8 first.

func BytesAsText

func BytesAsText(data []byte) string

BytesAsText reads bytes as CyberChef reads a dish: as UTF-8 where that works, and otherwise one character per byte, so a byte that is not valid UTF-8 keeps its value instead of becoming U+FFFD.

func ChiSquaredCDF

func ChiSquaredCDF(x, k float64) float64

ChiSquaredCDF returns the probability that a chi-squared variable with k degrees of freedom is at most x.

func EscapeHTML

func EscapeHTML(s string) string

EscapeHTML escapes HTML-significant characters the way CyberChef's Utils.escapeHtml does.

func EscapeWhitespace

func EscapeWhitespace(s string) string

EscapeWhitespace maps control characters 0x09–0x10 into the Private Use Area (0xE000 + code) so they render, matching Utils.EscapeWhitespace.

func ExpandAlphRange

func ExpandAlphRange(alph string) string

ExpandAlphRange expands an alphabet specification such as "A-Za-z0-9+/=" into its full character sequence. A backslash escapes a literal dash ("\\-").

func ParseEscapedChars

func ParseEscapedChars(s string) string

ParseEscapedChars converts recognised backslash escape sequences into their literal characters. Unrecognised sequences (e.g. "\d") are left intact.

func SplitTopLevel

func SplitTopLevel(s string, sep byte) []string

SplitTopLevel splits s on sep, ignoring separators inside brackets, parentheses or quotes. Selector and path syntaxes both nest that way, so a naive split would cut a bracketed subexpression in half.

func TextAsBytes

func TextAsBytes(s string) []byte

TextAsBytes writes text back out as CyberChef writes it: one byte per character while every character fits in a byte, and the whole string as UTF-8 as soon as one does not. It is the inverse of BytesAsText, and what decides whether charcode 255 leaves as the byte 0xFF or as its UTF-8 form.

Types

This section is empty.

Jump to

Keyboard shortcuts

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