Skip to content

Commit 07af6d2

Browse files
Create BOF_SCANNER.go
1 parent 2c7683a commit 07af6d2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

BOF_SCANNER.go

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package main
2+
3+
import (
4+
"debug/gosym"
5+
"debug/macho"
6+
"fmt"
7+
"log"
8+
)
9+
10+
func main() {
11+
// Open the binary file
12+
f, err := macho.Open("program.bin")
13+
if err != nil {
14+
log.Fatal(err)
15+
}
16+
defer f.Close()
17+
18+
// Create a new symbol table from the binary file
19+
symtab, err := gosym.NewTable(f)
20+
if err != nil {
21+
log.Fatal(err)
22+
}
23+
24+
// Iterate over the functions in the symbol table
25+
for _, f := range symtab.Funcs {
26+
// Check if the function has a buffer overflow vulnerability
27+
if hasBOFVulnerability(f, symtab) {
28+
fmt.Printf("Function %s has a buffer overflow vulnerability\n", f.Name)
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)