mirror of
https://github.com/thunderbrewhq/binana.git
synced 2026-05-02 20:54:03 +00:00
feat(go): prevent auto-analysis symbols from loading into either IDA or Ghidra symbol table
This commit is contained in:
parent
07cb5c543a
commit
9a4ffe31a5
2 changed files with 18 additions and 1 deletions
|
|
@ -3,6 +3,8 @@ package profile
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/thunderbrewhq/binana/go/symbols"
|
||||||
)
|
)
|
||||||
|
|
||||||
func compile_ghidra_artifacts(profile *Profile, params *CompileArtifactsParams) (err error) {
|
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 {
|
if err != nil {
|
||||||
return
|
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()
|
symbol_file.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,11 @@ func compile_idapro_artifacts(profile *Profile, params *CompileArtifactsParams)
|
||||||
name_instances := make(map[string]int)
|
name_instances := make(map[string]int)
|
||||||
|
|
||||||
for symbol := range profile.Symbols.Entries() {
|
for symbol := range profile.Symbols.Entries() {
|
||||||
|
if symbol.Symbol.Auto {
|
||||||
|
// Ignore auto-analysis symbols
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
name := symbol.Symbol.Name
|
name := symbol.Symbol.Name
|
||||||
instances := name_instances[name]
|
instances := name_instances[name]
|
||||||
name_instances[name] = instances + 1
|
name_instances[name] = instances + 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue