feat(go): prevent auto-analysis symbols from loading into either IDA or Ghidra symbol table

This commit is contained in:
phaneron 2026-04-08 09:06:12 -04:00
parent 07cb5c543a
commit 9a4ffe31a5
2 changed files with 18 additions and 1 deletions

View file

@ -3,6 +3,8 @@ package profile
import (
"os"
"path/filepath"
"github.com/thunderbrewhq/binana/go/symbols"
)
func compile_ghidra_artifacts(profile *Profile, params *CompileArtifactsParams) (err error) {
@ -15,8 +17,18 @@ func compile_ghidra_artifacts(profile *Profile, params *CompileArtifactsParams)
if err != nil {
return
}
// strip out autoanalysis symbols
var symbol_table symbols.Table
symbol_table.Init()
for entry := range profile.Symbols.Entries() {
if !entry.Symbol.Auto {
if err = symbol_table.Insert(entry); err != nil {
return
}
}
}
_, err = profile.Symbols.WriteTo(symbol_file)
_, err = symbol_table.WriteTo(symbol_file)
symbol_file.Close()
return
}

View file

@ -107,6 +107,11 @@ func compile_idapro_artifacts(profile *Profile, params *CompileArtifactsParams)
name_instances := make(map[string]int)
for symbol := range profile.Symbols.Entries() {
if symbol.Symbol.Auto {
// Ignore auto-analysis symbols
continue
}
name := symbol.Symbol.Name
instances := name_instances[name]
name_instances[name] = instances + 1