solution to "syscall.Mprotect panic: permission denied" in Golang on macOS Catalina 10.15.x when using gomonkey or gohook
Change the max_prot
value to 0x7
after linking.
refer to the question: https://stackoverflow.com/questions/60654834/using-mprotect-to-make-text-segment-writable-on-macos
Assuming Go is installed in /opt/go
- Navigate to Path:
/opt/go/pkg/tool/darwin_amd64
- Rename file
link
tooriginal_link
- Download link wrapper for replacement
- Make sure link wrapper is executable:
chmod +x link
- Enjoy it
Thanks to Elliott Darfink for sharing.