output

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Standard colors
	ColorReset   = "\033[0m"
	ColorBold    = "\033[1m"
	ColorDim     = "\033[2m"
	ColorRed     = "\033[31m"
	ColorGreen   = "\033[32m"
	ColorYellow  = "\033[33m"
	ColorBlue    = "\033[34m"
	ColorMagenta = "\033[35m"
	ColorCyan    = "\033[36m"
	ColorWhite   = "\033[37m"

	// Bright colors
	ColorBrightRed     = "\033[91m"
	ColorBrightGreen   = "\033[92m"
	ColorBrightYellow  = "\033[93m"
	ColorBrightBlue    = "\033[94m"
	ColorBrightMagenta = "\033[95m"
	ColorBrightCyan    = "\033[96m"
	ColorBrightWhite   = "\033[97m"

	// Background colors
	BgRed   = "\033[41m"
	BgGreen = "\033[42m"
	BgBlue  = "\033[44m"
)

ANSI color codes

Variables

This section is empty.

Functions

func Banner(text string) string

Banner returns colored banner text

func Bold

func Bold(text string) string

Bold returns a bold white string

func Count

func Count(count int) string

Count returns a bright white colored count number

func DefaultWriter

func DefaultWriter() io.Writer

DefaultWriter returns stdout for output rendering.

func Error

func Error(text string) string

Error returns a red colored string

func Highlight

func Highlight(text string) string

Highlight returns a bright cyan colored string

func Host

func Host(hostname string) string

Host returns a bright blue colored hostname/IP

func Info

func Info(text string) string

Info returns a blue colored string

func Port

func Port(port int) string

Port returns a bright magenta colored port number

func PrintBanner

func PrintBanner()

PrintBanner displays the application banner

func PrintCSVReport

func PrintCSVReport(writer io.Writer, allResults map[string][]scanner.ScanResult, targets []string) error

PrintCSVReport prints one row per open port.

func PrintJSONLReport

func PrintJSONLReport(w io.Writer, target string, targets []string, allResults map[string][]scanner.ScanResult) error

PrintJSONLReport prints one JSON object per open port.

func PrintJSONReport

func PrintJSONReport(w io.Writer, target string, ports []int, targets []string, allResults map[string][]scanner.ScanResult, serviceScan bool, duration time.Duration) error

PrintJSONReport prints the scan results in a machine-friendly JSON document.

func PrintScanStart

func PrintScanStart(host string, numPorts int)

PrintScanStart displays the initial scan information

func Service

func Service(name string) string

Service returns a bright green colored service name

func State

func State(state string) string

State returns a green colored "open" state

func StatusError

func StatusError(message string) string

StatusError returns a status message with red error indicator

func StatusOK

func StatusOK(message string) string

Status returns a status message with green success indicator

func StatusWarn

func StatusWarn(message string) string

StatusWarn returns a status message with yellow warning indicator

func Success

func Success(text string) string

Success returns a green colored string

func Version

func Version(version string) string

Version returns a bright yellow colored version

func Warning

func Warning(text string) string

Warning returns a yellow colored string

Types

type OutputFormatter

type OutputFormatter struct {
	IncludeServices bool
	IncludeDetails  bool
}

OutputFormatter handles the formatting and display of scan results

func NewOutputFormatter

func NewOutputFormatter(includeServices bool, includeDetails bool) *OutputFormatter

NewOutputFormatter creates a new OutputFormatter instance

func (*OutputFormatter) PrintResults

func (of *OutputFormatter) PrintResults(results []scanner.ScanResult)

PrintResults displays the scan results in a formatted table

Jump to

Keyboard shortcuts

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