Documentation ¶
Index ¶
- Constants
- Variables
- func FetchPassThrough(passThroughContainer *map[string][][]int, src []string) error
- func PersistCallGraph(edges *map[string]*Edge, dst string) error
- func PersistPassThrough(passThroughContainer *map[string][][]int, dst string) error
- func PersistToNeo4j(nodes *map[string]*Node, edges *map[string]*Edge, uri string, username string, ...)
- func Run(f *ssa.Function, c *TaintConfig)
- type CallGraph
- type DummyRuler
- type Edge
- type Imethod
- type InterfaceHierarchy
- type Node
- type Runner
- type TaintAnalysis
- func (a *TaintAnalysis) Computations() int
- func (a *TaintAnalysis) End(universe []*entry.Entry)
- func (a *TaintAnalysis) FlowThrougth(inMap *map[any]any, unit ssa.Instruction, outMap *map[any]any)
- func (a *TaintAnalysis) MergeInto(unit ssa.Instruction, inout *map[any]any, in *map[any]any)
- func (a *TaintAnalysis) NewInitalFlow() *map[any]any
- type TaintConfig
- type TaintSwitcher
- func (s *TaintSwitcher) CaseAlloc(inst *ssa.Alloc)
- func (s *TaintSwitcher) CaseBinOp(inst *ssa.BinOp)
- func (s *TaintSwitcher) CaseCall(inst *ssa.Call)
- func (s *TaintSwitcher) CaseChangeInterface(inst *ssa.ChangeInterface)
- func (s *TaintSwitcher) CaseChangeType(inst *ssa.ChangeType)
- func (s *TaintSwitcher) CaseConvert(inst *ssa.Convert)
- func (s *TaintSwitcher) CaseExtract(inst *ssa.Extract)
- func (s *TaintSwitcher) CaseField(inst *ssa.Field)
- func (s *TaintSwitcher) CaseFieldAddr(inst *ssa.FieldAddr)
- func (s *TaintSwitcher) CaseIndex(inst *ssa.Index)
- func (s *TaintSwitcher) CaseIndexAddr(inst *ssa.IndexAddr)
- func (s *TaintSwitcher) CaseLookup(inst *ssa.Lookup)
- func (s *TaintSwitcher) CaseMakeChan(inst *ssa.MakeChan)
- func (s *TaintSwitcher) CaseMakeClosure(inst *ssa.MakeClosure)
- func (s *TaintSwitcher) CaseMakeInterface(inst *ssa.MakeInterface)
- func (s *TaintSwitcher) CaseMakeMap(inst *ssa.MakeMap)
- func (s *TaintSwitcher) CaseMakeSlice(inst *ssa.MakeSlice)
- func (s *TaintSwitcher) CaseMapUpdate(inst *ssa.MapUpdate)
- func (s *TaintSwitcher) CaseNext(inst *ssa.Next)
- func (s *TaintSwitcher) CasePhi(inst *ssa.Phi)
- func (s *TaintSwitcher) CaseRange(inst *ssa.Range)
- func (s *TaintSwitcher) CaseReturn(inst *ssa.Return)
- func (s *TaintSwitcher) CaseSelect(inst *ssa.Select)
- func (s *TaintSwitcher) CaseSend(inst *ssa.Send)
- func (s *TaintSwitcher) CaseSlice(inst *ssa.Slice)
- func (s *TaintSwitcher) CaseStore(inst *ssa.Store)
- func (s *TaintSwitcher) CaseTypeAssert(inst *ssa.TypeAssert)
- func (s *TaintSwitcher) CaseUnOp(inst *ssa.UnOp)
Constants ¶
const PrintBody = ""
PrintBody represents the name of the function should be printed
const Store = "gostd.json"
Store represents the path of the passthrough data
Variables ¶
var Gostd = []string{"archive...", "bufio...", "builtin...", "bytes...",
"compress...", "container...", "context...", "crypto...",
"database...", "debug...", "embed...", "encoding...", "errors...", "expvar...",
"flag...", "fmt...", "go...", "hash...", "html...",
"image...", "index...", "io...", "log...", "math...", "mime...",
"net...", "os...", "path...", "plugin...", "relect...", "regexp...", "runtime...",
"sort...", "strconv...", "strings...", "sync...", "syscall...",
"text...", "time...", "unicode...", "unsafe..."}
Gostd reprents all go standard library's PkgPath
Functions ¶
func FetchPassThrough ¶ added in v0.0.13
FetchPassThrough loads passthrougth data from target source
func PersistCallGraph ¶ added in v0.0.13
PersistCallGraph stores passthrough data to target destination
func PersistPassThrough ¶ added in v0.0.13
PersistPassThrough stores passthrough data to target destination
func PersistToNeo4j ¶ added in v0.0.14
func Run ¶ added in v0.0.13
func Run(f *ssa.Function, c *TaintConfig)
Run kicks off a taint analysis on a function
Types ¶
type DummyRuler ¶ added in v0.0.13
DummyRuler is a dummy rule.Ruler used for test
type Edge ¶ added in v0.0.13
type Edge struct { From string FromIndex int To string ToIndex int ToIsMethod bool ToIsSink bool ToIsSignature bool ToIsStatic bool }
Edge represents a taint edge
type Imethod ¶ added in v0.0.13
Imethod represents an interface method I.m. (There's no go/types object for it; a *types.Func may be shared by many interfaces due to interface embedding.)
type InterfaceHierarchy ¶ added in v0.0.13
type InterfaceHierarchy struct {
// contains filtered or unexported fields
}
InterfaceHierarchy represents implemetation relations
func NewInterfaceHierarchy ¶ added in v0.0.13
func NewInterfaceHierarchy(allFuncs *map[*ssa.Function]bool) *InterfaceHierarchy
NewInterfaceHierarchy returns an InterfaceHierarchy
func (*InterfaceHierarchy) LookupFuncs ¶ added in v0.0.13
func (i *InterfaceHierarchy) LookupFuncs(signature *types.Signature) []*ssa.Function
LookupFuncs returns *ssa.Function that have same signature
func (*InterfaceHierarchy) LookupMethods ¶ added in v0.0.13
LookupMethods returns an interface method's implemetations
type Node ¶ added in v0.0.13
type Node struct { IsSignature bool IsMethod bool IsStatic bool IsSource bool IsSink bool IsIntra bool Canonical string Index int Out []*Edge In []*Edge }
Node represents a taint node
type Runner ¶ added in v0.0.13
type Runner struct { ModuleName string PkgPath []string Debug bool InitOnly bool PassThroughOnly bool PassThroughSrcPath []string PassThroughDstPath string CallGraphDstPath string Ruler rule.Ruler PersistToNeo4j bool Neo4jUsername string Neo4jPassword string Neo4jURI string }
Runner represents a analysis runner
type TaintAnalysis ¶ added in v0.0.13
type TaintAnalysis struct { scalar.BaseFlowAnalysis // contains filtered or unexported fields }
TaintAnalysis represents a taint analysis
func New ¶ added in v0.0.13
func New(g *graph.UnitGraph, c *TaintConfig) *TaintAnalysis
New creates a TaintAnalysis
func (*TaintAnalysis) Computations ¶ added in v0.0.13
func (a *TaintAnalysis) Computations() int
Computations limits number of computations on a flow graph
func (*TaintAnalysis) End ¶ added in v0.0.13
func (a *TaintAnalysis) End(universe []*entry.Entry)
End handles result of analysis
func (*TaintAnalysis) FlowThrougth ¶ added in v0.0.13
func (a *TaintAnalysis) FlowThrougth(inMap *map[any]any, unit ssa.Instruction, outMap *map[any]any)
FlowThrougth calculates outMap based on inMap and unit
func (*TaintAnalysis) MergeInto ¶ added in v0.0.13
func (a *TaintAnalysis) MergeInto(unit ssa.Instruction, inout *map[any]any, in *map[any]any)
MergeInto merges from in to inout based on unit
func (*TaintAnalysis) NewInitalFlow ¶ added in v0.0.13
func (a *TaintAnalysis) NewInitalFlow() *map[any]any
NewInitalFlow returns a new flow
type TaintConfig ¶ added in v0.0.13
type TaintConfig struct { PassThroughContainer *map[string][][]int InitMap *map[string]*ssa.Function History *map[string]bool InterfaceHierarchy *InterfaceHierarchy CallGraph *CallGraph Ruler rule.Ruler PassThroughOnly bool Debug bool }
TaintConfig represents a configuration for taint analysis
type TaintSwitcher ¶
type TaintSwitcher struct { switcher.BaseSwitcher // contains filtered or unexported fields }
TaintSwitcher represents a switcher for taint analysis
func (*TaintSwitcher) CaseAlloc ¶
func (s *TaintSwitcher) CaseAlloc(inst *ssa.Alloc)
CaseAlloc accepts a Alloc instruction
func (*TaintSwitcher) CaseBinOp ¶
func (s *TaintSwitcher) CaseBinOp(inst *ssa.BinOp)
CaseBinOp accepts a BinOp instruction
func (*TaintSwitcher) CaseCall ¶
func (s *TaintSwitcher) CaseCall(inst *ssa.Call)
CaseCall accepts a Call instruction
func (*TaintSwitcher) CaseChangeInterface ¶
func (s *TaintSwitcher) CaseChangeInterface(inst *ssa.ChangeInterface)
CaseChangeInterface accepts a ChangeInterface instruction
func (*TaintSwitcher) CaseChangeType ¶
func (s *TaintSwitcher) CaseChangeType(inst *ssa.ChangeType)
CaseChangeType accepts a ChangeType instruction
func (*TaintSwitcher) CaseConvert ¶
func (s *TaintSwitcher) CaseConvert(inst *ssa.Convert)
CaseConvert accepts a Convert instruction
func (*TaintSwitcher) CaseExtract ¶
func (s *TaintSwitcher) CaseExtract(inst *ssa.Extract)
CaseExtract accepts a Extract instruction
func (*TaintSwitcher) CaseField ¶
func (s *TaintSwitcher) CaseField(inst *ssa.Field)
CaseField accepts a Field instruction
func (*TaintSwitcher) CaseFieldAddr ¶
func (s *TaintSwitcher) CaseFieldAddr(inst *ssa.FieldAddr)
CaseFieldAddr accepts a FieldAddr instruction
func (*TaintSwitcher) CaseIndex ¶
func (s *TaintSwitcher) CaseIndex(inst *ssa.Index)
CaseIndex accepts an Index instruction
func (*TaintSwitcher) CaseIndexAddr ¶
func (s *TaintSwitcher) CaseIndexAddr(inst *ssa.IndexAddr)
CaseIndexAddr accepts an IndexAddr instruction
func (*TaintSwitcher) CaseLookup ¶
func (s *TaintSwitcher) CaseLookup(inst *ssa.Lookup)
CaseLookup accepts a Lookup instruction
func (*TaintSwitcher) CaseMakeChan ¶
func (s *TaintSwitcher) CaseMakeChan(inst *ssa.MakeChan)
CaseMakeChan accepts a MakeChan instruction
func (*TaintSwitcher) CaseMakeClosure ¶
func (s *TaintSwitcher) CaseMakeClosure(inst *ssa.MakeClosure)
CaseMakeClosure accepts a MakeClosure instruction
func (*TaintSwitcher) CaseMakeInterface ¶
func (s *TaintSwitcher) CaseMakeInterface(inst *ssa.MakeInterface)
CaseMakeInterface accepts a MakeInterface instruction
func (*TaintSwitcher) CaseMakeMap ¶
func (s *TaintSwitcher) CaseMakeMap(inst *ssa.MakeMap)
CaseMakeMap accepts a MakeMap instruction
func (*TaintSwitcher) CaseMakeSlice ¶
func (s *TaintSwitcher) CaseMakeSlice(inst *ssa.MakeSlice)
CaseMakeSlice accepts a MakeSlice instruction
func (*TaintSwitcher) CaseMapUpdate ¶
func (s *TaintSwitcher) CaseMapUpdate(inst *ssa.MapUpdate)
CaseMapUpdate accepts a MapUpdate instruction
func (*TaintSwitcher) CaseNext ¶
func (s *TaintSwitcher) CaseNext(inst *ssa.Next)
CaseNext accepts a Next instruction
func (*TaintSwitcher) CasePhi ¶
func (s *TaintSwitcher) CasePhi(inst *ssa.Phi)
CasePhi accepts a Phi instruction
func (*TaintSwitcher) CaseRange ¶
func (s *TaintSwitcher) CaseRange(inst *ssa.Range)
CaseRange accepts a Range instruction
func (*TaintSwitcher) CaseReturn ¶
func (s *TaintSwitcher) CaseReturn(inst *ssa.Return)
CaseReturn accepts a Return instruction
func (*TaintSwitcher) CaseSelect ¶
func (s *TaintSwitcher) CaseSelect(inst *ssa.Select)
CaseSelect accepts a Select instruction
func (*TaintSwitcher) CaseSend ¶
func (s *TaintSwitcher) CaseSend(inst *ssa.Send)
CaseSend accepts a Send instruction
func (*TaintSwitcher) CaseSlice ¶
func (s *TaintSwitcher) CaseSlice(inst *ssa.Slice)
CaseSlice accepts a Slice instruction
func (*TaintSwitcher) CaseStore ¶
func (s *TaintSwitcher) CaseStore(inst *ssa.Store)
CaseStore accepts a Store instruction
func (*TaintSwitcher) CaseTypeAssert ¶
func (s *TaintSwitcher) CaseTypeAssert(inst *ssa.TypeAssert)
CaseTypeAssert accepts a TypeAssert instruction
func (*TaintSwitcher) CaseUnOp ¶
func (s *TaintSwitcher) CaseUnOp(inst *ssa.UnOp)
CaseUnOp accepts a UnOp instruction