Documentation
¶
Index ¶
- type ContextAnalyzer
- type HouYiAttack
- type HouYiAttackEngine
- type HouYiBuilder
- func (b *HouYiBuilder) Build() *HouYiAttack
- func (b *HouYiBuilder) WithInjectionPrompt(injection string) *HouYiBuilder
- func (b *HouYiBuilder) WithMaliciousPayload(payload string) *HouYiBuilder
- func (b *HouYiBuilder) WithMetadata(metadata *HouYiMetadata) *HouYiBuilder
- func (b *HouYiBuilder) WithPreConstructedPrompt(prompt string) *HouYiBuilder
- func (b *HouYiBuilder) WithTargetContext(context string) *HouYiBuilder
- type HouYiMetadata
- type HouYiResult
- type HouYiTemplate
- type PartitionStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextAnalyzer ¶
type ContextAnalyzer struct {
// contains filtered or unexported fields
}
func NewContextAnalyzer ¶
func NewContextAnalyzer() *ContextAnalyzer
NewContextAnalyzer creates a new context analyzer
func (*ContextAnalyzer) AnalyzePartition ¶
func (c *ContextAnalyzer) AnalyzePartition(injectionPrompt, targetContext string) float64
AnalyzePartition analyzes the effectiveness of context partition
type HouYiAttack ¶
type HouYiAttack struct {
PreConstructedPrompt string
InjectionPrompt string
MaliciousPayload string
TargetContext string
AttackMetadata *HouYiMetadata
}
HouYiAttack implements the HouYi prompt injection technique Based on 2025 research: "Prompt Injection Attack Against LLM-Integrated Applications" Components: Pre-constructed prompt, injection prompt, malicious payload
type HouYiAttackEngine ¶
type HouYiAttackEngine struct {
// contains filtered or unexported fields
}
func NewHouYiAttackEngine ¶
func NewHouYiAttackEngine(logger common.AuditLogger) *HouYiAttackEngine
NewHouYiAttackEngine creates a new HouYi attack engine
func (*HouYiAttackEngine) ExecuteAttack ¶
func (e *HouYiAttackEngine) ExecuteAttack(ctx context.Context, attack *HouYiAttack) (*HouYiResult, error)
ExecuteAttack executes the HouYi attack
func (*HouYiAttackEngine) GenerateAttack ¶
func (e *HouYiAttackEngine) GenerateAttack(ctx context.Context, templateName, targetModel string) (*HouYiAttack, error)
GenerateAttack creates a HouYi attack using specified template
type HouYiBuilder ¶
type HouYiBuilder struct {
// contains filtered or unexported fields
}
func NewHouYiBuilder ¶
func NewHouYiBuilder() *HouYiBuilder
NewHouYiBuilder creates a new HouYi attack builder
func (*HouYiBuilder) Build ¶
func (b *HouYiBuilder) Build() *HouYiAttack
Build constructs the HouYi attack
func (*HouYiBuilder) WithInjectionPrompt ¶
func (b *HouYiBuilder) WithInjectionPrompt(injection string) *HouYiBuilder
WithInjectionPrompt sets the injection prompt that creates context partition
func (*HouYiBuilder) WithMaliciousPayload ¶
func (b *HouYiBuilder) WithMaliciousPayload(payload string) *HouYiBuilder
WithMaliciousPayload sets the malicious payload
func (*HouYiBuilder) WithMetadata ¶
func (b *HouYiBuilder) WithMetadata(metadata *HouYiMetadata) *HouYiBuilder
WithMetadata sets attack metadata
func (*HouYiBuilder) WithPreConstructedPrompt ¶
func (b *HouYiBuilder) WithPreConstructedPrompt(prompt string) *HouYiBuilder
WithPreConstructedPrompt sets the pre-constructed prompt component
func (*HouYiBuilder) WithTargetContext ¶
func (b *HouYiBuilder) WithTargetContext(context string) *HouYiBuilder
WithTargetContext sets the target context