Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Golang module support [WIP] #10758
Welcome to a Derbycon special addition. With so many laptops around, I couldn't resist fiddling with mine!
This adds initial support for Go as a language for Metasploit modules. It implements just-enough of the API to support the 'description' and 'run' actions. Since Go is a compiled language, this implementation uses a trick in most shells where the lack of a #! indicates that /bin/sh should be run, and uses that // is treated as /. Since // is also a comment in the Go language, it is subsequently ignored by the compiler, and it remains fully compatible go syntax.
The specific API for the 'metasploit' module is subject to change. Since Golang supports compile-time type checking, this means that metadata and options passed to report methods can support the same, so I am in the process of converting them to use method-specific structs for parameter passing instead of a map[string]string.
Feel free to play with the test.go module, this shouldn't use anything too fancy or outside of the standard go library. I do not believe this causes any side-effects of trying to write to the metasploit-framework source tree during the compile phase (
Let me know if there are any comments or suggestions; looking forward to completing the first golang port of a scanner module after this.