Why Use Go For Hacking
Prior to Go, you could prioritize ease of use by using dynamically typed languages-such as Python, Ruby, or PHP at the expense of performance and safety. Alternatively, you could use a statically typed programming language, like C or C++, that offers high performance and safety but isn’t very user-friendly. Go is stripped of much of the ugliness of C, its primary ancestor, making development more user-friendly. At the same time, it’s a statically typed language that produces syntax errors at compile time, increasing your assurance that your code will actually run safely. As it’s compiled, it performs more optimally than interpreted languages and was designed with multicore computing considerations, making concurrent programming a breeze.
These reasons for using Go don’t concern security practitioners specifically. However, many of the language’s features are particularly useful for hackers and adversaries:
Clean package management system Go’s package management solution is elegant and integrated directly with Go’s tooling. Through the use of the Go binary, you can easily download , compile, and install packages and dependencies, which makes consuming third-party libraries simple and generally free from conflict.
Cross-compilation One of the best features in Go is its ability to cross-compile executables. So long as your code doesn’t interact with raw C, you can easily write code on your Linux or Mac system but compile the code in a Windows-friendly, Portable Executable format.
Rich standard library Time spent developing in other languages has helped us appreciate the extent of Go’s standard library. Many modern languages lack the standard libraries required to perform many common tasks such as crypto, network communications, database connectivity, and data encoding (JSON, XML, Base64, hex). Go includes many of these critical functions and libraries as part of the language’s standard packaging, reducing the effort necessary to correctly set up your development environment or to call the functions.
Concurrency Unlike languages that have been around longer, Go was released around the same time as the initial mainstream multicore processors became available. For this reason, Go’s concurrency patterns and performance optimizations are tuned specifically to this model.