Documentation
¶
Index ¶
- Constants
- Variables
- func GrammarSeed(g Grammar) ([]byte, error)
- func MutateFrame(frame []byte, framing Framing, mutation Mutation) ([]byte, error)
- func ReadDirectionalInput(path string) ([]byte, error)
- type AccessCase
- type AccessObservation
- type BoundaryCase
- type BoundaryResult
- type ByteCorpus
- type Campaign
- type CampaignResult
- type CampaignTrial
- type CorpusCase
- type Exchange
- type ExperimentMetadata
- type FieldDifference
- type FieldMutation
- type FieldSpec
- type Framing
- type GeneratedCase
- type GeneratedCorpus
- type GenerationSpec
- type Grammar
- type GrammarComparison
- type GrammarFailure
- type GrammarReport
- type Injection
- type InterpretedField
- type InterpretedFrame
- type LengthField
- type Minimized
- type Mutation
- type Observation
- type Proxy
- type ProxyObservation
- type ProxyTLS
- type ReproductionResult
- type ReproductionSpec
- type ResetEvidence
- type ResetSpec
- type Result
- type ServerTLS
- type StateMutation
- type Step
- type TLSCaptureResult
- type TLVEntry
- type TLVSpec
- type TriageArtifact
Constants ¶
const GenerationVersion = "protocoltest-v2"
Variables ¶
var ErrBudgetExceeded = errors.New("harness budget exceeded")
ErrBudgetExceeded denotes a harness limit, never a target rejection or crash.
Functions ¶
func GrammarSeed ¶
GrammarSeed constructs one fully specified, non-overlapping fixed-width layout. Nested/TLV expansion and unspecified bytes are deliberately refused.
func MutateFrame ¶
func ReadDirectionalInput ¶
ReadDirectionalInput enforces adjacent Netcap loss metadata when reading its artifacts.
Types ¶
type AccessCase ¶
type AccessCase struct {
Metadata ExperimentMetadata `json:"metadata"`
ResponseStep int `json:"responseStep"`
Role string `json:"role"`
State string `json:"state"`
Resource string `json:"resource"`
Message string `json:"message"`
Allowed bool `json:"allowed"`
Marker []byte `json:"marker"`
Exchange Exchange `json:"exchange"`
}
type AccessObservation ¶
type AccessObservation struct {
Reset ResetEvidence `json:"reset"`
Case AccessCase `json:"case"`
Result Result `json:"result"`
MarkerReturned bool `json:"markerReturned"`
Status string `json:"status"`
}
func RunAccess ¶
func RunAccess(ctx context.Context, cases []AccessCase) ([]AccessObservation, error)
RunAccess opens a fresh session per case. Absence is meaningful only after the case's response assertions matched; failures remain inconclusive.
type BoundaryCase ¶
type BoundaryCase struct {
Metadata ExperimentMetadata `json:"metadata"`
Name string `json:"name"`
Control Exchange `json:"control"`
Probe Exchange `json:"probe"`
ResponseStep int `json:"responseStep"`
Accepted []byte `json:"accepted"`
Rejected []byte `json:"rejected"`
Verification *Exchange `json:"verification,omitempty"`
}
BoundaryCase uses exact application replies as the target oracle. Verification is a readback after the probe without resetting its effects first.
type BoundaryResult ¶
type BoundaryResult struct {
Version int `json:"version"`
GenerationVersion string `json:"generationVersion"`
Case BoundaryCase `json:"case"`
ConfigurationSHA256 string `json:"configurationSHA256"`
Outcome string `json:"outcome"`
Before Result `json:"before"`
BeforeReset ResetEvidence `json:"beforeReset"`
Probe Result `json:"probe"`
ProbeReset ResetEvidence `json:"probeReset"`
Verification *Result `json:"verification,omitempty"`
After Result `json:"after"`
AfterReset ResetEvidence `json:"afterReset"`
Qualified bool `json:"qualified"`
}
func RunBoundary ¶
func RunBoundary(ctx context.Context, spec BoundaryCase) (out BoundaryResult, runErr error)
type ByteCorpus ¶
type ByteCorpus struct {
Version int `json:"version"`
GenerationVersion string `json:"generationVersion"`
TargetVersion string `json:"targetVersion"`
ConfigurationSHA256 string `json:"configurationSHA256"`
Cases []CorpusCase `json:"cases"`
}
func GenerateByteCorpus ¶
func GenerateByteCorpus(seed []byte, maxCases, maxBytes int, target string) (ByteCorpus, error)
type Campaign ¶
type Campaign struct {
Metadata ExperimentMetadata `json:"metadata"`
Generation *GenerationSpec `json:"generation,omitempty"`
Control Exchange `json:"control"`
SendStep int `json:"sendStep"`
ResponseStep int `json:"responseStep"`
FailureMarker []byte `json:"failureMarker"`
MaxCases int `json:"maxCases"`
MaxAttempts int `json:"maxAttempts"`
}
type CampaignResult ¶
type CampaignResult struct {
MinimizationMethod string `json:"minimizationMethod,omitempty"`
MinimizationComplete bool `json:"minimizationComplete"`
Corpus GeneratedCorpus `json:"corpus"`
BeforeReset ResetEvidence `json:"beforeReset"`
AfterReset ResetEvidence `json:"afterReset"`
MinimizedCase *GeneratedCase `json:"minimizedCase,omitempty"`
Reproduction *CampaignTrial `json:"reproduction,omitempty"`
Before Result `json:"before"`
Trials []CampaignTrial `json:"trials"`
Minimized *Minimized `json:"minimized,omitempty"`
After Result `json:"after"`
Limitation string `json:"limitation"`
}
func RunCampaign ¶
func RunCampaign(ctx context.Context, spec Campaign) (out CampaignResult, runErr error)
RunCampaign uses an application marker as its oracle, never a timeout or crash. Each trial gets a fresh connection and its declared reset; OS resets are import-only.
type CampaignTrial ¶
type CampaignTrial struct {
Case GeneratedCase `json:"case"`
Reset ResetEvidence `json:"reset"`
Input []byte `json:"input"`
Result Result `json:"result"`
FailureMarkerReturned bool `json:"failureMarkerReturned"`
}
type CorpusCase ¶
type CorpusCase struct {
ID string `json:"id"`
Input []byte `json:"input"`
SHA256 string `json:"sha256"`
}
func MutationCorpus ¶
func MutationCorpus(seed []byte, maxCases, maxBytes int) ([]CorpusCase, error)
MutationCorpus is deterministic: control, truncations, then single-byte XORs. It deliberately preserves malformed lengths; it does not infer a grammar.
type Exchange ¶
type Exchange struct {
ServerTLS *ServerTLS `json:"serverTLS,omitempty"`
PeerCertificateSHA256 string `json:"peerCertificateSHA256,omitempty"`
Version int `json:"version"`
Network string `json:"network"`
Address string `json:"address"`
TLS bool `json:"tls"`
ServerName string `json:"serverName,omitempty"`
RootCAFile string `json:"rootCAFile,omitempty"`
ClientCertificateFile string `json:"clientCertificateFile,omitempty"`
ClientKeyFile string `json:"clientKeyFile,omitempty"`
Framing Framing `json:"framing"`
TimeoutMilliseconds int `json:"timeoutMilliseconds"`
MaxTotalBytes int `json:"maxTotalBytes"`
Steps []Step `json:"steps"`
}
type ExperimentMetadata ¶
type ExperimentMetadata struct {
Version int `json:"version"`
TargetVersion string `json:"targetVersion"`
Reset ResetSpec `json:"reset"`
}
func (ExperimentMetadata) Validate ¶
func (m ExperimentMetadata) Validate() error
type FieldDifference ¶
type FieldMutation ¶
type FieldSpec ¶
type FieldSpec struct {
LengthFrom *LengthField `json:"lengthFrom,omitempty"`
TLV *TLVSpec `json:"tlv,omitempty"`
Name string `json:"name"`
Offset int `json:"offset"`
Length int `json:"length"`
Kind string `json:"kind"`
ByteOrder string `json:"byteOrder,omitempty"`
Expected []byte `json:"expected,omitempty"`
Hypothesis string `json:"hypothesis"`
}
type Framing ¶
type Framing struct {
Kind string `json:"kind"`
LengthBytes int `json:"lengthBytes,omitempty"`
ByteOrder string `json:"byteOrder,omitempty"`
LengthIncludesHeader bool `json:"lengthIncludesHeader,omitempty"`
Delimiter []byte `json:"delimiter,omitempty"`
FixedSize int `json:"fixedSize,omitempty"`
MaxBytes int `json:"maxBytes"`
}
type GeneratedCase ¶
type GeneratedCorpus ¶
type GeneratedCorpus struct {
Version int `json:"version"`
GenerationVersion string `json:"generationVersion"`
Metadata ExperimentMetadata `json:"metadata"`
ConfigurationSHA256 string `json:"configurationSHA256"`
Cases []GeneratedCase `json:"cases"`
}
func GenerateCampaign ¶
func GenerateCampaign(spec Campaign) (GeneratedCorpus, error)
type GenerationSpec ¶
type GenerationSpec struct {
Version int `json:"version"`
Bytes bool `json:"bytes"`
Grammar *Grammar `json:"grammar,omitempty"`
BuildSeed bool `json:"buildSeed"`
Fields []FieldMutation `json:"fields,omitempty"`
States []StateMutation `json:"states,omitempty"`
}
type Grammar ¶
type GrammarComparison ¶
type GrammarComparison struct {
Before GrammarReport `json:"before"`
After GrammarReport `json:"after"`
Differences []FieldDifference `json:"differences"`
Alignment string `json:"alignment"`
}
type GrammarFailure ¶
type GrammarReport ¶
type GrammarReport struct {
Error string `json:"error,omitempty"`
Failure *GrammarFailure `json:"failure,omitempty"`
Version int `json:"version"`
InputSHA256 string `json:"inputSHA256"`
Frames []InterpretedFrame `json:"frames"`
Limitations []string `json:"limitations"`
}
type Injection ¶
type Injection struct {
Direction string `json:"direction"`
BeforeFrame int `json:"beforeFrame"`
Message []byte `json:"message"`
}
Injection writes a complete message before reading the selected source frame. BeforeFrame=0 can initiate a session without any bytes from that source.
type InterpretedField ¶
type InterpretedFrame ¶
type InterpretedFrame struct {
Index int `json:"index"`
Offset int `json:"offset"`
Length int `json:"length"`
SHA256 string `json:"sha256"`
Fields []InterpretedField `json:"fields"`
}
type LengthField ¶
type LengthField struct {
Offset int `json:"offset"`
Width int `json:"width"`
ByteOrder string `json:"byteOrder"`
Adjustment int `json:"adjustment"`
}
func (LengthField) Validate ¶
func (s LengthField) Validate() error
type Minimized ¶
type Minimized struct {
Original []byte `json:"original"`
Input []byte `json:"input"`
Attempts int `json:"attempts"`
Complete bool `json:"complete"`
}
func Minimize ¶
func Minimize(ctx context.Context, input []byte, maxAttempts int, oracle func(context.Context, []byte) (bool, error)) (Minimized, error)
Minimize deletes bytes while an explicit failure oracle still reproduces. Oracle errors (including transport errors) are not classified as failures.
type Mutation ¶
type Mutation struct {
Direction string `json:"direction"`
Frame int `json:"frame"`
Offset int `json:"offset"`
Delete int `json:"delete"`
Insert []byte `json:"insert"`
RepairLength bool `json:"repairLength"`
Drop bool `json:"drop"`
Copies int `json:"copies"`
DelayMilliseconds int `json:"delayMilliseconds"`
}
type Observation ¶
type Proxy ¶
type Proxy struct {
Injections []Injection `json:"injections,omitempty"`
Mode string `json:"mode,omitempty"`
TLS *ProxyTLS `json:"tls,omitempty"`
Address string `json:"address"`
Framing Framing `json:"framing"`
TimeoutMilliseconds int `json:"timeoutMilliseconds"`
MaxFrames int `json:"maxFrames"`
MaxTotalBytes int `json:"maxTotalBytes"`
Mutations []Mutation `json:"mutations"`
}
type ProxyObservation ¶
type ProxyObservation struct {
Planned []byte `json:"planned,omitempty"`
Injected bool `json:"injected,omitempty"`
TLSVersion uint16 `json:"tlsVersion,omitempty"`
TLSCipher uint16 `json:"tlsCipher,omitempty"`
Direction string `json:"direction"`
Frame int `json:"frame"`
Original []byte `json:"original"`
Transmitted []byte `json:"transmitted"`
Copies int `json:"copies"`
TimestampNs string `json:"timestampNs"`
Error string `json:"error,omitempty"`
}
type ProxyTLS ¶
type ProxyTLS struct {
ClientCertificateFile string `json:"clientCertificateFile,omitempty"`
ClientKeyFile string `json:"clientKeyFile,omitempty"`
PeerCertificateSHA256 string `json:"peerCertificateSHA256,omitempty"`
Mode string `json:"mode,omitempty"`
CertificateFile string `json:"certificateFile"`
KeyFile string `json:"keyFile"`
RootCAFile string `json:"rootCAFile"`
ServerName string `json:"serverName"`
}
ProxyTLS requires explicit identity and trust for both independently negotiated legs.
type ReproductionResult ¶
type ReproductionResult struct {
Version int `json:"version"`
GenerationVersion string `json:"generationVersion"`
Spec ReproductionSpec `json:"spec"`
Trial CampaignTrial `json:"trial"`
}
func Reproduce ¶
func Reproduce(ctx context.Context, spec ReproductionSpec) (ReproductionResult, error)
type ReproductionSpec ¶
type ReproductionSpec struct {
Metadata ExperimentMetadata `json:"metadata"`
Case GeneratedCase `json:"case"`
FailureMarker []byte `json:"failureMarker"`
}
type ResetEvidence ¶
type Result ¶
type Result struct {
Version int `json:"version"`
ConfigurationSHA256 string `json:"configurationSHA256"`
Address string `json:"address"`
LocalAddress string `json:"localAddress,omitempty"`
RemoteAddress string `json:"remoteAddress,omitempty"`
TLSVersion uint16 `json:"tlsVersion,omitempty"`
TLSCipher uint16 `json:"tlsCipher,omitempty"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
Observations []Observation `json:"observations"`
Limitations []string `json:"limitations"`
}
type StateMutation ¶
type Step ¶
type Step struct {
Name string `json:"name"`
Send []byte `json:"send,omitempty"`
SendPresent bool `json:"sendPresent,omitempty"`
Receive bool `json:"receive"`
Expect []byte `json:"expect,omitempty"`
ExpectPresent bool `json:"expectPresent,omitempty"`
Contains []byte `json:"contains,omitempty"`
CaptureVariable string `json:"captureVariable,omitempty"`
CaptureOffset int `json:"captureOffset,omitempty"`
CaptureLength int `json:"captureLength,omitempty"`
SendVariable string `json:"sendVariable,omitempty"`
}
type TLSCaptureResult ¶
type TLSCaptureResult struct {
Version int `json:"version"`
InputSHA256 string `json:"inputSHA256"`
KeyLogSHA256 string `json:"keyLogSHA256"`
ToolVersion string `json:"toolVersion"`
Stream int `json:"stream"`
Client []byte `json:"node0Bytes"`
Server []byte `json:"node1Bytes"`
ClientSHA256 string `json:"node0SHA256"`
ServerSHA256 string `json:"node1SHA256"`
Nodes []string `json:"nodes"`
Limitations []string `json:"limitations"`
}
func AnalyzeTLSCapture ¶
func AnalyzeTLSCapture(ctx context.Context, input, keyLog string, stream int) (TLSCaptureResult, error)
AnalyzeTLSCapture delegates cryptographic dissection to the installed tshark. Node direction follows tshark's reported endpoints; no client-role inference is made.
type TLVSpec ¶
type TLVSpec struct {
TypeBytes int `json:"typeBytes"`
LengthBytes int `json:"lengthBytes"`
ByteOrder string `json:"byteOrder"`
LengthIncludesHeader bool `json:"lengthIncludesHeader"`
NestedTypes []uint64 `json:"nestedTypes,omitempty"`
LeafKind string `json:"leafKind"`
MaxDepth int `json:"maxDepth"`
MaxEntries int `json:"maxEntries"`
MaxValueBytes int `json:"maxValueBytes"`
}
type TriageArtifact ¶
type TriageArtifact struct {
InputGeneration string `json:"inputGeneration"`
Version int `json:"version"`
GenerationVersion string `json:"generationVersion"`
ConfigurationSHA256 string `json:"configurationSHA256"`
InputSHA256 string `json:"inputSHA256"`
Kind string `json:"kind"`
TargetVersion string `json:"targetVersion"`
Reset string `json:"reset"`
Input []byte `json:"input"`
Evidence []byte `json:"evidence"`
EvidenceSHA256 string `json:"evidenceSHA256"`
Classification string `json:"classification"`
}
func ImportGeneratedTriage ¶
func ImportGeneratedTriage(kind, version, reset, inputGeneration string, input []byte, path string) (TriageArtifact, error)
func ImportTriage ¶
func ImportTriage(kind, version, reset string, input []byte, path string) (TriageArtifact, error)
ImportTriage retains external evidence verbatim without executing it or interpreting a stack, sanitizer report or process exit as proof of impact.