Module Title: dgt_net02 – TCP and UDP Packets in C
Overview:
The module “dgt_net02 – TCP and UDP Packets in C” covers networking and hacking at the lowest level. With a focus on the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP), participants will study how custom network packets are built using the C programming language: sockets, headers, payloads and the data structures behind them. The module combines theory with practice and covers low-level network communication and its use in cybersecurity.
Following the academy’s method, the C code is not written by hand. Once the theory is clear, you specify in natural language what a program must do (open a TCP server on a given port, send a UDP datagram with a particular payload, set a specific header field), the machine writes and compiles it, and you read the generated code, verify byte order, buffer sizes and error checks, capture the packets it actually sends and compare them with what you asked for.
Module Objectives:
– Understand the fundamentals of TCP/IP networking protocols.
– Understand how TCP and UDP sockets are created and manipulated in C, well enough to review the code a machine produces.
– Specify custom network packets precisely in natural language and verify that the generated code builds them correctly and robustly.
– Explore practical applications and scenarios where such skills can be employed ethically.
– Gain insight into network hacking techniques from a defensive perspective.
Module Content:
1. Introduction to Networking Protocols:
– Overview of the TCP/IP Suite
– Differences between TCP and UDP
- C Programming for Networking:
- Basics of socket programming in C
-
Understanding data structures for networking, e.g. structs and pointers
-
Creating TCP Sockets:
- How a TCP server and client are created using sockets
-
Handling connections, reading/writing data, and closing sockets
-
Creating UDP Sockets:
- Establishing UDP communication channels
-
Working with datagrams to send and receive data efficiently
-
Crafting Custom Packets:
- Manipulating packet headers and payloads
-
Implementing custom protocols over TCP/UDP
-
Examples of Code for Creating Sockets in C:
- Machine-generated examples of TCP and UDP sockets, requested in natural language and read step by step.
-
Spotting bugs and inefficiencies in the generated network code and asking the machine to fix them.
-
Ethical Hacking and Network Security:
- Understanding how these skills can be used for penetration testing
-
Emphasizing ethical considerations and legal compliance
-
Natural-language Labs and Projects:
- Real-world projects in which you direct the machine to create, send and receive custom packets, and verify them on the wire.
-
Collaborative labs that simulate network environments.
-
Advanced Topics (Optional):
- Exploring raw sockets for even more control over packet crafting
- Integrating network programming with other system-level practices
Prerequisites:
– Basic knowledge of C, enough to read and follow a program
– An understanding of networking concepts is beneficial but not mandatory
Target Audience:
This module is intended for software developers, people working in cybersecurity, ethical hackers and IT professionals who deal with low-level network communication. It is accessible both to beginners with basic programming knowledge and to experienced practitioners.
By the end of this module, participants will understand how TCP and UDP packets are crafted in C and will be able to have a machine build them to specification, checking the code and the traffic it generates, laying the groundwork for advanced studies or professional work in network engineering and cybersecurity.
The students can push their exercises to the Academy DevOps & SRE Git project. For this module, create a folder with your username as its name in the following subfolder: https://github.com/Garanti-Del-Talento/gdt_academy
