output

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANSIReset   = "\033[0m"
	ANSIBold    = "\033[1m"
	ANSIDim     = "\033[2m"
	ANSIRed     = "\033[31m"
	ANSIGreen   = "\033[32m"
	ANSIYellow  = "\033[33m"
	ANSIBlue    = "\033[34m"
	ANSIMagenta = "\033[35m"
	ANSICyan    = "\033[36m"
)
View Source
const (
	LootFingerprint = "fingerprint"
	LootWeakpass    = "weakpass"
	LootVuln        = "vuln"
)
View Source
const (
	AssetItemService     = "service"
	AssetItemPath        = "path"
	AssetItemFingerprint = "fingerprint"
	AssetItemLoot        = "loot"
	AssetItemNote        = "note"
	AssetItemResponse    = "response"
	AssetItemError       = "error"
)

Variables

This section is empty.

Functions

func AssetDataInt

func AssetDataInt(data map[string]any, key string) int

func AssetDataString

func AssetDataString(data map[string]any, key string) string

func AssetDataStrings

func AssetDataStrings(data map[string]any, key string) []string

func AssetItemDetail

func AssetItemDetail(item AssetItem) string

func BuildTimelineMarkdown

func BuildTimelineMarkdown(entries []TimelineEntry) string

func CompactStrings

func CompactStrings(values ...string) []string

func ExtractQuotedMarkdown

func ExtractQuotedMarkdown(raw string) string

func ExtractQuotedSummary

func ExtractQuotedSummary(raw string) string

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

func FormatAssetReport

func FormatAssetReport(result *Result, color bool) string

func FormatLine

func FormatLine(prefix, body string, color Color) string

func HasTag

func HasTag(tags []string, tag string) bool

func OutputPrefix

func OutputPrefix(source string, colorFn func(string) string) string

func ParseRecordData

func ParseRecordData[T any](r Record) (T, error)

func RenderFile

func RenderFile(path, format, outputPath string) error

func RenderTimeline

func RenderTimeline(w io.Writer, entries []TimelineEntry) error

func RenderTimelineMarkdown

func RenderTimelineMarkdown(w io.Writer, entries []TimelineEntry) error

func SanitizeLine

func SanitizeLine(line string, color Color) string

func StripANSI

func StripANSI(s string) string

func TruncateStr

func TruncateStr(s string, maxLen int) string

func WebPath

func WebPath(rawURL string) string

Types

type AgentEvent

type AgentEvent struct {
	Type            string           `json:"type"`
	SessionID       string           `json:"session_id"`
	ParentSessionID string           `json:"parent_session_id"`
	Turn            int              `json:"turn"`
	ToolCallID      string           `json:"tool_call_id"`
	ToolName        string           `json:"tool_name"`
	Arguments       string           `json:"arguments"`
	Result          string           `json:"result"`
	IsError         bool             `json:"is_error"`
	Error           string           `json:"error"`
	Stop            string           `json:"stop"`
	Message         *AgentEventMsg   `json:"message"`
	ToolResults     []AgentEventMsg  `json:"tool_results"`
	Usage           *AgentEventUsage `json:"usage"`
	ContextTokens   int              `json:"context_tokens"`
	NewMessages     int              `json:"new_messages"`
	RequestModel    string           `json:"request_model"`
	RequestMessages int              `json:"request_messages"`
	RequestTools    int              `json:"request_tools"`
}

type AgentEventMsg

type AgentEventMsg struct {
	Role       string          `json:"role"`
	Content    string          `json:"content"`
	ToolCalls  []agentToolCall `json:"tool_calls"`
	ToolCallID string          `json:"tool_call_id"`
}

type AgentEventUsage

type AgentEventUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
	CacheReadTokens  int `json:"cache_read_tokens"`
	CacheWriteTokens int `json:"cache_write_tokens"`
}

type Asset

type Asset struct {
	ID     string      `json:"id"`
	Key    string      `json:"key"`
	Target string      `json:"target"`
	Title  string      `json:"title,omitempty"`
	Status string      `json:"status,omitempty"`
	Items  []AssetItem `json:"items,omitempty"`
}

type AssetItem

type AssetItem struct {
	Kind    string         `json:"kind"`
	Source  string         `json:"source,omitempty"`
	Target  string         `json:"target,omitempty"`
	Status  string         `json:"status,omitempty"`
	Title   string         `json:"title,omitempty"`
	Summary string         `json:"summary,omitempty"`
	Detail  string         `json:"detail,omitempty"`
	Tags    []string       `json:"tags,omitempty"`
	Data    map[string]any `json:"data,omitempty"`
	Raw     string         `json:"raw,omitempty"`
}

type Color

type Color struct {
	Enabled bool
}

func NewColor

func NewColor(enabled bool) Color

func (Color) Blue

func (c Color) Blue(s string) string

func (Color) Bold

func (c Color) Bold(s string) string

func (Color) Code

func (c Color) Code(code string) string

func (Color) Cyan

func (c Color) Cyan(s string) string

func (Color) Dim

func (c Color) Dim(s string) string

func (Color) ForPriority

func (c Color) ForPriority(p string) func(string) string

func (Color) ForStatus

func (c Color) ForStatus(status string) func(string) string

func (Color) Green

func (c Color) Green(s string) string

func (Color) GreenBold

func (c Color) GreenBold(s string) string

func (Color) Magenta

func (c Color) Magenta(s string) string

func (Color) Red

func (c Color) Red(s string) string

func (Color) RedBold

func (c Color) RedBold(s string) string

func (Color) Status

func (c Color) Status(s string) string

func (Color) Wrap added in v0.2.7

func (c Color) Wrap(s, code string) string

func (Color) Yellow

func (c Color) Yellow(s string) string

func (Color) YellowBold

func (c Color) YellowBold(s string) string

type Error

type Error struct {
	Source  string `json:"source,omitempty"`
	Message string `json:"message"`
}

type Loot

type Loot struct {
	Kind        string         `json:"kind"`
	Target      string         `json:"target"`
	Priority    string         `json:"priority"`
	Description string         `json:"description,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Data        map[string]any `json:"data,omitempty"`
}

Loot represents a valuable scan output — a confirmed vulnerability, compromised credential, identified technology stack, or other security-relevant discovery.

func (Loot) Key

func (l Loot) Key() string

type Record

type Record struct {
	Type      RecordType      `json:"type"`
	Timestamp time.Time       `json:"ts"`
	Loot      bool            `json:"loot,omitempty"`
	Data      json.RawMessage `json:"data"`
}

func NewLootRecord

func NewLootRecord(t RecordType, data interface{}) Record

func NewRecord

func NewRecord(t RecordType, data interface{}) Record

func ParseRecord

func ParseRecord(line []byte) (Record, error)

func ParseRecordFile

func ParseRecordFile(path string) ([]Record, error)

func (Record) Marshal

func (r Record) Marshal() []byte

type RecordType

type RecordType string
const (
	TypeScanStart RecordType = "scan_start"
	TypeGogo      RecordType = "gogo"
	TypeSpray     RecordType = "spray"
	TypeZombie    RecordType = "zombie"
	TypeNeutron   RecordType = "neutron"
	TypeAgent     RecordType = "agent"
	TypeScanEnd   RecordType = "scan_end"
)

type Result

type Result struct {
	Summary   Summary                `json:"summary"`
	Assets    []Asset                `json:"assets,omitempty"`
	Services  []*parsers.GOGOResult  `json:"services,omitempty"`
	WebProbes []*parsers.SprayResult `json:"web_probes,omitempty"`
	Loots     []Loot                 `json:"loots,omitempty"`
	Errors    []Error                `json:"errors,omitempty"`
}

func RecordsToResult

func RecordsToResult(records []Record) *Result

RecordsToResult converts parsed records into a Result for asset report rendering.

func RenderRecordFileAsAsset

func RenderRecordFileAsAsset(path string, color bool, aggregate func(*Result) []Asset) (string, *Result, error)

RenderRecordFileAsAsset reads a record JSONL file and renders as an asset report.

type ScanEnd

type ScanEnd struct {
	Duration float64 `json:"duration_s"`
	Targets  int     `json:"targets"`
	Services int     `json:"services"`
	Webs     int     `json:"webs"`
	Loots    int     `json:"loots"`
	Errors   int     `json:"errors"`
}

type ScanStart

type ScanStart struct {
	Targets []string `json:"targets"`
	Mode    string   `json:"mode"`
	Flags   []string `json:"flags"`
}

type Summary

type Summary struct {
	Targets    int       `json:"targets"`
	Services   int       `json:"services"`
	Webs       int       `json:"webs"`
	Probes     int       `json:"probes"`
	Loots      int       `json:"loots"`
	Errors     int       `json:"errors"`
	Tasks      int64     `json:"tasks"`
	Requests   int64     `json:"requests"`
	Duration   string    `json:"duration"`
	StartedAt  time.Time `json:"started_at,omitempty"`
	FinishedAt time.Time `json:"finished_at,omitempty"`
}

type TimelineEntry

type TimelineEntry struct {
	Timestamp time.Time
	Type      string
	Data      timelineItem
}

func ParseTimelineFile

func ParseTimelineFile(path string) ([]TimelineEntry, error)

type TimelineWriter

type TimelineWriter struct {
	// contains filtered or unexported fields
}

TimelineWriter writes Record entries to a single JSONL file.

func NewTimelineWriter

func NewTimelineWriter(path string) (*TimelineWriter, error)

func (*TimelineWriter) Close

func (w *TimelineWriter) Close() error

func (*TimelineWriter) WriteRecord

func (w *TimelineWriter) WriteRecord(rec Record)

Jump to

Keyboard shortcuts

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