Documentation
¶
Index ¶
- type Action
- type ActionType
- type AdaptiveConfig
- type AdaptiveSystem
- type ComponentType
- type Condition
- type ConditionType
- type DelayedFeedback
- type Episode
- type EvolutionConfig
- type EvolutionEngine
- type ExploitKnowledge
- type Feature
- type Feedback
- type FeedbackAnalysis
- type FeedbackProcessor
- type Genome
- type ImmediateFeedback
- type Individual
- type KnowledgeBase
- type LearningMetrics
- type LearningSession
- type Outcome
- type Pattern
- type PatternType
- type Policy
- type PolicyPerformance
- type PredictionModel
- type PredictionRecord
- type ReinforcementLearner
- type SessionStatus
- type State
- type Strategy
- type StrategyComponent
- type StrategyConstraint
- type StrategyOptimizer
- type StrategyPerformance
- type SuccessPredictor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Type ActionType
Exploit string
Parameters map[string]interface{}
Confidence float64
}
Action represents an attack action
type ActionType ¶
type ActionType string
ActionType categorizes actions
const ( ActionInject ActionType = "inject" ActionJailbreak ActionType = "jailbreak" ActionExtract ActionType = "extract" ActionChain ActionType = "chain" ActionAdapt ActionType = "adapt" )
type AdaptiveConfig ¶
type AdaptiveConfig struct {
LearningRate float64
ExplorationRate float64
MemorySize int
UpdateFrequency time.Duration
EvolutionEnabled bool
PredictionEnabled bool
AutoOptimization bool
}
AdaptiveConfig configures the adaptive system
type AdaptiveSystem ¶
type AdaptiveSystem struct {
// contains filtered or unexported fields
}
AdaptiveSystem learns and improves attack strategies
func NewAdaptiveSystem ¶
func NewAdaptiveSystem(config AdaptiveConfig) *AdaptiveSystem
NewAdaptiveSystem creates an adaptive learning system
func (*AdaptiveSystem) StartLearning ¶
func (as *AdaptiveSystem) StartLearning(ctx context.Context, target interface{}) (*LearningSession, error)
StartLearning begins a learning session
type ComponentType ¶
type ComponentType string
ComponentType categorizes components
const ( ComponentTechnique ComponentType = "technique" ComponentTiming ComponentType = "timing" ComponentTarget ComponentType = "target" ComponentAdaptation ComponentType = "adaptation" )
type Condition ¶
type Condition struct {
Type ConditionType
Value interface{}
}
Condition for pattern matching
type ConditionType ¶
type ConditionType string
ConditionType categorizes conditions
const ( ConditionState ConditionType = "state" ConditionResponse ConditionType = "response" ConditionSequence ConditionType = "sequence" )
type DelayedFeedback ¶
type DelayedFeedback struct {
EpisodeID string
Analysis map[string]interface{}
Insights []string
Timestamp time.Time
}
DelayedFeedback is post-analysis feedback
type Episode ¶
type Episode struct {
ID string
Actions []Action
Rewards []float64
States []State
Outcome Outcome
Timestamp time.Time
}
Episode represents a learning episode
type EvolutionConfig ¶
type EvolutionConfig struct {
PopulationSize int
MutationRate float64
CrossoverRate float64
EliteSize int
}
EvolutionConfig configures evolution
type EvolutionEngine ¶
type EvolutionEngine struct {
// contains filtered or unexported fields
}
EvolutionEngine evolves strategies
func NewEvolutionEngine ¶
func NewEvolutionEngine() *EvolutionEngine
NewEvolutionEngine creates evolution engine
func (*EvolutionEngine) Evolve ¶
func (ee *EvolutionEngine) Evolve(episode Episode)
Evolve performs one evolution step
func (*EvolutionEngine) Initialize ¶
func (ee *EvolutionEngine) Initialize(config EvolutionConfig)
Initialize sets up evolution
type ExploitKnowledge ¶
type ExploitKnowledge struct {
ExploitID string
Technique string
SuccessRate float64
OptimalConditions map[string]interface{}
Counters []string
LastUpdated time.Time
}
ExploitKnowledge stores exploit information
type FeedbackAnalysis ¶
type FeedbackAnalysis struct {
SuccessFactors map[string]float64
FailureFactors map[string]float64
Recommendations []string
}
FeedbackAnalysis contains analyzed feedback
type FeedbackProcessor ¶
type FeedbackProcessor struct {
// contains filtered or unexported fields
}
FeedbackProcessor processes attack feedback
func NewFeedbackProcessor ¶
func NewFeedbackProcessor() *FeedbackProcessor
NewFeedbackProcessor creates processor
func (*FeedbackProcessor) ProcessDelayed ¶
func (fp *FeedbackProcessor) ProcessDelayed(episodeID string, analysis map[string]interface{})
ProcessDelayed handles post-analysis
func (*FeedbackProcessor) ProcessImmediate ¶
func (fp *FeedbackProcessor) ProcessImmediate(action Action, reward float64, state State)
ProcessImmediate handles real-time feedback
type ImmediateFeedback ¶
ImmediateFeedback is real-time feedback
type Individual ¶
Individual in population
type KnowledgeBase ¶
type KnowledgeBase struct {
// contains filtered or unexported fields
}
KnowledgeBase stores learned knowledge
func NewKnowledgeBase ¶
func NewKnowledgeBase() *KnowledgeBase
NewKnowledgeBase creates knowledge base
func (*KnowledgeBase) AddPatterns ¶
func (kb *KnowledgeBase) AddPatterns(patterns []Pattern)
AddPatterns adds discovered patterns
func (*KnowledgeBase) AddPolicy ¶
func (kb *KnowledgeBase) AddPolicy(policy *Policy)
AddPolicy adds policy to knowledge base
func (*KnowledgeBase) FindPatterns ¶
func (kb *KnowledgeBase) FindPatterns(state State) []Pattern
FindPatterns finds matching patterns
func (*KnowledgeBase) GetPolicies ¶
func (kb *KnowledgeBase) GetPolicies() []*Policy
GetPolicies returns all policies
func (*KnowledgeBase) LoadHistoricalData ¶
func (kb *KnowledgeBase) LoadHistoricalData()
LoadHistoricalData loads past learning
type LearningMetrics ¶
type LearningMetrics struct {
TotalEpisodes int
SuccessfulEpisodes int
AverageReward float64
LearningCurve []float64
ConvergenceRate float64
}
LearningMetrics tracks learning progress
type LearningSession ¶
type LearningSession struct {
ID string
StartTime time.Time
Episodes []Episode
CurrentPolicy *Policy
Metrics LearningMetrics
Status SessionStatus
// contains filtered or unexported fields
}
LearningSession represents active learning
type Pattern ¶
type Pattern struct {
ID string
Type PatternType
Conditions []Condition
Actions []Action
SuccessRate float64
Discovered time.Time
}
Pattern represents learned pattern
type PatternType ¶
type PatternType string
PatternType categorizes patterns
const ( PatternVulnerability PatternType = "vulnerability" PatternDefense PatternType = "defense" PatternBehavior PatternType = "behavior" PatternChain PatternType = "chain" )
type Policy ¶
type Policy struct {
ID string
Name string
Parameters map[string]float64
Performance PolicyPerformance
Version int
}
Policy defines action selection strategy
type PolicyPerformance ¶
type PolicyPerformance struct {
SuccessRate float64
AverageReward float64
ExploitCount int
LastUpdated time.Time
}
PolicyPerformance tracks policy metrics
type PredictionModel ¶
type PredictionModel struct {
Weights map[string]float64
Bias float64
Accuracy float64
LastTrained time.Time
}
PredictionModel represents the ML model
type PredictionRecord ¶
type PredictionRecord struct {
Prediction float64
Actual bool
Features map[string]float64
Timestamp time.Time
}
PredictionRecord stores prediction history
type ReinforcementLearner ¶
type ReinforcementLearner struct {
// contains filtered or unexported fields
}
ReinforcementLearner implements Q-learning
func NewReinforcementLearner ¶
func NewReinforcementLearner(learningRate float64) *ReinforcementLearner
NewReinforcementLearner creates Q-learner
func (*ReinforcementLearner) GetBestAction ¶
func (rl *ReinforcementLearner) GetBestAction(state State) string
GetBestAction returns action with highest Q-value
func (*ReinforcementLearner) UpdateQValues ¶
func (rl *ReinforcementLearner) UpdateQValues(episode Episode)
UpdateQValues updates Q-table from episode
type SessionStatus ¶
type SessionStatus string
SessionStatus represents learning status
const ( SessionActive SessionStatus = "active" SessionPaused SessionStatus = "paused" SessionComplete SessionStatus = "complete" SessionFailed SessionStatus = "failed" )
type State ¶
type State struct {
ModelResponse string
SecurityLevel float64
SuccessRate float64
Features map[string]float64
}
State represents system state
type Strategy ¶
type Strategy struct {
ID string
Name string
Components []StrategyComponent
Constraints []StrategyConstraint
Score float64
}
Strategy represents an attack strategy
type StrategyComponent ¶
type StrategyComponent struct {
Type ComponentType
Parameters map[string]interface{}
Weight float64
}
StrategyComponent is part of strategy
type StrategyConstraint ¶
type StrategyConstraint struct {
Type string
Value interface{}
}
StrategyConstraint represents a constraint on strategy
type StrategyOptimizer ¶
type StrategyOptimizer struct {
// contains filtered or unexported fields
}
StrategyOptimizer optimizes attack strategies
func NewStrategyOptimizer ¶
func NewStrategyOptimizer() *StrategyOptimizer
NewStrategyOptimizer creates optimizer
func (*StrategyOptimizer) OptimizeStrategy ¶
func (so *StrategyOptimizer) OptimizeStrategy(strategy *Strategy, feedback []Feedback) *Strategy
OptimizeStrategy improves strategy
type StrategyPerformance ¶
type StrategyPerformance struct {
SuccessRate float64
AverageTime time.Duration
ResourceUsage float64
LastOptimized time.Time
}
StrategyPerformance tracks strategy metrics
type SuccessPredictor ¶
type SuccessPredictor struct {
// contains filtered or unexported fields
}
SuccessPredictor predicts attack success
func NewSuccessPredictor ¶
func NewSuccessPredictor() *SuccessPredictor
NewSuccessPredictor creates predictor
func (*SuccessPredictor) Predict ¶
func (sp *SuccessPredictor) Predict(state State, action Action) float64
Predict estimates success probability
func (*SuccessPredictor) UpdateModel ¶
func (sp *SuccessPredictor) UpdateModel(episode Episode)
UpdateModel trains on new data