Documentation
¶
Index ¶
- Constants
- func CanCheck(mod Exploit) bool
- func Dedent(s string) string
- func Errorf(format string, args ...any) error
- func HasOpt(opts []Option, name string) bool
- func HasOption(mod Exploit, name string) bool
- func NameOf(mod Exploit) string
- func Names() []string
- func Register(mod Exploit)
- func RegisterEnricher(fn OptionEnricher)
- func Run(mod Exploit, opts ...RunOption)
- func SetRunner(fn func(Exploit, RunOptions))
- func Sprintf(format string, args ...any) string
- type AuthorRank
- type CheckCode
- type CheckResult
- type Checker
- type CmdStager
- type Context
- func (c *Context) Base64Bash(cmd string) string
- func (c *Context) Commands() []string
- func (c *Context) CommentTrail(cmd string) string
- func (c *Context) Elapsed(start bool) float64
- func (c *Context) Error(format string, args ...any)
- func (c *Context) Get(key string) string
- func (c *Context) Payload() string
- func (c *Context) RandText(n int) string
- func (c *Context) Send(req Request) (*Response, error)
- func (c *Context) SetCommands(cmds []string)
- func (c *Context) SetTarget(t Target)
- func (c *Context) Status(format string, args ...any)
- func (c *Context) Success(format string, args ...any)
- func (c *Context) Target() Target
- func (c *Context) Warning(format string, args ...any)
- type Exploit
- type Info
- type Notes
- type Option
- func OptAddress(name, def, desc string) Option
- func OptAdvanced(opt Option) Option
- func OptBool(name string, def bool, desc string) Option
- func OptEnum(name, def, desc string, values ...string) Option
- func OptInt(name string, def int, desc string) Option
- func OptPort(name string, def int, desc string) Option
- func OptRequired(name, def, desc string) Option
- func OptString(name, def, desc string) Option
- func OptTargetURI(def string) Option
- func ResolveOptions(mod Exploit) []Option
- type OptionEnricher
- type OptionType
- type Params
- func (p Params) Arch() string
- func (p Params) Clone() Params
- func (p Params) Get(key string) string
- func (p Params) GetOr(key, def string) string
- func (p Params) Int(key string) int
- func (p Params) IntOr(key string, def int) int
- func (p Params) Lhost() string
- func (p Params) Lport() int
- func (p Params) Map() map[string]string
- func (p Params) Set(key, value string)
- func (p Params) Srvhost() string
- func (p Params) Srvport() int
- func (p Params) Target() string
- func (p Params) Tunnel() string
- type Pik
- type Query
- type RefType
- type Reference
- type Reliability
- type Request
- type Response
- type RunOption
- type RunOptions
- type Stance
- type Target
- type Values
Constants ¶
const ( CrashSafe = "CRASH_SAFE" CrashUnsafe = "CRASH_UNSAFE" ServiceRestart = "SERVICE_RESTART" ArtifactsOnDisk = "ARTIFACTS_ON_DISK" IOCInLogs = "IOC_IN_LOGS" ConfigChanges = "CONFIG_CHANGES" RepeatableSession = "REPEATABLE_SESSION" AccountLockout = "ACCOUNT_LOCKOUT_POSSIBLE" )
Standard stability tags.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(mod Exploit)
Register adds an exploit to the global registry. The name is derived from the caller's file path relative to modules/. callerSkip controls stack depth: use 0 when calling from init() directly, use 1 when called through an intermediary (like sdk.Register wrapper).
func RegisterEnricher ¶
func RegisterEnricher(fn OptionEnricher)
func Run ¶
Run starts a standalone single-module CLI. Requires importing _ "github.com/Chocapikk/pik/pkg/cli" to register the runner.
func SetRunner ¶
func SetRunner(fn func(Exploit, RunOptions))
SetRunner registers the standalone runner function. Called from pkg/cli's init() to break the import cycle.
Types ¶
type AuthorRank ¶
AuthorRank holds contributor statistics.
func Rankings ¶
func Rankings() []AuthorRank
Rankings returns a sorted leaderboard of exploit authors.
type CheckResult ¶
type CheckResult struct {
Code CheckCode
Reason string
Details map[string]string // version detected, banner, etc.
}
func Detected ¶
func Detected(reason string) (CheckResult, error)
func Safe ¶
func Safe(reason string) (CheckResult, error)
func Unknown ¶
func Unknown(err error) (CheckResult, error)
func Vulnerable ¶
func Vulnerable(reason string, details ...string) (CheckResult, error)
Check result constructors - match MSF's CheckCode::Vulnerable() style.
func (CheckResult) FormatReason ¶
func (r CheckResult) FormatReason() string
type Checker ¶
type Checker interface {
Check(run *Context) (CheckResult, error)
}
Checker is an optional interface for modules that support vulnerability checking.
type CmdStager ¶
CmdStager is a marker interface for modules that support chunked command delivery. When the runner uses cmdstager mode, it sets commands on the Context via SetCommands(). The module reads them with Commands() and delivers them in its Exploit() method, handling its own setup/teardown.
type Context ¶
type Context struct {
// Function hooks injected by the runner.
SendFn func(Request) (*Response, error)
StatusFn func(string, ...any)
SuccessFn func(string, ...any)
ErrorFn func(string, ...any)
WarningFn func(string, ...any)
Base64BashFn func(string) string
CommentFn func(string) string
RandTextFn func(int) string
// contains filtered or unexported fields
}
Context is the execution context passed to exploits. Provides HTTP, logging, payload helpers, and timing.
func NewContext ¶
NewContext creates a Context with option values and payload command.
func (*Context) Base64Bash ¶
func (*Context) Commands ¶
Commands returns the CmdStager commands set by the runner. Empty when in single-shot mode.
func (*Context) CommentTrail ¶
func (*Context) SetCommands ¶
SetCommands is called by the runner to inject CmdStager commands.
type Info ¶
type Info struct {
Description string
Detail string
Authors []string
DisclosureDate string // "2026-01-15"
Reliability Reliability
Stance Stance
Privileged bool // does exploitation yield privileged access?
Notes Notes
References []Reference
Queries []Query
Targets []Target
DefaultOptions map[string]string
}
func (Info) TargetStrings ¶
type Option ¶
type Option struct {
Name string
Type OptionType // defaults to TypeString if empty
Default string
Desc string
Required bool
Advanced bool
Enums []string // valid values for TypeEnum
}
func OptAddress ¶
func OptRequired ¶
func OptTargetURI ¶
func ResolveOptions ¶
ResolveOptions returns the full option set: module + enrichers + target defaults + module defaults.
type OptionEnricher ¶
type OptionType ¶
type OptionType string
const ( TypeString OptionType = "string" TypeInt OptionType = "int" TypeBool OptionType = "bool" TypePort OptionType = "port" TypePath OptionType = "path" TypeAddress OptionType = "address" TypeEnum OptionType = "enum" )
type Params ¶
Params holds the resolved option values for a module run.
type Pik ¶
type Pik struct{}
Pik is the base struct embedded by all modules. It provides default implementations for optional interface methods.
type Query ¶
type Query struct {
Engine string
Dork string
Scope string // optional, e.g. "service" or "leak" for LeakIX
}
Query is a search engine dork for finding targets.
type Reliability ¶
type Reliability int
const ( Unstable Reliability = 0 Unlikely Reliability = 100 Difficult Reliability = 200 Typical Reliability = 300 Reliable Reliability = 400 VeryReliable Reliability = 500 Certain Reliability = 600 )
func (Reliability) String ¶
func (r Reliability) String() string
type Request ¶
type Request struct {
Method string
Path string
Query Values
Form Values
Body io.Reader
ContentType string
Headers map[string]string
Timeout int // seconds
NoRedirect bool
}
Request describes an HTTP request from module code.
type Response ¶
type Response struct {
StatusCode int
Body io.ReadCloser
// contains filtered or unexported fields
}
Response is an HTTP response for module code.
func (*Response) ContainsAny ¶
ContainsAny returns true if the response body contains any of the given substrings.
func (*Response) SetContainsFn ¶
SetContainsFn sets the function used by ContainsAny.
type RunOption ¶ added in v0.1.4
type RunOption func(*RunOptions)
RunOption is a functional option for Run.
func WithConsole ¶ added in v0.1.4
func WithConsole() RunOption
WithConsole enables the interactive console subcommand in standalone binaries.
type RunOptions ¶ added in v0.1.4
type RunOptions struct {
Console bool // Add interactive console subcommand.
}
RunOptions configures standalone binary behavior.
type Target ¶
type Target struct {
Name string
Platform string
Type string // module-defined, e.g. "cmd", "dropper"
Arches []string
DefaultOptions map[string]string // per-target option overrides
}