| package types |
|
|
| |
| type SkillFile struct { |
| Name string `yaml:"name"` |
| Description string `yaml:"description"` |
| Type string `yaml:"type,omitempty"` |
| Triggers []string `yaml:"triggers,omitempty"` |
| Body string |
| RawContent string |
| FilePath string |
| BodyStartLine int |
| } |
|
|
| |
| type FeatureVector struct { |
| |
| BodyLength float64 |
| DescriptionLength float64 |
| LineCount float64 |
| CodeBlockCount float64 |
| URLCount float64 |
| AvgLineLength float64 |
| ShannonEntropy float64 |
|
|
| |
| InjectionKeywordScore float64 |
| ExfilKeywordScore float64 |
| SystemManipScore float64 |
| SocialEngineeringScore float64 |
|
|
| |
| NetworkCommandCount float64 |
| EnvAccessCount float64 |
| FilePathSensitiveCount float64 |
| Base64PatternCount float64 |
| DestructiveCommandCount float64 |
| PrivEscalationCount float64 |
| RoleOverrideCount float64 |
| UrgencyLanguageCount float64 |
| HiddenUnicodeCount float64 |
| PackageLookalikeCount float64 |
| PackageInstallLookalikeCount float64 |
| PackageContextLookalikeCount float64 |
| PackageRiskContextCount float64 |
| SupplyChainCredentialFlowCount float64 |
| PackageBootstrapHookCount float64 |
| HiddenContainerCount float64 |
| SensitiveCaptureCount float64 |
| HeadSensitiveDirective float64 |
| TailSensitiveDirective float64 |
| CovertSensitiveDirective float64 |
| HeadCovertSensitiveDirective float64 |
|
|
| |
| ProseKeywordRatio float64 |
| CodeBlockKeywordRatio float64 |
| KeywordDensity float64 |
|
|
| |
| AttackBigramCount float64 |
| EducationalBigramCount float64 |
| BigramRatio float64 |
|
|
| |
| PrescriptiveVerbCount float64 |
| ImperativeVerbCount float64 |
| VerbIntentRatio float64 |
|
|
| |
| FirstSuspiciousPosition float64 |
| SuspiciousInTail float64 |
|
|
| |
| TfidfFeatures []float64 |
| } |
|
|
| |
| func (fv *FeatureVector) ToSlice() []float64 { |
| base := []float64{ |
| fv.BodyLength, |
| fv.DescriptionLength, |
| fv.LineCount, |
| fv.CodeBlockCount, |
| fv.URLCount, |
| fv.AvgLineLength, |
| fv.ShannonEntropy, |
|
|
| fv.InjectionKeywordScore, |
| fv.ExfilKeywordScore, |
| fv.SystemManipScore, |
| fv.SocialEngineeringScore, |
|
|
| fv.NetworkCommandCount, |
| fv.EnvAccessCount, |
| fv.FilePathSensitiveCount, |
| fv.Base64PatternCount, |
| fv.DestructiveCommandCount, |
| fv.PrivEscalationCount, |
| fv.RoleOverrideCount, |
| fv.UrgencyLanguageCount, |
| fv.HiddenUnicodeCount, |
| fv.PackageLookalikeCount, |
| fv.PackageInstallLookalikeCount, |
| fv.PackageContextLookalikeCount, |
| fv.PackageRiskContextCount, |
| fv.SupplyChainCredentialFlowCount, |
| fv.PackageBootstrapHookCount, |
| fv.HiddenContainerCount, |
| fv.SensitiveCaptureCount, |
| fv.HeadSensitiveDirective, |
| fv.TailSensitiveDirective, |
| fv.CovertSensitiveDirective, |
| fv.HeadCovertSensitiveDirective, |
|
|
| fv.ProseKeywordRatio, |
| fv.CodeBlockKeywordRatio, |
| fv.KeywordDensity, |
| fv.AttackBigramCount, |
| fv.EducationalBigramCount, |
| fv.BigramRatio, |
| fv.PrescriptiveVerbCount, |
| fv.ImperativeVerbCount, |
| fv.VerbIntentRatio, |
| fv.FirstSuspiciousPosition, |
| fv.SuspiciousInTail, |
| } |
| return append(base, fv.TfidfFeatures...) |
| } |
|
|
| |
| func FeatureNames() []string { |
| return []string{ |
| "body_length", |
| "description_length", |
| "line_count", |
| "code_block_count", |
| "url_count", |
| "avg_line_length", |
| "shannon_entropy", |
| "injection_keyword_score", |
| "exfil_keyword_score", |
| "system_manip_score", |
| "social_engineering_score", |
| "network_command_count", |
| "env_access_count", |
| "file_path_sensitive_count", |
| "base64_pattern_count", |
| "destructive_command_count", |
| "priv_escalation_count", |
| "role_override_count", |
| "urgency_language_count", |
| "hidden_unicode_count", |
| "package_lookalike_count", |
| "package_install_lookalike_count", |
| "package_context_lookalike_count", |
| "package_risk_context_count", |
| "supply_chain_credential_flow_count", |
| "package_bootstrap_hook_count", |
| "hidden_container_count", |
| "sensitive_capture_count", |
| "head_sensitive_directive", |
| "tail_sensitive_directive", |
| "covert_sensitive_directive", |
| "head_covert_sensitive_directive", |
| "prose_keyword_ratio", |
| "code_block_keyword_ratio", |
| "keyword_density", |
| "attack_bigram_count", |
| "educational_bigram_count", |
| "bigram_ratio", |
| "prescriptive_verb_count", |
| "imperative_verb_count", |
| "verb_intent_ratio", |
| "first_suspicious_position", |
| "suspicious_in_tail", |
| } |
| } |
|
|
| |
| type RuleMatch struct { |
| RuleName string `json:"rule_name"` |
| Line int `json:"line"` |
| EndLine int `json:"end_line,omitempty"` |
| Text string `json:"text"` |
| |
| |
| |
| |
| |
| File string `json:"file,omitempty"` |
| } |
|
|
| |
| type CategoryScore struct { |
| Category string `json:"category"` |
| Score float64 `json:"score"` |
| Triggered bool `json:"triggered"` |
| Indicators []string `json:"indicators,omitempty"` |
| RuleNames []string `json:"rule_names,omitempty"` |
| Matches []RuleMatch `json:"matches,omitempty"` |
| } |
|
|
| |
| type HeuristicResult struct { |
| Flagged bool `json:"flagged"` |
| Score float64 `json:"score"` |
| Categories []CategoryScore `json:"categories"` |
| VerbIntentRatio float64 `json:"verb_intent_ratio"` |
| } |
|
|
| |
| type Verdict struct { |
| Label string `json:"label"` |
| Confidence float64 `json:"confidence"` |
| MLScore float64 `json:"ml_score"` |
| BERTScore float64 `json:"bert_score,omitempty"` |
| Heuristic HeuristicResult `json:"heuristic"` |
| Categories []CategoryScore `json:"categories"` |
| Reasons []string `json:"reasons"` |
| } |
|
|