Book Image

Security with Go

By : John Daniel Leon
Book Image

Security with Go

By: John Daniel Leon

Overview of this book

Go is becoming more and more popular as a language for security experts. Its wide use in server and cloud environments, its speed and ease of use, and its evident capabilities for data analysis, have made it a prime choice for developers who need to think about security. Security with Go is the first Golang security book, and it is useful for both blue team and red team applications. With this book, you will learn how to write secure software, monitor your systems, secure your data, attack systems, and extract information. Defensive topics include cryptography, forensics, packet capturing, and building secure web applications. Offensive topics include brute force, port scanning, packet injection, web scraping, social engineering, and post exploitation techniques.
Table of Contents (15 chapters)

Creating and sending packets

This example does a couple of things. First, it will show you how to use the network device to send raw bytes, so you can use it almost like a serial connection to send data. This is useful for really low-level data transfer, but if you want to interact with an application, you probably want to build a packet that other hardware and software can recognize.

The next thing it does is show you how to create a packet with the Ethernet, IP, and TCP layers. Everything is default and empty, though, so it doesn't really do anything.

Finally, we will create another packet, but we'll actually fill in some MAC addresses for the Ethernet layer, some IP addresses for IPv4, and port numbers for the TCP layer. You should see how you can forge packets and impersonate devices with that.

The TCP layer struct has Boolean fields for the SYN, FIN, and ACK flags...