Here is a very basic golang program:
package main
import "fmt"
func main() {
var s1 string
fmt.Scanln(&s1)
if s1=="goodpassword" {
fmt.Println("Good")
} else {
fmt.Println("Wrong")
}
}
I have compiled this program (elf64 linux binary).
I have diasssembled the binary and i have found the addresses of the 2 fmt.Println calls:
...
0x00490d4f lea rax, obj.main.statictmp_1 ; wrong
...
0x00490d99 lea rax, obj.main.statictmp_0 ; good
...
Now, i have wrote this python program:
import angr
from angr.state_plugins import SimSystemPosix
p = angr.Project('./mybinary')
sm = p.factory.simulation_manager()
sm.explore(find= 0x00490d99, avoid= 0x00490d4f)
print(sm.found[0].posix.dumps(0))
I do not understand why angr does not return "goodpassword" string. I have something wrong but i do not understand what...
Thanks for your help