chains-project / GoSurface

Static analyzer to find locations to hide malicious code in Go
0 stars 0 forks source link

CGO parser #3

Closed vivi365 closed 1 month ago

vivi365 commented 1 month ago

All C function calls from Go are done via the C package C.someCFunction(). Thus it seems we can just look for the C identity.

if pkg, ok := sel.X.(*ast.Ident); ok && pkg.Name == "C" 

Have not tested thoroughly yet, only on the POC.