Documentation
¶
Index ¶
- Constants
- Variables
- func ClearCache()
- func CountSyntaxFlowResult(db *gorm.DB) (int, error)
- func CreateCheck(contextResult *sf.SFFrameResult, config *sf.Config, ...) *sfCheck
- func CreateCheckFromNativeCallParam(sfResult *sf.SFFrameResult, config *sf.Config, ...) *sfCheck
- func CreateIncludeValue(vs Values) sfvm.ValueOperator
- func DataFlowLabel(analysisType AnalysisType) string
- func FunctionDotGraph(function *ssa.Function) string
- func GetBareType(typ *Type) ssa.Type
- func GetFreeValue(v *Value) *ssa.Parameter
- func GetIncludeCacheValue(program *Program, ruleName string, inputValues Values) (hash string, value sfvm.ValueOperator, shouldCache bool)
- func GetSFIncludeCache() *utils.Cache[Values]
- func IsDataFlowLabel(label string) bool
- func MergeSFValueOperator(sfv ...sfvm.ValueOperator) sfvm.ValueOperator
- func NewRuntimeContext() *omap.OrderedMap[ContextID, *Value]
- func RegisterExport(name string, value any)
- func SaveConfig(c *Config, prog *Program)
- func SaveValue(value *Value, opts ...SaveValueOption) error
- func SetProgramCache(program *Program, ttls ...time.Duration)
- func ShowFunctionDot(function *ssa.Function)
- func Size(size int) string
- func TypeCompare(t1, t2 *Type) bool
- func ValidSyntaxFlowRule(s *schema.SyntaxFlowRule) error
- func ValueCompare(v1raw, v2raw *Value) bool
- func ValueContain(v1 *Value, v2 ...*Value) bool
- func ValuesToSFValueList(values Values) sfvm.ValueOperator
- func WithEnableCache(b ...bool) ssaconfig.Option
- func WithExcludeFunc(patterns []string) ssaconfig.Option
- func WithExternBuildValueHandler(id string, callback func(b *ssa.FunctionBuilder, id string, v any) ssa.Value) ssaconfig.Option
- func WithExternLib(name string, table map[string]any) ssaconfig.Option
- func WithFileSystemEntry(v ...string) ssaconfig.Option
- func WithLocalFs(path string) ssaconfig.Option
- func YaklangScriptChecking(code string, pluginType string) []any
- func YieldSyntaxFlowResult(db *gorm.DB) chan *SyntaxFlowResult
- type AnalysisType
- type AnalyzeContext
- type CodeRange
- type Config
- type ContextID
- type DBGraph
- type DominatorForest
- type DominatorTree
- type DotGraph
- func (g *DotGraph) CreateEdge(edge Edge) error
- func (g *DotGraph) DeepFirstGraphNext(value *Value) [][]string
- func (g *DotGraph) DeepFirstGraphPrev(value *Value) [][]string
- func (g *DotGraph) ForEach(f func(string, *Value))
- func (g *DotGraph) GetGraphKind() GraphKind
- func (g *DotGraph) NodeCount() int
- func (g *DotGraph) NodeName(v *Value) string
- func (g *DotGraph) Show()
- func (g *DotGraph) String() string
- type Dtype
- type Edge
- type EdgeType
- type FileFilter
- type FileFilterXpathKind
- type FileXPathMatcher
- type FunctionCFG
- type Graph
- type GraphInfo
- type GraphKind
- type Index
- type NativeCallDocument
- type NodeInfo
- type OperationConfig
- type OperationOption
- func WithAllowCallStack(allowCallStack bool) OperationOption
- func WithDepthLimit(depth int) OperationOption
- func WithExclusiveContext(ctx context.Context) OperationOption
- func WithHookEveryNode(hookNode func(*Value) error) OperationOption
- func WithLastValue(value *Value) OperationOption
- func WithMaxDepth(maxDepth int) OperationOption
- func WithMinDepth(minDepth int) OperationOption
- func WithUntilNode(untilNode func(*Value) bool) OperationOption
- type PredecessorValue
- type ProcessFunc
- type Program
- func FromDatabase(programName string) (p *Program, err error)
- func NewProgram(prog *ssa.Program, config *Config) *Program
- func NewTmpProgram(name string) *Program
- func Parse(code string, opts ...ssaconfig.Option) (*Program, error)
- func ParseFromReader(input io.Reader, opts ...ssaconfig.Option) (*Program, error)
- func (p *Program) AppendPredecessor(sfvm.ValueOperator, ...sfvm.AnalysisContextOption) error
- func (p *Program) CompareConst(comparator *sfvm.ConstComparator) []bool
- func (p *Program) CompareOpcode(opcodeItems *sfvm.OpcodeComparator) (sfvm.ValueOperator, []bool)
- func (p *Program) CompareString(comparator *sfvm.StringComparator) (sfvm.ValueOperator, []bool)
- func (p *Program) DBDebug()
- func (p *Program) ExactMatch(ctx context.Context, mod int, s string) (bool, sfvm.ValueOperator, error)
- func (p *Program) Feed(code io.Reader) error
- func (p *Program) FileFilter(path string, match string, rule map[string]string, rule2 []string) (sfvm.ValueOperator, error)
- func (p *Program) ForEachAllFile(callBack func(string, *memedit.MemEditor) bool)
- func (p *Program) ForEachExtraFile(callBack func(string, *memedit.MemEditor) bool)
- func (p *Program) GetAllOffsetItemsBefore(offset int) []*ssa.OffsetItem
- func (p *Program) GetBinaryOperator() string
- func (p *Program) GetCallActualParams(int, bool) (sfvm.ValueOperator, error)
- func (p *Program) GetCalled() (sfvm.ValueOperator, error)
- func (p *Program) GetErrors() ssa.SSAErrors
- func (p *Program) GetFields() (sfvm.ValueOperator, error)
- func (p *Program) GetLanguage() ssaconfig.Language
- func (p *Program) GetOpcode() string
- func (p *Program) GetProgramKind() ssadb.ProgramKind
- func (p *Program) GetProgramName() string
- func (p *Program) GetSyntaxFlowBottomUse(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, ...) (sfvm.ValueOperator, error)
- func (p *Program) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
- func (p *Program) GetSyntaxFlowTopDef(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, ...) (sfvm.ValueOperator, error)
- func (p *Program) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
- func (p *Program) GetType(name string) *Type
- func (p *Program) GetUnaryOperator() string
- func (p *Program) GetValueById(id int64) (*Value, error)
- func (p *Program) GetValueByIdMust(id int64) *Value
- func (p *Program) GlobMatch(ctx context.Context, mod int, g string) (bool, sfvm.ValueOperator, error)
- func (p *Program) HasSavedDB() bool
- func (p *Program) Hash() (string, bool)
- func (p *Program) IsEmpty() bool
- func (p *Program) IsFromDatabase() bool
- func (p *Program) IsList() bool
- func (p *Program) IsMap() bool
- func (p *Program) IsNil() bool
- func (p *Program) ListIndex(i int) (sfvm.ValueOperator, error)
- func (p *Program) Merge(sfv ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
- func (p *Program) NewConst(i any, rng ...*memedit.Range) sfvm.ValueOperator
- func (p *Program) NewConstValue(i any, rng ...*memedit.Range) *Value
- func (p *Program) NewValue(inst ssa.Instruction) (*Value, error)
- func (p *Program) NewValueFromAuditNode(nodeID string) *Value
- func (prog *Program) Recompile(inputOpt ...ssaconfig.Option) error
- func (p *Program) Recursive(f func(operator sfvm.ValueOperator) error) error
- func (p *Program) Ref(name string) Values
- func (p *Program) RegexpMatch(ctx context.Context, mod int, re string) (bool, sfvm.ValueOperator, error)
- func (p *Program) Remove(...sfvm.ValueOperator) (sfvm.ValueOperator, error)
- func (p *Program) Show() *Program
- func (p *Program) String() string
- func (p *Program) SyntaxFlow(rule string, opts ...QueryOption) *SyntaxFlowResult
- func (p *Program) SyntaxFlowChain(i string, opts ...QueryOption) Values
- func (p *Program) SyntaxFlowRule(rule *schema.SyntaxFlowRule, opts ...QueryOption) (*SyntaxFlowResult, error)
- func (p *Program) SyntaxFlowRuleName(ruleName string, opts ...QueryOption) (*SyntaxFlowResult, error)
- func (p *Program) SyntaxFlowWithError(rule string, opts ...QueryOption) (*SyntaxFlowResult, error)
- type Programs
- func ParseProject(opts ...ssaconfig.Option) (prog Programs, err error)
- func ParseProjectFromPath(path string, opts ...ssaconfig.Option) (Programs, error)
- func ParseProjectWithFS(fs fi.FileSystem, opts ...ssaconfig.Option) (Programs, error)
- func PeepholeCompile(fs fi.FileSystem, size int, opts ...ssaconfig.Option) (Programs, error)
- func (p Programs) Show() Programs
- func (ps Programs) SyntaxFlowRule(rule *schema.SyntaxFlowRule, opts ...QueryOption) (*SyntaxFlowResult, error)
- func (ps Programs) SyntaxFlowRuleName(ruleName string, opts ...QueryOption) (*SyntaxFlowResult, error)
- func (ps Programs) SyntaxFlowWithError(i string, opts ...QueryOption) (*SyntaxFlowResult, error)
- type QueryOption
- func QueryWithContext(ctx context.Context) QueryOption
- func QueryWithEnableDebug(b ...bool) QueryOption
- func QueryWithFailFast(b ...bool) QueryOption
- func QueryWithFrame(f *sfvm.SFFrame) QueryOption
- func QueryWithInitInputVar(value sfvm.ValueOperator) QueryOption
- func QueryWithInitVar(result *omap.OrderedMap[string, sfvm.ValueOperator]) QueryOption
- func QueryWithMemory() QueryOption
- func QueryWithProcessCallback(cb func(float64, string)) QueryOption
- func QueryWithProgram(program *Program) QueryOption
- func QueryWithPrograms(programs Programs) QueryOption
- func QueryWithProjectId(id uint64) QueryOption
- func QueryWithResultCaptured(capture sfvm.ResultCapturedCallback) QueryOption
- func QueryWithRule(rule *schema.SyntaxFlowRule) QueryOption
- func QueryWithRuleContent(rule string) QueryOption
- func QueryWithRuleName(names string) QueryOption
- func QueryWithSFConfig(config *sfvm.Config) QueryOption
- func QueryWithSSAConfig(c *ssaconfig.Config) QueryOption
- func QueryWithSave(kind schema.SyntaxflowResultKind) QueryOption
- func QueryWithStrictMatch(b ...bool) QueryOption
- func QueryWithSyntaxFlowResult(expected string, handler func(*Value) error) QueryOption
- func QueryWithTaskID(taskID string) QueryOption
- func QueryWithUseCache(b ...bool) QueryOption
- func QueryWithVM(vm *sfvm.SyntaxFlowVirtualMachine) QueryOption
- func QueryWithValue(value sfvm.ValueOperator) QueryOption
- type SaveFolder
- type SaveValueOption
- func OptionSaveValue_Context(ctx context.Context) SaveValueOption
- func OptionSaveValue_Database(db *auditDatabase) SaveValueOption
- func OptionSaveValue_IsMemoryCompile(bool2 bool) SaveValueOption
- func OptionSaveValue_ProgramName(name string) SaveValueOption
- func OptionSaveValue_ResultID(resultID uint) SaveValueOption
- func OptionSaveValue_ResultIndex(index uint) SaveValueOption
- func OptionSaveValue_ResultRiskHash(hash string) SaveValueOption
- func OptionSaveValue_ResultVariable(variable string) SaveValueOption
- func OptionSaveValue_RuleName(i string) SaveValueOption
- func OptionSaveValue_RuleTitle(name string) SaveValueOption
- func OptionSaveValue_TaskID(taskID string) SaveValueOption
- type SyntaxFlowResult
- func CreateResultFromCache(kind ssaconfig.SFResultSaveKind, id uint64) *SyntaxFlowResult
- func CreateResultFromQuery(res *sfvm.SFFrameResult, config *ssaconfig.Config) *SyntaxFlowResult
- func CreateResultWithProg(prog *Program, res *sfvm.SFFrameResult) *SyntaxFlowResult
- func LoadResultByID(resultID uint, force ...bool) (*SyntaxFlowResult, error)
- func LoadResultByRuleContent(programName, ruleContent string, kind schema.SyntaxflowResultKind) (*SyntaxFlowResult, error)
- func QuerySyntaxflow(opt ...QueryOption) (*SyntaxFlowResult, error)
- func (r *SyntaxFlowResult) CreateRisk() error
- func (r *SyntaxFlowResult) Dump(showCode bool) string
- func (r *SyntaxFlowResult) DumpValuesJson(name string) string
- func (r *SyntaxFlowResult) GetAlertInfo(name string) (*schema.SyntaxFlowDescInfo, bool)
- func (r *SyntaxFlowResult) GetAlertMsg(name string) (string, bool)
- func (r *SyntaxFlowResult) GetAlertValue(name string) Values
- func (r *SyntaxFlowResult) GetAlertValues() *omap.OrderedMap[string, Values]
- func (r *SyntaxFlowResult) GetAlertVariables() []string
- func (r *SyntaxFlowResult) GetAllValuesChain() Values
- func (r *SyntaxFlowResult) GetAllVariable() *orderedmap.OrderedMap
- func (r *SyntaxFlowResult) GetCheckMsg() []string
- func (r *SyntaxFlowResult) GetErrors() []string
- func (r *SyntaxFlowResult) GetFileCount() int
- func (r *SyntaxFlowResult) GetGRPCModelResult() *ypb.SyntaxFlowResult
- func (r *SyntaxFlowResult) GetGRPCModelRisk() []*ypb.SSARisk
- func (r *SyntaxFlowResult) GetLineCount() int
- func (r *SyntaxFlowResult) GetProgramLang() ssaconfig.Language
- func (r *SyntaxFlowResult) GetProgramName() string
- func (r *SyntaxFlowResult) GetResultID() uint
- func (r *SyntaxFlowResult) GetResultSaveKind() ssaconfig.SFResultSaveKind
- func (r *SyntaxFlowResult) GetRiskByValue(variable string, i int) *schema.SSARisk
- func (r *SyntaxFlowResult) GetRiskCountMap() map[string]int64
- func (r *SyntaxFlowResult) GetRiskHash(variable string, i int) string
- func (r *SyntaxFlowResult) GetRule() *schema.SyntaxFlowRule
- func (r *SyntaxFlowResult) GetSFResult() *sfvm.SFFrameResult
- func (r *SyntaxFlowResult) GetUnNameValues() Values
- func (r *SyntaxFlowResult) GetValue(name string, index int) (*Value, error)
- func (r *SyntaxFlowResult) GetValueCount(name string) int
- func (r *SyntaxFlowResult) GetValues(name string) Values
- func (r *SyntaxFlowResult) GetVariableNum() int
- func (r *SyntaxFlowResult) IsDatabase() bool
- func (r *SyntaxFlowResult) IsLib() bool
- func (r *SyntaxFlowResult) IsProgMemoryCompile() bool
- func (r *SyntaxFlowResult) Name() string
- func (r *SyntaxFlowResult) RiskCount() int
- func (r *SyntaxFlowResult) Save(kind schema.SyntaxflowResultKind, TaskIDs ...string) (uint, error)
- func (r *SyntaxFlowResult) SaveRisk(variable string, index int, value *Value, save bool) string
- func (r *SyntaxFlowResult) SaveWithContext(ctx context.Context, kind schema.SyntaxflowResultKind, TaskIDs ...string) (uint, error)
- func (r *SyntaxFlowResult) SetResultID(id uint)
- func (r *SyntaxFlowResult) Show(opts ...sfvm.ShowOption)
- func (r *SyntaxFlowResult) String(opts ...sfvm.ShowOption) string
- func (r *SyntaxFlowResult) YieldRisk() chan *schema.SSARisk
- type Type
- type Value
- func (i *Value) AppendDependOn(v *Value) (ret *Value)
- func (i *Value) AppendEffectOn(v *Value) (ret *Value)
- func (v *Value) AppendPredecessor(operator sfvm.ValueOperator, opts ...sfvm.AnalysisContextOption) error
- func (v *Value) Backtrack() *omap.OrderedMap[string, *Value]
- func (v *Value) Compare(other *Value) bool
- func (v *Value) CompareConst(comparator *sfvm.ConstComparator) []bool
- func (v *Value) CompareOpcode(comparator *sfvm.OpcodeComparator) (sfvm.ValueOperator, []bool)
- func (v *Value) CompareString(items *sfvm.StringComparator) (sfvm.ValueOperator, []bool)
- func (v *Value) Count() int
- func (v *Value) DotGraph() string
- func (v *Value) EffectOnCount() int
- func (v *Value) ExactMatch(ctx context.Context, mod int, want string) (bool, sfvm.ValueOperator, error)
- func (v *Value) FileFilter(path string, match string, rule map[string]string, rule2 []string) (sfvm.ValueOperator, error)
- func (v *Value) FlexibleDepends() *Value
- func (v *Value) ForEachDependOn(f func(value *Value))
- func (v *Value) ForEachEffectOn(f func(value *Value))
- func (v *Value) GenerateGraph(g Graph, ctxs ...context.Context) error
- func (v *Value) GetAllMember() Values
- func (v *Value) GetAllVariables() map[string]*ssa.Variable
- func (v *Value) GetAuditNodeId() uint
- func (v *Value) GetBinaryOperator() string
- func (v *Value) GetBlock() *Value
- func (v *Value) GetBottomUses(opt ...OperationOption) (ret Values)
- func (v *Value) GetCallActualParams(start int, contain bool) (sfvm.ValueOperator, error)
- func (v *Value) GetCallArgs() Values
- func (v *Value) GetCallReturns() Values
- func (v *Value) GetCalled() (sfvm.ValueOperator, error)
- func (v *Value) GetCalledBy() Values
- func (v *Value) GetCallee() *Value
- func (v *Value) GetConst() *ssa.ConstInst
- func (v *Value) GetConstValue() any
- func (v *Value) GetContextValue(i ContextID) (*Value, bool)
- func (v *Value) GetDataflowPath(end ...*Value) []Values
- func (v *Value) GetDependOn() Values
- func (v *Value) GetDependOnCount() int
- func (v *Value) GetDependOnPath(end ...*Value) []Values
- func (v *Value) GetEffectOn() Values
- func (v *Value) GetEffectOnPath(end ...*Value) []Values
- func (v *Value) GetFields() (sfvm.ValueOperator, error)
- func (v *Value) GetFreeValue(name string) *Value
- func (v *Value) GetFunction() *Value
- func (v *Value) GetFunctionObjectType() ssa.Type
- func (v *Value) GetGraphInfo(graphs ...*DotGraph) *GraphInfo
- func (v *Value) GetId() int64
- func (v *Value) GetInnerValueVerboseName() string
- func (v *Value) GetKey() *Value
- func (v *Value) GetMask() Values
- func (v *Value) GetMember(value *Value) []*Value
- func (v *Value) GetMembers() [][]*Value
- func (v *Value) GetMembersByString(key string) (sfvm.ValueOperator, bool)
- func (v *Value) GetName() string
- func (v *Value) GetObject() *Value
- func (v *Value) GetOpcode() string
- func (v *Value) GetOperand(index int) *Value
- func (v *Value) GetOperands() Values
- func (v *Value) GetParameter(i int) *Value
- func (v *Value) GetParameters() Values
- func (v *Value) GetPointer() Values
- func (v *Value) GetPredecessors() []*PredecessorValue
- func (v *Value) GetProgramName() string
- func (v *Value) GetRange() *memedit.Range
- func (v *Value) GetReachable() *Value
- func (v *Value) GetReference() *Value
- func (v *Value) GetReturn() Values
- func (v *Value) GetSSAInst() ssa.Instruction
- func (v *Value) GetSelf() *Value
- func (v *Value) GetSyntaxFlowBottomUse(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, ...) (sfvm.ValueOperator, error)
- func (v *Value) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
- func (v *Value) GetSyntaxFlowTopDef(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, ...) (sfvm.ValueOperator, error)
- func (v *Value) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
- func (i *Value) GetTopDefs(opt ...OperationOption) (ret Values)
- func (v *Value) GetType() *Type
- func (v *Value) GetTypeKind() ssa.TypeKind
- func (v *Value) GetUUID() string
- func (v *Value) GetUnaryOperator() string
- func (v *Value) GetUser(index int) *Value
- func (v *Value) GetUsers() Values
- func (v *Value) GetVariable(name string) *ssa.Variable
- func (v *Value) GetVerboseName() string
- func (v *Value) GlobMatch(ctx context.Context, mod int, g string) (bool, sfvm.ValueOperator, error)
- func (v *Value) HasOperands() bool
- func (v *Value) HasUsers() bool
- func (v *Value) Hash() (string, bool)
- func (v *Value) InMainFunction() bool
- func (v *Value) IsAssert() bool
- func (v *Value) IsBasicBlock() bool
- func (v *Value) IsBinOp() bool
- func (v *Value) IsCall() bool
- func (v *Value) IsCalled() bool
- func (v *Value) IsConstInst() bool
- func (v *Value) IsEmpty() bool
- func (v *Value) IsErrorHandler() bool
- func (v *Value) IsExtern() bool
- func (v *Value) IsExternLib() bool
- func (v *Value) IsFreeValue() bool
- func (v *Value) IsFromDataBase() bool
- func (v *Value) IsFunction() bool
- func (v *Value) IsIf() bool
- func (v *Value) IsJump() bool
- func (v *Value) IsLazy() bool
- func (v *Value) IsList() bool
- func (v *Value) IsLoop() bool
- func (v *Value) IsMake() bool
- func (v *Value) IsMap() bool
- func (v *Value) IsMember() bool
- func (v *Value) IsMethod() bool
- func (v *Value) IsModifySelf() bool
- func (v *Value) IsNext() bool
- func (v *Value) IsNil(checkValue ...bool) bool
- func (v *Value) IsObject() bool
- func (v *Value) IsPanic() bool
- func (v *Value) IsParameter() bool
- func (v *Value) IsParameterMember() bool
- func (v *Value) IsPhi() bool
- func (v *Value) IsReachable() ssa.BasicBlockReachableKind
- func (v *Value) IsRecover() bool
- func (v *Value) IsReturn() bool
- func (v *Value) IsSideEffect() bool
- func (v *Value) IsSwitch() bool
- func (v *Value) IsTypeCast() bool
- func (v *Value) IsTypeValue() bool
- func (v *Value) IsUnOp() bool
- func (v *Value) IsUndefined() bool
- func (v *Value) ListIndex(i int) (sfvm.ValueOperator, error)
- func (v *Value) LoadFullUseDefChain() *Value
- func (v *Value) Merge(sf ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
- func (v *Value) NewConst(i any, rng ...*memedit.Range) sfvm.ValueOperator
- func (v *Value) NewConstValue(i any, rng ...*memedit.Range) *Value
- func (v *Value) NewDotGraph() *DotGraph
- func (v *Value) NewError(tag, msg string)
- func (v *Value) NewValue(value ssa.Instruction) *Value
- func (v *Value) NewValueFromAuditNode(nodeID string) *Value
- func (v *Value) NewWarn(tag, msg string)
- func (v *Value) Recursive(f func(operator sfvm.ValueOperator) error) error
- func (v *Value) RecursiveDepends(h func(value *Value) error)
- func (v *Value) RecursiveDependsAndEffects(h func(value *Value) error)
- func (v *Value) RecursiveEffects(h func(value *Value) error)
- func (v *Value) RegexpMatch(ctx context.Context, mod int, re string) (bool, sfvm.ValueOperator, error)
- func (v *Value) Remove(sf ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
- func (i *Value) RemoveDependOn(vs ...*Value)
- func (i *Value) RemoveEffectOn(vs ...*Value)
- func (v *Value) SetContextValue(i ContextID, values *Value) *Value
- func (v *Value) ShortString() string
- func (i *Value) Show() *Value
- func (v *Value) ShowBacktrack()
- func (v *Value) ShowDot()
- func (v *Value) ShowUseDefChain()
- func (i *Value) ShowWithRange() *Value
- func (i *Value) ShowWithSourceCode() *Value
- func (v *Value) String() string
- func (v *Value) StringWithRange() string
- func (v *Value) StringWithSourceCode(msg ...string) string
- type Values
- func DataFlowWithSFConfig(sfResult *sf.SFFrameResult, config *sf.Config, value *Value, ...) Values
- func FindFlexibleCommonDepends(val Values) Values
- func FindFlexibleDependsIntersection(root Values, element Values, opts ...OperationOption) Values
- func FindStrictCommonDepends(val Values) Values
- func GetValues(v *Value) Values
- func MergeValues(allVs ...Values) Values
- func SFValueListToValues(list *sfvm.ValueList) (Values, error)
- func SearchWithCFG(value *Value, mod int, compare func(string) bool, ...) Values
- func SearchWithValue(value *Value, mod int, compare func(string) bool, ...) Values
- func SyntaxFlowVariableToValues(vs ...sfvm.ValueOperator) Values
- func (i Values) AppendDependOn(v *Value) Values
- func (i Values) AppendEffectOn(vs *Value) Values
- func (value Values) AppendPredecessor(operator sfvm.ValueOperator, opts ...sfvm.AnalysisContextOption) error
- func (v Values) CompareConst(comparator *sfvm.ConstComparator) []bool
- func (v Values) CompareOpcode(comparator *sfvm.OpcodeComparator) (sfvm.ValueOperator, []bool)
- func (v Values) CompareString(comparator *sfvm.StringComparator) (sfvm.ValueOperator, []bool)
- func (vs Values) Count() int
- func (vs Values) DotGraph() string
- func (values Values) ExactMatch(ctx context.Context, mod int, want string) (bool, sfvm.ValueOperator, error)
- func (value Values) ExtractTopDefsIntersection(targets Values, opts ...OperationOption) Values
- func (vs Values) FileFilter(path string, match string, rule map[string]string, rule2 []string) (sfvm.ValueOperator, error)
- func (v Values) Filter(f func(*Value) bool) Values
- func (v Values) Flat(f func(*Value) Values) Values
- func (v Values) FlexibleDepends() Values
- func (v Values) ForEach(f func(*Value)) Values
- func (v Values) FullUseDefChain(h func(*Value))
- func (v Values) Get(i int) *Value
- func (Values) GetBinaryOperator() string
- func (v Values) GetBottomUses(opts ...OperationOption) Values
- func (v Values) GetBySyntaxFlowName(name string) Values
- func (value Values) GetCallActualParams(index int, contain bool) (sfvm.ValueOperator, error)
- func (value Values) GetCalled() (sfvm.ValueOperator, error)
- func (vs Values) GetDataflowPath(end ...*Value) []Values
- func (value Values) GetFields() (sfvm.ValueOperator, error)
- func (value Values) GetMembersByString(key string) (sfvm.ValueOperator, error)
- func (p Values) GetOpcode() string
- func (v Values) GetOperands() Values
- func (value Values) GetSyntaxFlowBottomUse(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, ...) (sfvm.ValueOperator, error)
- func (value Values) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
- func (value Values) GetSyntaxFlowTopDef(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, ...) (sfvm.ValueOperator, error)
- func (value Values) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
- func (v Values) GetTopDefs(opts ...OperationOption) Values
- func (Values) GetUnaryOperator() string
- func (v Values) GetUsers() Values
- func (values Values) GlobMatch(ctx context.Context, mod int, g string) (bool, sfvm.ValueOperator, error)
- func (value Values) Hash() (string, bool)
- func (vs Values) IsEmpty() bool
- func (value Values) IsList() bool
- func (value Values) IsMap() bool
- func (value Values) Len() int
- func (value Values) ListIndex(i int) (sfvm.ValueOperator, error)
- func (vs Values) Merge(sf ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
- func (v Values) NewConst(i any, rng ...*memedit.Range) sfvm.ValueOperator
- func (vs Values) NewDotGraph() *DotGraph
- func (v Values) NewValue(ssaVal ssa.Instruction) *Value
- func (value Values) Recursive(f func(operator sfvm.ValueOperator) error) error
- func (value Values) Ref(name string) Values
- func (values Values) RegexpMatch(ctx context.Context, mod int, re string) (bool, sfvm.ValueOperator, error)
- func (value Values) Remove(values ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
- func (v Values) Show(b ...bool) Values
- func (vs Values) ShowDot() Values
- func (v Values) ShowWithSource(b ...bool) Values
- func (v Values) String() string
- func (v Values) StringEx(flag int) string
Constants ¶
const ( Predecessors_TopDefLabel = "dataflow_topdef" Predecessors_BottomUseLabel = "dataflow_bottomuse" )
const ( // NativeCall_GetReturns is used to get the returns of a value NativeCall_GetReturns = "getReturns" // NativeCall_GetFormalParams is used to get the formal params of a value NativeCall_GetFormalParams = "getFormalParams" // NativeCall_GetFunc is used to get the function of a value // find current function instruction which contains the value NativeCall_GetFunc = "getFunc" // NativeCall_GetCall is used to get the call of a value, generally used to get the call of an opcode NativeCall_GetCall = "getCall" // NativeCall_GetCallee is used to get the caller of a value // find the caller instruction which contains the value NativeCall_GetCallee = "getCallee" // NativeCall_SearchFunc is used to search the call of a value, generally used to search the call of a function // if the input is a call already, check the 'call' 's method(function) 's other call(search mode) // // searchCall is not like getCall, search call will search all function name(from call) in the program NativeCall_SearchFunc = "searchFunc" // NativeCall_GetObject is used to get the object of a value NativeCall_GetObject = "getObject" // NativeCall_GetMembers is used to get the members of a value NativeCall_GetMembers = "getMembers" // NativeCall_GetMemberByKey is used to get the members of a value by key // example: <getMemberByKey(key="")> NativeCall_GetMemberByKey = "getMemberByKey" // NativeCall_GetSiblings is used to get the siblings of a value NativeCall_GetSiblings = "getSiblings" // NativeCall_TypeName is used to get the type name of a value NativeCall_TypeName = "typeName" // NativeCall_FullTypeName is used to get the full type name of a value NativeCall_FullTypeName = "fullTypeName" // NativeCall_Name is used to get the function name of a value NativeCall_Name = "name" // NativeCall_String is used to get the function name of a value NativeCall_String = "string" // NativeCall_Include is used to include a syntaxflow-rule NativeCall_Include = "include" // NativeCall_Eval is used to eval a new syntaxflow rule NativeCall_Eval = "eval" // NativeCall_Fuzztag is used to eval a new yaklang fuzztag template, the variables is in SFFrameResult NativeCall_Fuzztag = "fuzztag" // NativeCall_Show just show the value, do nothing NativeCall_Show = "show" // NativeCall_Slice just show the value, do nothing // example: <slice(start=0)> NativeCall_Slice = "slice" // NativeCall_Regexp is used to regexp, group is available // you can use <regexp(`...`, group: 1)> to extract NativeCall_Regexp = "regexp" // NativeCall_StrLower is used to convert a string to lower case NativeCall_StrLower = "strlower" // NativeCall_StrUpper is used to convert a string to upper case NativeCall_StrUpper = "strupper" // NativeCall_Var is used to put vars to variables NativeCall_Var = "var" // NativeCall_MyBatisSink is used to find MyBatis Sink for default searching NativeCall_MyBatisSink = "mybatisSink" // NativeCall_FreeMarkerSink is used to find FreeMarker Sink for default searching NativeCall_FreeMarkerSink = "freeMarkerSink" // NativeCall_OpCodes is used to get the opcodes of a value NativeCall_OpCodes = "opcodes" // NativeCall_SourceCode is used to get the source code of a value NativeCall_SourceCode = "sourceCode" // NativeCall_ScanPrevious is used to scan previous opcode of a value NativeCall_ScanPrevious = "scanPrevious" // NativeCall_ScanNext is used to scan next NativeCall_ScanNext = "scanNext" //NativeCall_ScanInstruction is used to scan current block's instruction NativeCall_ScanInstruction = "scanInstruction" //NativeCall_DeleteVariable is used to delete a variable NativeCall_DeleteVariable = "delete" // NativeCall_Forbid is used to forbid a value, if values existed, report critical error. NativeCall_Forbid = "forbid" // NativeCall_Self is used to get self value NativeCall_Self = "self" // NativeCall_DataFlow is used to get data flow // if u want to fetch dataflow, call <dataflow...> after --> or #-> // use it like: $data<dataflow(<<<CODE // *?{opcode: call && <getCallee><name>?{name} } // CODE)> NativeCall_DataFlow = "dataflow" // NativeCall_Const is used to search const value NativeCall_Const = "const" // NativeCall_VersionIn is used to get the version in NativeCall_VersionIn = "versionIn" // NativeCall_IsSanitizeName checks for potential sanitization function names NativeCall_IsSanitizeName = "isSanitizeName" // NativeCall_Java_UnEscape_Output is used to show output in java template languages that has not been escape, // and is generally used to audit XSS vulnerabilities NativeCall_Java_UnEscape_Output = "javaUnescapeOutput" NativeCall_Foeach_Func_Inst = "foreach_function_inst" NativeCall_GetFilenameByContent = "FilenameByContent" NativeCall_GetFullFileName = "getFullFileName" NativeCall_GetUsers = "getUsers" NativeCall_GetPredecessors = "getPredecessors" NativeCall_GetActualParams = "getActualParams" NativeCall_GetActualParamLen = "getActualParamLen" //getCurrentBlueprint is used to get the current blueprint. only function can use it NativeCall_GetCurrentBlueprint = "getCurrentBlueprint" NativeCall_ExtendsBy = "extendsBy" NativeCall_GetBlurpint = "getBluePrint" NativeCall_GetParentBlueprint = "getParentsBlueprint" NativeCall_GetInterfaceBlueprint = "getInterfaceBlueprint" NativeCall_GetRootParentBlueprint = "getRootParentBlueprint" NativeCall_Length = "len" NativeCall_GetRoot = "root" )
const ( Previous direction = "previous" Current direction = "current" Next direction = "next" )
const ( MAXTime = time.Millisecond * 500 MaxPathElements = 10 )
const ( EdgeTypeDependOn = "depend_on" EdgeTypeEffectOn = "effect_on" EdgeTypePredecessor = "predecessor" )
const ( GraphKindShow = "Show" // show graph, show from(prev) -> to(v) , not show duplicate edge GraphKindDump = "Dump" // dump and save graph, save from(v) -> to(prev) raw point. and save all edge )
const CodeContextLine = 3
const MAXLevel = 1000
Variables ¶
var ( ErrContextCancel error = errors.New("context cancel") ErrNoFoundCompiledFile error = errors.New("not found can compiled file") )
var DefaultInputVar = "input"
var Exports = map[string]any{ "Parse": Parse, "ParseLocalProject": ParseProjectFromPath, "ParseProject": ParseProject, "NewFromProgramName": FromDatabase, "NewProgramFromDB": FromDatabase, "withProjectName": ssaconfig.WithProjectName, "withConcurrency": WithConcurrency, "withLanguage": WithRawLanguage, "withConfigInfo": ssaconfig.WithCodeSourceMap, "withExternLib": WithExternLib, "withExternValue": WithExternValue, "withProgramName": WithProgramName, "withDescription": WithProgramDescription, "withProcess": WithProcess, "withEntryFile": WithFileSystemEntry, "withReCompile": WithReCompile, "withStrictMode": WithStrictMode, "withContext": WithContext, "withPeepholeSize": WithPeepholeSize, "withExcludeFile": WithExcludeFile, "withDefaultExcludeFunc": WithExcludeFunc, "withMemory": WithMemory, "Javascript": ssaconfig.JS, "Yak": ssaconfig.Yak, "PHP": ssaconfig.PHP, "Java": ssaconfig.JAVA, "YaklangScriptChecking": YaklangScriptChecking, "NewResultFromDB": LoadResultByID, }
var LanguageBuilderCreater = map[ssaconfig.Language]ssa.CreateBuilder{ ssaconfig.Yak: yak2ssa.CreateBuilder, ssaconfig.JS: ts2ssa.CreateBuilder, ssaconfig.PHP: php2ssa.CreateBuilder, ssaconfig.JAVA: java2ssa.CreateBuilder, ssaconfig.GO: go2ssa.CreateBuilder, ssaconfig.C: c2ssa.CreateBuilder, ssaconfig.TS: ts2ssa.CreateBuilder, }
var NativeCallDocuments = make(map[string]*NativeCallDocument)
var ProgramCache = utils.NewLRUCache[*Program](10)
var SkippedError = ssareducer.SkippedError
var WithASTOrder = ssaconfig.SetOption("ssa_compile/ast_order", func(c *Config, v ssareducer.ASTSequenceType) {
c.astSequence = v
})
var WithCacheTTL = ssaconfig.SetOption("ssa_compile/cache_ttl", func(c *Config, v time.Duration) { c.cacheTTL = append(c.cacheTTL, v) })
var WithConcurrency = ssaconfig.WithCompileConcurrency
var WithConfigInfo = ssaconfig.WithCodeSourceMap
var WithContext = ssaconfig.WithContext
var WithDatabaseProgramCacheHitter = ssaconfig.SetOption("ssa_compile/database_program_cache_hitter", func(c *Config, h func(i any)) {
c.DatabaseProgramCacheHitter = h
})
var WithDefineFunc = ssaconfig.SetOption("ssa_compile/define_func", func(c *Config, table map[string]any) {
for name, t := range table {
c.defineFunc[name] = t
}
})
var WithEditor = ssaconfig.SetOption("ssa_compile/editor", func(c *Config, v *memedit.MemEditor) {
c.originEditor = v
})
var WithExcludeFile = ssaconfig.SetOption("ssa_compile/exclude_file", func(c *Config, v func(path, filename string) bool) {
c.excludeFile = v
})
var WithExternInfo = ssaconfig.SetOption("ssa_compile/extern_info", func(c *Config, v string) {
c.externInfo = v
})
var WithExternMethod = ssaconfig.SetOption("ssa_compile/extern_method", func(c *Config, b ssa.MethodBuilder) {
c.externMethod = b
})
var WithExternValue = ssaconfig.SetOption("ssa_compile/extern_value", func(c *Config, table map[string]any) {
for name, value := range table {
c.externValue[name] = value
}
})
var WithFeedCode = ssaconfig.SetOption("ssa_compile/feed_code", func(c *Config, v bool) {
c.feedCode = v
})
var WithFileSystem = ssaconfig.SetOption("ssa_compile/file_system", func(c *Config, fs fi.FileSystem) { if fs == nil { return } c.fs = getUnifiedSeparatorFs(fs) })
var WithIgnoreSyntaxError = ssaconfig.SetOption("ssa_compile/ignore_syntax_error", func(c *Config, v bool) {
c.ignoreSyntaxErr = v
})
var WithIncludePath = ssaconfig.SetOption("ssa_compile/include_path", func(c *Config, v []string) { c.includePath = append(c.includePath, v...) })
var WithLanguage = ssaconfig.WithProjectLanguage
var WithLogLevel = ssaconfig.SetOption("ssa_compile/log_level", func(c *Config, v string) {
c.logLevel = v
log.SetLevel(v)
})
var WithMemory = ssaconfig.WithCompileMemoryCompile
var WithPeepholeSize = ssaconfig.WithCompilePeepholeSize
var WithProcess = ssaconfig.SetOption("ssa_compile/process", func(c *Config, v ProcessFunc) {
c.process = v
})
var WithProgramDescription = ssaconfig.WithProgramDescription
var WithProgramName = ssaconfig.WithProgramNames
var WithProgramPath = ssaconfig.SetOption("ssa_compile/program_path", func(c *Config, v string) {
c.programPath = v
})
var WithRawLanguage = ssaconfig.WithProjectRawLanguage
var WithReCompile = ssaconfig.WithCompileReCompile
var WithStrictMode = ssaconfig.WithCompileStrictMode
Functions ¶
func ClearCache ¶ added in v1.3.3
func ClearCache()
func CreateCheck ¶
func CreateCheck( contextResult *sf.SFFrameResult, config *sf.Config, configItems ...*sf.RecursiveConfigItem, ) *sfCheck
func CreateCheckFromNativeCallParam ¶
func CreateCheckFromNativeCallParam( sfResult *sf.SFFrameResult, config *sf.Config, params *sf.NativeCallActualParams, ) *sfCheck
func CreateIncludeValue ¶
func CreateIncludeValue(vs Values) sfvm.ValueOperator
func DataFlowLabel ¶
func DataFlowLabel(analysisType AnalysisType) string
func FunctionDotGraph ¶
FunctionDotGraph 为指定函数生成DOT格式的控制流图
func GetBareType ¶ added in v1.2.9
func GetFreeValue ¶ added in v1.3.3
func GetIncludeCacheValue ¶
func GetSFIncludeCache ¶
func IsDataFlowLabel ¶
func MergeSFValueOperator ¶
func MergeSFValueOperator(sfv ...sfvm.ValueOperator) sfvm.ValueOperator
func NewRuntimeContext ¶
func NewRuntimeContext() *omap.OrderedMap[ContextID, *Value]
func RegisterExport ¶
func SaveValue ¶
func SaveValue(value *Value, opts ...SaveValueOption) error
func SetProgramCache ¶
func ShowFunctionDot ¶
ShowFunctionDot 打印指定函数的DOT格式控制流图
func TypeCompare ¶ added in v1.2.9
func ValidSyntaxFlowRule ¶
func ValidSyntaxFlowRule(s *schema.SyntaxFlowRule) error
func ValueCompare ¶ added in v1.2.9
func ValueContain ¶
func ValuesToSFValueList ¶
func ValuesToSFValueList(values Values) sfvm.ValueOperator
func WithEnableCache ¶
func WithExcludeFunc ¶
func WithFileSystemEntry ¶ added in v1.3.3
func WithLocalFs ¶
func YaklangScriptChecking ¶
YaklangScriptChecking is a function that checks the syntax of a Yaklang script.
Input: code string, pluginType: `"yak" "mitm" "port-scan" "codec" "syntaxflow"`
Return: []*result.StaticAnalyzeResult
func YieldSyntaxFlowResult ¶
func YieldSyntaxFlowResult(db *gorm.DB) chan *SyntaxFlowResult
Types ¶
type AnalysisType ¶
type AnalysisType string
const ( TopDefAnalysis AnalysisType = "top_def" BottomUseAnalysis AnalysisType = "bottom_use" )
type AnalyzeContext ¶ added in v1.3.0
type AnalyzeContext struct {
// Self
Self *Value
// contains filtered or unexported fields
}
func NewAnalyzeContext ¶ added in v1.3.0
func NewAnalyzeContext(opt ...OperationOption) *AnalyzeContext
func (*AnalyzeContext) AllowIgnoreCallStack ¶
func (g *AnalyzeContext) AllowIgnoreCallStack() bool
func (*AnalyzeContext) CurrentObjectStack ¶
func (g *AnalyzeContext) CurrentObjectStack() *objectItem
func (*AnalyzeContext) HasUntilNode ¶
func (a *AnalyzeContext) HasUntilNode() bool
func (*AnalyzeContext) IsRecursiveLimit ¶
func (a *AnalyzeContext) IsRecursiveLimit() bool
func (*AnalyzeContext) SavePath ¶
func (a *AnalyzeContext) SavePath(result Values)
type CodeRange ¶
type CodeRange struct {
URL string `json:"url"`
StartLine int64 `json:"start_line"`
StartColumn int64 `json:"start_column"`
EndLine int64 `json:"end_line"`
EndColumn int64 `json:"end_column"`
SourceCodeLine int64 `json:"source_code_line"`
}
func (*CodeRange) JsonString ¶
type Config ¶
type Config struct {
*ssaconfig.Config // config
// language
LanguageBuilder ssa.Builder
// other build ssaconfig.Options
DatabaseProgramCacheHitter func(any)
EnableCache bool
// contains filtered or unexported fields
}
func (*Config) GetFileHandler ¶
func (c *Config) GetFileHandler( filesystem filesys_interface.FileSystem, preHandlerFiles []string, handlerFilesMap map[string]struct{}, ) <-chan *ssareducer.FileContent
type DBGraph ¶
type DBGraph struct {
// contains filtered or unexported fields
}
func NewDBGraph ¶
func NewDBGraph(ctx *saveValueCtx) *DBGraph
func (*DBGraph) CreateEdge ¶
func (*DBGraph) GetGraphKind ¶
type DominatorForest ¶ added in v1.3.1
type DominatorForest struct {
Trees []*DominatorTree
}
type DominatorTree ¶ added in v1.3.1
type DominatorTree *omap.OrderedMap[int, *Value]
type DotGraph ¶
func NewDotGraph ¶
func NewDotGraph() *DotGraph
func (*DotGraph) CreateEdge ¶
func (*DotGraph) DeepFirstGraphNext ¶
func (*DotGraph) DeepFirstGraphPrev ¶
func (*DotGraph) GetGraphKind ¶
type FileFilter ¶
type FileFilter struct {
// contains filtered or unexported fields
}
func NewFileFilter ¶
func NewFileFilter(file, matchType string, match []string) *FileFilter
type FileFilterXpathKind ¶
type FileFilterXpathKind string
const ( FileFilterXPathUnValid FileFilterXpathKind = "unValid" FileFilterXPathXML FileFilterXpathKind = "xml" FileFilterXPathJson FileFilterXpathKind = "json" FileFilterXPathYaml FileFilterXpathKind = "xpath" )
type FileXPathMatcher ¶
func NewFileXPathMatcher ¶
func NewFileXPathMatcher(expr string) (*FileXPathMatcher, error)
type FunctionCFG ¶
type FunctionCFG struct {
*dot.Graph
Block2Node map[*ssa.BasicBlock]int // ssa.BasicBlock -> node-id
Node2Block map[int]*ssa.BasicBlock // node-id -> ssa.BasicBlock
}
FunctionCFG 表示函数的控制流图
func NewFunctionCFG ¶
func NewFunctionCFG(function *ssa.Function) *FunctionCFG
NewFunctionCFG 创建一个新的函数控制流图
type NativeCallDocument ¶
type NativeCallDocument struct {
Name string
Description string
Function sfvm.NativeCallFunc
}
type OperationConfig ¶ added in v1.3.1
type OperationConfig struct {
// 限制递归深度,每一次递归核心函数,计数器都会加一
// 上下文计数器受到这个限制
MaxDepth int
MinDepth int
// Hook
HookEveryNode []func(*Value) error
UntilNode func(*Value) bool
AllowIgnoreCallStack bool
// contains filtered or unexported fields
}
func NewOperations ¶ added in v1.3.1
func NewOperations(opt ...OperationOption) *OperationConfig
type OperationOption ¶ added in v1.3.1
type OperationOption func(*OperationConfig)
func WithAllowCallStack ¶ added in v1.3.3
func WithAllowCallStack(allowCallStack bool) OperationOption
func WithDepthLimit ¶ added in v1.3.1
func WithDepthLimit(depth int) OperationOption
func WithExclusiveContext ¶
func WithExclusiveContext(ctx context.Context) OperationOption
func WithHookEveryNode ¶ added in v1.3.1
func WithHookEveryNode(hookNode func(*Value) error) OperationOption
func WithLastValue ¶
func WithLastValue(value *Value) OperationOption
func WithMaxDepth ¶ added in v1.3.1
func WithMaxDepth(maxDepth int) OperationOption
func WithMinDepth ¶ added in v1.3.1
func WithMinDepth(minDepth int) OperationOption
func WithUntilNode ¶
func WithUntilNode(untilNode func(*Value) bool) OperationOption
type PredecessorValue ¶
type PredecessorValue struct {
Node *Value
Info *sfvm.AnalysisContext
}
type ProcessFunc ¶
type Program ¶
type Program struct {
// TODO: one program may have multiple program,
// only one Application and multiple Library
Program *ssa.Program
// contains filtered or unexported fields
}
func FromDatabase ¶ added in v1.3.3
FromDatabase get program from database by program name
func NewTmpProgram ¶
func ParseFromReader ¶ added in v1.3.3
ParseFromReader parse simple file to ssa.Program
func (*Program) AppendPredecessor ¶
func (p *Program) AppendPredecessor(sfvm.ValueOperator, ...sfvm.AnalysisContextOption) error
func (*Program) CompareConst ¶
func (p *Program) CompareConst(comparator *sfvm.ConstComparator) []bool
func (*Program) CompareOpcode ¶
func (p *Program) CompareOpcode(opcodeItems *sfvm.OpcodeComparator) (sfvm.ValueOperator, []bool)
func (*Program) CompareString ¶
func (p *Program) CompareString(comparator *sfvm.StringComparator) (sfvm.ValueOperator, []bool)
func (*Program) ExactMatch ¶ added in v1.3.3
func (*Program) FileFilter ¶
func (*Program) ForEachAllFile ¶
func (*Program) ForEachExtraFile ¶
func (*Program) GetAllOffsetItemsBefore ¶ added in v1.3.3
func (p *Program) GetAllOffsetItemsBefore(offset int) []*ssa.OffsetItem
func (*Program) GetBinaryOperator ¶
func (*Program) GetCallActualParams ¶ added in v1.3.3
func (*Program) GetCalled ¶ added in v1.3.3
func (p *Program) GetCalled() (sfvm.ValueOperator, error)
func (*Program) GetLanguage ¶
func (*Program) GetProgramKind ¶
func (p *Program) GetProgramKind() ssadb.ProgramKind
func (*Program) GetProgramName ¶
func (*Program) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowBottomUse(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Program) GetSyntaxFlowDef ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
func (*Program) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowTopDef(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Program) GetSyntaxFlowUse ¶ added in v1.3.3
func (p *Program) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
func (*Program) GetUnaryOperator ¶
func (*Program) GetValueById ¶ added in v1.3.0
from ssa id (IrCode)
func (*Program) GetValueByIdMust ¶ added in v1.3.0
func (*Program) HasSavedDB ¶
func (*Program) IsFromDatabase ¶
func (*Program) ListIndex ¶ added in v1.3.3
func (p *Program) ListIndex(i int) (sfvm.ValueOperator, error)
func (*Program) Merge ¶
func (p *Program) Merge(sfv ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
func (*Program) NewConstValue ¶
func (*Program) NewValue ¶ added in v1.3.3
func (p *Program) NewValue(inst ssa.Instruction) (*Value, error)
func (*Program) NewValueFromAuditNode ¶
func (*Program) Recursive ¶ added in v1.3.3
func (p *Program) Recursive(f func(operator sfvm.ValueOperator) error) error
func (*Program) RegexpMatch ¶ added in v1.3.3
func (*Program) Remove ¶
func (p *Program) Remove(...sfvm.ValueOperator) (sfvm.ValueOperator, error)
func (*Program) SyntaxFlow ¶ added in v1.3.3
func (p *Program) SyntaxFlow(rule string, opts ...QueryOption) *SyntaxFlowResult
func (*Program) SyntaxFlowChain ¶ added in v1.3.3
func (p *Program) SyntaxFlowChain(i string, opts ...QueryOption) Values
func (*Program) SyntaxFlowRule ¶
func (p *Program) SyntaxFlowRule(rule *schema.SyntaxFlowRule, opts ...QueryOption) (*SyntaxFlowResult, error)
func (*Program) SyntaxFlowRuleName ¶
func (p *Program) SyntaxFlowRuleName(ruleName string, opts ...QueryOption) (*SyntaxFlowResult, error)
func (*Program) SyntaxFlowWithError ¶ added in v1.3.3
func (p *Program) SyntaxFlowWithError(rule string, opts ...QueryOption) (*SyntaxFlowResult, error)
type Programs ¶
type Programs []*Program
func ParseProject ¶ added in v1.3.3
func ParseProjectFromPath ¶ added in v1.3.3
func ParseProjectWithFS ¶
func PeepholeCompile ¶
func (Programs) SyntaxFlowRule ¶
func (ps Programs) SyntaxFlowRule(rule *schema.SyntaxFlowRule, opts ...QueryOption) (*SyntaxFlowResult, error)
func (Programs) SyntaxFlowRuleName ¶
func (ps Programs) SyntaxFlowRuleName(ruleName string, opts ...QueryOption) (*SyntaxFlowResult, error)
func (Programs) SyntaxFlowWithError ¶
func (ps Programs) SyntaxFlowWithError(i string, opts ...QueryOption) (*SyntaxFlowResult, error)
type QueryOption ¶
type QueryOption func(*queryConfig)
func QueryWithContext ¶
func QueryWithContext(ctx context.Context) QueryOption
func QueryWithEnableDebug ¶
func QueryWithEnableDebug(b ...bool) QueryOption
func QueryWithFailFast ¶
func QueryWithFailFast(b ...bool) QueryOption
func QueryWithFrame ¶
func QueryWithFrame(f *sfvm.SFFrame) QueryOption
func QueryWithInitInputVar ¶
func QueryWithInitInputVar(value sfvm.ValueOperator) QueryOption
func QueryWithInitVar ¶
func QueryWithInitVar(result *omap.OrderedMap[string, sfvm.ValueOperator]) QueryOption
func QueryWithMemory ¶
func QueryWithMemory() QueryOption
func QueryWithProcessCallback ¶
func QueryWithProcessCallback(cb func(float64, string)) QueryOption
func QueryWithProgram ¶
func QueryWithProgram(program *Program) QueryOption
func QueryWithPrograms ¶
func QueryWithPrograms(programs Programs) QueryOption
func QueryWithProjectId ¶
func QueryWithProjectId(id uint64) QueryOption
func QueryWithResultCaptured ¶
func QueryWithResultCaptured(capture sfvm.ResultCapturedCallback) QueryOption
func QueryWithRule ¶
func QueryWithRule(rule *schema.SyntaxFlowRule) QueryOption
func QueryWithRuleContent ¶
func QueryWithRuleContent(rule string) QueryOption
func QueryWithRuleName ¶
func QueryWithRuleName(names string) QueryOption
func QueryWithSFConfig ¶
func QueryWithSFConfig(config *sfvm.Config) QueryOption
func QueryWithSSAConfig ¶
func QueryWithSSAConfig(c *ssaconfig.Config) QueryOption
func QueryWithSave ¶
func QueryWithSave(kind schema.SyntaxflowResultKind) QueryOption
func QueryWithStrictMatch ¶
func QueryWithStrictMatch(b ...bool) QueryOption
func QueryWithSyntaxFlowResult ¶
func QueryWithSyntaxFlowResult(expected string, handler func(*Value) error) QueryOption
func QueryWithTaskID ¶
func QueryWithTaskID(taskID string) QueryOption
func QueryWithUseCache ¶
func QueryWithUseCache(b ...bool) QueryOption
func QueryWithVM ¶
func QueryWithVM(vm *sfvm.SyntaxFlowVirtualMachine) QueryOption
func QueryWithValue ¶
func QueryWithValue(value sfvm.ValueOperator) QueryOption
type SaveFolder ¶
type SaveFolder struct {
// contains filtered or unexported fields
}
type SaveValueOption ¶
type SaveValueOption func(c *saveValueCtx)
func OptionSaveValue_Context ¶
func OptionSaveValue_Context(ctx context.Context) SaveValueOption
func OptionSaveValue_Database ¶
func OptionSaveValue_Database(db *auditDatabase) SaveValueOption
func OptionSaveValue_IsMemoryCompile ¶
func OptionSaveValue_IsMemoryCompile(bool2 bool) SaveValueOption
func OptionSaveValue_ProgramName ¶
func OptionSaveValue_ProgramName(name string) SaveValueOption
func OptionSaveValue_ResultID ¶
func OptionSaveValue_ResultID(resultID uint) SaveValueOption
func OptionSaveValue_ResultIndex ¶
func OptionSaveValue_ResultIndex(index uint) SaveValueOption
func OptionSaveValue_ResultRiskHash ¶
func OptionSaveValue_ResultRiskHash(hash string) SaveValueOption
func OptionSaveValue_ResultVariable ¶
func OptionSaveValue_ResultVariable(variable string) SaveValueOption
func OptionSaveValue_RuleName ¶
func OptionSaveValue_RuleName(i string) SaveValueOption
func OptionSaveValue_RuleTitle ¶
func OptionSaveValue_RuleTitle(name string) SaveValueOption
func OptionSaveValue_TaskID ¶
func OptionSaveValue_TaskID(taskID string) SaveValueOption
type SyntaxFlowResult ¶
type SyntaxFlowResult struct {
TaskID string
*ssaconfig.Config
// contains filtered or unexported fields
}
func CreateResultFromCache ¶
func CreateResultFromCache(kind ssaconfig.SFResultSaveKind, id uint64) *SyntaxFlowResult
func CreateResultFromQuery ¶
func CreateResultFromQuery(res *sfvm.SFFrameResult, config *ssaconfig.Config) *SyntaxFlowResult
func CreateResultWithProg ¶
func CreateResultWithProg(prog *Program, res *sfvm.SFFrameResult) *SyntaxFlowResult
func LoadResultByID ¶
func LoadResultByID(resultID uint, force ...bool) (*SyntaxFlowResult, error)
func LoadResultByRuleContent ¶
func LoadResultByRuleContent(programName, ruleContent string, kind schema.SyntaxflowResultKind) (*SyntaxFlowResult, error)
func QuerySyntaxflow ¶
func QuerySyntaxflow(opt ...QueryOption) (*SyntaxFlowResult, error)
func (*SyntaxFlowResult) CreateRisk ¶
func (r *SyntaxFlowResult) CreateRisk() error
func (*SyntaxFlowResult) Dump ¶
func (r *SyntaxFlowResult) Dump(showCode bool) string
func (*SyntaxFlowResult) DumpValuesJson ¶
func (r *SyntaxFlowResult) DumpValuesJson(name string) string
func (*SyntaxFlowResult) GetAlertInfo ¶
func (r *SyntaxFlowResult) GetAlertInfo(name string) (*schema.SyntaxFlowDescInfo, bool)
func (*SyntaxFlowResult) GetAlertMsg ¶
func (r *SyntaxFlowResult) GetAlertMsg(name string) (string, bool)
func (*SyntaxFlowResult) GetAlertValue ¶
func (r *SyntaxFlowResult) GetAlertValue(name string) Values
func (*SyntaxFlowResult) GetAlertValues ¶
func (r *SyntaxFlowResult) GetAlertValues() *omap.OrderedMap[string, Values]
func (*SyntaxFlowResult) GetAlertVariables ¶
func (r *SyntaxFlowResult) GetAlertVariables() []string
Alert value
func (*SyntaxFlowResult) GetAllValuesChain ¶
func (r *SyntaxFlowResult) GetAllValuesChain() Values
func (*SyntaxFlowResult) GetAllVariable ¶
func (r *SyntaxFlowResult) GetAllVariable() *orderedmap.OrderedMap
func (*SyntaxFlowResult) GetCheckMsg ¶
func (r *SyntaxFlowResult) GetCheckMsg() []string
func (*SyntaxFlowResult) GetErrors ¶
func (r *SyntaxFlowResult) GetErrors() []string
func (*SyntaxFlowResult) GetFileCount ¶
func (r *SyntaxFlowResult) GetFileCount() int
func (*SyntaxFlowResult) GetGRPCModelResult ¶
func (r *SyntaxFlowResult) GetGRPCModelResult() *ypb.SyntaxFlowResult
func (*SyntaxFlowResult) GetGRPCModelRisk ¶
func (r *SyntaxFlowResult) GetGRPCModelRisk() []*ypb.SSARisk
func (*SyntaxFlowResult) GetLineCount ¶
func (r *SyntaxFlowResult) GetLineCount() int
func (*SyntaxFlowResult) GetProgramLang ¶
func (r *SyntaxFlowResult) GetProgramLang() ssaconfig.Language
func (*SyntaxFlowResult) GetProgramName ¶
func (r *SyntaxFlowResult) GetProgramName() string
func (*SyntaxFlowResult) GetResultID ¶
func (r *SyntaxFlowResult) GetResultID() uint
func (*SyntaxFlowResult) GetResultSaveKind ¶
func (r *SyntaxFlowResult) GetResultSaveKind() ssaconfig.SFResultSaveKind
func (*SyntaxFlowResult) GetRiskByValue ¶
func (r *SyntaxFlowResult) GetRiskByValue(variable string, i int) *schema.SSARisk
func (*SyntaxFlowResult) GetRiskCountMap ¶
func (r *SyntaxFlowResult) GetRiskCountMap() map[string]int64
func (*SyntaxFlowResult) GetRiskHash ¶
func (r *SyntaxFlowResult) GetRiskHash(variable string, i int) string
func (*SyntaxFlowResult) GetRule ¶
func (r *SyntaxFlowResult) GetRule() *schema.SyntaxFlowRule
func (*SyntaxFlowResult) GetSFResult ¶
func (r *SyntaxFlowResult) GetSFResult() *sfvm.SFFrameResult
func (*SyntaxFlowResult) GetUnNameValues ¶
func (r *SyntaxFlowResult) GetUnNameValues() Values
UnName value
func (*SyntaxFlowResult) GetValue ¶
func (r *SyntaxFlowResult) GetValue(name string, index int) (*Value, error)
func (*SyntaxFlowResult) GetValueCount ¶
func (r *SyntaxFlowResult) GetValueCount(name string) int
func (*SyntaxFlowResult) GetValues ¶
func (r *SyntaxFlowResult) GetValues(name string) Values
Normal value
func (*SyntaxFlowResult) GetVariableNum ¶
func (r *SyntaxFlowResult) GetVariableNum() int
func (*SyntaxFlowResult) IsDatabase ¶
func (r *SyntaxFlowResult) IsDatabase() bool
func (*SyntaxFlowResult) IsLib ¶
func (r *SyntaxFlowResult) IsLib() bool
func (*SyntaxFlowResult) IsProgMemoryCompile ¶
func (r *SyntaxFlowResult) IsProgMemoryCompile() bool
IsProgMemoryCompile 判断program是否是内存编译的
func (*SyntaxFlowResult) Name ¶
func (r *SyntaxFlowResult) Name() string
func (*SyntaxFlowResult) RiskCount ¶
func (r *SyntaxFlowResult) RiskCount() int
func (*SyntaxFlowResult) Save ¶
func (r *SyntaxFlowResult) Save(kind schema.SyntaxflowResultKind, TaskIDs ...string) (uint, error)
func (*SyntaxFlowResult) SaveWithContext ¶
func (r *SyntaxFlowResult) SaveWithContext(ctx context.Context, kind schema.SyntaxflowResultKind, TaskIDs ...string) (uint, error)
func (*SyntaxFlowResult) SetResultID ¶
func (r *SyntaxFlowResult) SetResultID(id uint)
func (*SyntaxFlowResult) Show ¶
func (r *SyntaxFlowResult) Show(opts ...sfvm.ShowOption)
func (*SyntaxFlowResult) String ¶
func (r *SyntaxFlowResult) String(opts ...sfvm.ShowOption) string
func (*SyntaxFlowResult) YieldRisk ¶
func (r *SyntaxFlowResult) YieldRisk() chan *schema.SSARisk
type Value ¶
type Value struct {
ParentProgram *Program
EffectOn *utils.SafeMapWithKey[string, *Value]
DependOn *utils.SafeMapWithKey[string, *Value]
// for syntaxflow vm
Predecessors []*PredecessorValue
DescInfo map[string]string
// contains filtered or unexported fields
}
func FullUseDefChain ¶ added in v1.3.1
func FullUseDefChain(value *Value, opts ...OperationOption) *Value
func (*Value) AppendDependOn ¶ added in v1.3.1
func (*Value) AppendEffectOn ¶ added in v1.3.1
func (*Value) AppendPredecessor ¶
func (v *Value) AppendPredecessor(operator sfvm.ValueOperator, opts ...sfvm.AnalysisContextOption) error
func (*Value) Backtrack ¶ added in v1.3.1
func (v *Value) Backtrack() *omap.OrderedMap[string, *Value]
func (*Value) CompareConst ¶
func (v *Value) CompareConst(comparator *sfvm.ConstComparator) []bool
func (*Value) CompareOpcode ¶
func (v *Value) CompareOpcode(comparator *sfvm.OpcodeComparator) (sfvm.ValueOperator, []bool)
func (*Value) CompareString ¶
func (v *Value) CompareString(items *sfvm.StringComparator) (sfvm.ValueOperator, []bool)
func (*Value) EffectOnCount ¶
func (*Value) ExactMatch ¶ added in v1.3.3
func (*Value) FileFilter ¶
func (*Value) FlexibleDepends ¶ added in v1.3.1
FlexibleDepends is used to get all the dependencies of the value e.g: a = b + c; d = a + e; the e is not filled in the depends of a, but call FlexibleDepends will get it
func (*Value) ForEachDependOn ¶
func (*Value) ForEachEffectOn ¶
func (*Value) GetAllMember ¶ added in v1.3.1
GetAllMember get all member of object
func (*Value) GetAllVariables ¶ added in v1.3.3
func (*Value) GetAuditNodeId ¶
func (*Value) GetBinaryOperator ¶
func (*Value) GetBottomUses ¶ added in v1.3.0
func (v *Value) GetBottomUses(opt ...OperationOption) (ret Values)
func (*Value) GetCallActualParams ¶ added in v1.3.3
func (*Value) GetCallArgs ¶ added in v1.3.0
func (*Value) GetCallReturns ¶ added in v1.3.0
func (*Value) GetCalledBy ¶ added in v1.3.0
func (*Value) GetCallee ¶ added in v1.3.0
GetCallee desc any of 'Users' is Call return the first Call, if `risk.New()`, GetCallee will return `risk.New`.
func (*Value) GetConstValue ¶ added in v1.2.9
for const instruction
func (*Value) GetContextValue ¶ added in v1.3.0
GetContextValue can handle context
func (*Value) GetDataflowPath ¶
func (*Value) GetDependOn ¶
func (*Value) GetDependOnCount ¶
func (*Value) GetDependOnPath ¶
func (*Value) GetEffectOn ¶
func (*Value) GetEffectOnPath ¶
func (*Value) GetFreeValue ¶
func (*Value) GetFunction ¶
func (*Value) GetFunctionObjectType ¶ added in v1.3.3
func (*Value) GetGraphInfo ¶
func (*Value) GetInnerValueVerboseName ¶
func (*Value) GetMembers ¶
GetAllMember get member keys and values
func (*Value) GetMembersByString ¶ added in v1.3.3
func (v *Value) GetMembersByString(key string) (sfvm.ValueOperator, bool)
func (*Value) GetOperand ¶
func (*Value) GetOperands ¶
func (*Value) GetParameter ¶
func (*Value) GetParameters ¶ added in v1.2.9
func (*Value) GetPointer ¶
func (*Value) GetPredecessors ¶
func (v *Value) GetPredecessors() []*PredecessorValue
func (*Value) GetProgramName ¶
func (*Value) GetReachable ¶
func (*Value) GetReference ¶
func (*Value) GetSSAInst ¶
func (v *Value) GetSSAInst() ssa.Instruction
func (*Value) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowBottomUse(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Value) GetSyntaxFlowDef ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
func (*Value) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowTopDef(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (*Value) GetSyntaxFlowUse ¶ added in v1.3.3
func (v *Value) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
func (*Value) GetTopDefs ¶ added in v1.3.0
func (i *Value) GetTopDefs(opt ...OperationOption) (ret Values)
GetTopDefs desc all of 'Defs' is not used by any other value
func (*Value) GetTypeKind ¶ added in v1.2.9
func (*Value) GetUnaryOperator ¶
func (*Value) GetVariable ¶ added in v1.3.3
for variable
func (*Value) GetVerboseName ¶ added in v1.3.1
func (*Value) HasOperands ¶
func (*Value) InMainFunction ¶
func (*Value) IsBasicBlock ¶
func (*Value) IsConstInst ¶
func (*Value) IsErrorHandler ¶
func (*Value) IsExternLib ¶ added in v1.3.1
IsExternLib desc if the value is extern lib
extern-lib is a special value that is used to represent the external library
code := `a = fmt.Println`
fmt := prog.Ref("fmt") // extern-lib
fmt.GetOperands() // Values // [Function-Println]
func (*Value) IsFreeValue ¶ added in v1.3.3
func (*Value) IsFromDataBase ¶
func (*Value) IsFunction ¶
func (*Value) IsModifySelf ¶ added in v1.2.9
func (*Value) IsParameter ¶ added in v1.2.9
func (*Value) IsParameterMember ¶ added in v1.3.3
func (*Value) IsReachable ¶
func (v *Value) IsReachable() ssa.BasicBlockReachableKind
func (*Value) IsSideEffect ¶
func (*Value) IsTypeCast ¶
func (*Value) IsTypeValue ¶
func (*Value) IsUndefined ¶
func (*Value) ListIndex ¶ added in v1.3.3
func (v *Value) ListIndex(i int) (sfvm.ValueOperator, error)
func (*Value) LoadFullUseDefChain ¶ added in v1.3.1
func (*Value) Merge ¶
func (v *Value) Merge(sf ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
func (*Value) NewDotGraph ¶
func (*Value) NewValue ¶ added in v1.3.3
func (v *Value) NewValue(value ssa.Instruction) *Value
normal from ssa value
func (*Value) NewValueFromAuditNode ¶
from audit node id
func (*Value) Recursive ¶ added in v1.3.3
func (v *Value) Recursive(f func(operator sfvm.ValueOperator) error) error
func (*Value) RecursiveDepends ¶ added in v1.3.1
RecursiveDepends is used to get all the dependencies of the value
func (*Value) RecursiveDependsAndEffects ¶ added in v1.3.1
func (*Value) RecursiveEffects ¶ added in v1.3.1
RecursiveEffects is used to get all the effects of the value
func (*Value) RegexpMatch ¶ added in v1.3.3
func (*Value) Remove ¶
func (v *Value) Remove(sf ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
func (*Value) RemoveDependOn ¶
func (*Value) RemoveEffectOn ¶
func (*Value) SetContextValue ¶ added in v1.3.0
func (*Value) ShortString ¶ added in v1.3.1
func (*Value) ShowBacktrack ¶ added in v1.3.1
func (v *Value) ShowBacktrack()
func (*Value) ShowUseDefChain ¶
func (v *Value) ShowUseDefChain()
func (*Value) ShowWithRange ¶
func (*Value) ShowWithSourceCode ¶
func (*Value) StringWithRange ¶
func (*Value) StringWithSourceCode ¶
type Values ¶
type Values []*Value
func DataFlowWithSFConfig ¶
func DataFlowWithSFConfig( sfResult *sf.SFFrameResult, config *sf.Config, value *Value, analysisType AnalysisType, opts ...*sf.RecursiveConfigItem, ) Values
func FindFlexibleCommonDepends ¶ added in v1.3.1
FindFlexibleCommonDepends 在给定的值集合中查找具有灵活共同依赖的值。
FindFlexibleCommonDepends searches for values with flexible common dependencies in the given collection of values.
它与 FindStrictCommonDepends 类似,但在查找共同依赖时,会尝试重新构建值的顶层定义。
It is similar to FindStrictCommonDepends, but when searching for common dependencies, it attempts to rebuild the top-level definition of values.
具有灵活共同依赖的值是指通过重新构建顶层定义,从而可能包括更多的依赖关系。
Values with flexible common dependencies are those that may include more dependencies by rebuilding the top-level definition.
func FindFlexibleDependsIntersection ¶ added in v1.3.3
func FindFlexibleDependsIntersection(root Values, element Values, opts ...OperationOption) Values
FindFlexibleDependsIntersection searches for intersections between flexible dependencies of the root collection and elements from the target collection, returning matched elements.
FindFlexibleDependsIntersection 搜索根集合中的灵活依赖与目标集合中元素的交集,并返回匹配的元素。
这个函数是 ExtractTopDefsIntersection 的一个封装,专门用于处理灵活依赖关系。 This function is a wrapper around ExtractTopDefsIntersection, specifically tailored for handling flexible dependencies.
它接收三个参数:root(根集合),element(目标集合),以及可选的 opts(操作选项)。 It takes three parameters: root (the root collection), element (the target collection), and optionally opts (operation options).
通过将灵活依赖的特定处理逻辑传递给 ExtractTopDefsIntersection,该函数利用已有的逻辑 来检查和返回交集元素。 By passing specific handling logic for flexible dependencies to ExtractTopDefsIntersection, this function leverages existing logic to check and return intersecting elements.
使用此函数可以灵活地处理不同类型的依赖关系,如在计算或数据分析场景中常见的依赖查找。 Using this function allows flexible handling of different types of dependencies, commonly seen in computing or data analysis scenarios.
func FindStrictCommonDepends ¶ added in v1.3.1
FindStrictCommonDepends 在给定的值集合中查找具有严格共同依赖的值。
FindStrictCommonDepends searches for values with strictly common dependencies in the given collection of values.
它遍历给定的值集合,比较每对值之间的依赖关系,并返回所有具有严格共同依赖的值的集合。
It iterates over the given collection of values, compares the dependencies between each pair of values, and returns a collection of all values with strictly common dependencies.
严格共同依赖是指只有当值 A 依赖于值 B,而值 B 也依赖于值 A 时,这两个值才被认为具有严格共同依赖。
Strict common dependencies refer to the scenario where value A depends on value B, and value B depends on value A for them to be considered to have strict common dependencies.
func MergeValues ¶
func SFValueListToValues ¶ added in v1.3.3
func SearchWithCFG ¶
func SearchWithValue ¶
func SyntaxFlowVariableToValues ¶
func SyntaxFlowVariableToValues(vs ...sfvm.ValueOperator) Values
func (Values) AppendDependOn ¶ added in v1.3.1
func (Values) AppendEffectOn ¶ added in v1.3.1
func (Values) AppendPredecessor ¶
func (value Values) AppendPredecessor(operator sfvm.ValueOperator, opts ...sfvm.AnalysisContextOption) error
func (Values) CompareConst ¶
func (v Values) CompareConst(comparator *sfvm.ConstComparator) []bool
func (Values) CompareOpcode ¶
func (v Values) CompareOpcode(comparator *sfvm.OpcodeComparator) (sfvm.ValueOperator, []bool)
func (Values) CompareString ¶
func (v Values) CompareString(comparator *sfvm.StringComparator) (sfvm.ValueOperator, []bool)
func (Values) ExactMatch ¶ added in v1.3.3
func (Values) ExtractTopDefsIntersection ¶ added in v1.3.3
func (value Values) ExtractTopDefsIntersection(targets Values, opts ...OperationOption) Values
ExtractTopDefsIntersection explores the possibility of top-level definitions in the caller's elements including elements from the target collection and returns them if found.
ExtractTopDefsIntersection 寻找调用者中的顶级定义过程包含目标元素的可能性,如果找到则直接返回。
该函数通过遍历调用者集合中的每一个元素,检查其顶级定义是否与目标集合中的某个元素匹配。 This function iterates through each element in the caller's collection to check if its top-level definitions match any of the elements in the target collection.
func (Values) FileFilter ¶
func (vs Values) FileFilter(path string, match string, rule map[string]string, rule2 []string) (sfvm.ValueOperator, error)
func (value Values) FileFilter(string, string, map[string]string, []string) (sfvm.ValueOperator, error) {
func (Values) FlexibleDepends ¶ added in v1.3.1
func (Values) FullUseDefChain ¶ added in v1.3.1
func (Values) GetBinaryOperator ¶
func (Values) GetBottomUses ¶ added in v1.3.1
func (v Values) GetBottomUses(opts ...OperationOption) Values
func (Values) GetBySyntaxFlowName ¶
func (Values) GetCallActualParams ¶ added in v1.3.3
func (Values) GetCalled ¶ added in v1.3.3
func (value Values) GetCalled() (sfvm.ValueOperator, error)
func (Values) GetDataflowPath ¶
func (Values) GetMembersByString ¶ added in v1.3.3
func (value Values) GetMembersByString(key string) (sfvm.ValueOperator, error)
func (Values) GetOperands ¶ added in v1.3.1
func (Values) GetSyntaxFlowBottomUse ¶ added in v1.3.3
func (value Values) GetSyntaxFlowBottomUse(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (Values) GetSyntaxFlowDef ¶ added in v1.3.3
func (value Values) GetSyntaxFlowDef() (sfvm.ValueOperator, error)
func (Values) GetSyntaxFlowTopDef ¶ added in v1.3.3
func (value Values) GetSyntaxFlowTopDef(sfResult *sfvm.SFFrameResult, sfConfig *sfvm.Config, config ...*sfvm.RecursiveConfigItem) (sfvm.ValueOperator, error)
func (Values) GetSyntaxFlowUse ¶ added in v1.3.3
func (value Values) GetSyntaxFlowUse() (sfvm.ValueOperator, error)
func (Values) GetTopDefs ¶ added in v1.3.0
func (v Values) GetTopDefs(opts ...OperationOption) Values
func (Values) GetUnaryOperator ¶
func (Values) ListIndex ¶ added in v1.3.3
func (value Values) ListIndex(i int) (sfvm.ValueOperator, error)
func (Values) Merge ¶
func (vs Values) Merge(sf ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
func (Values) NewDotGraph ¶
func (Values) Recursive ¶ added in v1.3.3
func (value Values) Recursive(f func(operator sfvm.ValueOperator) error) error
func (Values) RegexpMatch ¶ added in v1.3.3
func (Values) Remove ¶
func (value Values) Remove(values ...sfvm.ValueOperator) (sfvm.ValueOperator, error)
func (Values) ShowWithSource ¶
Source Files
¶
- analyze_context.go
- analyze_cross_process.go
- doc.go
- dominator_tree.go
- exclusive_config.go
- exclusive_z_bottom_use.go
- exclusive_z_misc.go
- exclusive_z_top_defs.go
- function_graph.go
- log.go
- misc.go
- position.go
- program.go
- sf_config.go
- sf_dataflow.go
- sf_file_filter_xml.go
- sf_native_call.go
- sf_native_call_blueprint.go
- sf_native_call_code.go
- sf_native_call_doc.go
- sf_native_call_eval.go
- sf_native_call_freeMarker.go
- sf_native_call_include.go
- sf_native_call_name.go
- sf_native_call_sanitize_names.go
- sf_native_call_scan.go
- sf_native_call_util.go
- sf_native_call_xml.go
- sf_prog.go
- sf_query.go
- sf_result.go
- sf_result_risk.go
- sf_result_save.go
- sf_result_value.go
- sf_result_verbose.go
- sf_search.go
- sf_utils.go
- sf_value.go
- sf_values.go
- ssa_compile.go
- ssa_compile_fs.go
- ssa_compile_info.go
- ssa_compile_init.go
- ssa_compile_project.go
- ssa_compile_utils.go
- ssa_config.go
- ssa_exports.go
- ssa_load_program.go
- ssa_recompile.go
- type.go
- use_def_chain.go
- values.go
- values_contains.go
- values_db.go
- values_graph.go
- values_graph_backtrack.go
- values_graph_dot.go
- values_graph_info.go
- values_graph_path.go