C projects: a shell, an HTTP server and a log collector
You take three realistic C projects from design to testing and combine your memory, systems and secure coding skills at production quality.
Level 501 · 17 lessons · 18 practice labs
Lessons
Project 1: a mini shell
- Shell design: the read, parse, run loop
- A command-line parser: quotes and escapes
- Built-ins: cd, exit, export
- Redirection and pipes
- Job control and Ctrl+C
- Short task: a test script for your shell
Project 2: an HTTP server
- Server architecture: the event loop and connection state
- A bounds-checked request parser
- Serving static files and blocking path traversal
- Access logs, timeouts and request limits
- Short task: fuzz your server and test it under load
Project 3: a log collector
- Log collector design: UDP input and file rotation
- Parsing syslog lines
- Privilege separation: listener and writer processes
- Packaging: Makefile, man page and systemd unit
- Short task: review your project against the secure coding checklist
Capstone
- Capstone: take one of the projects to production quality and present it
Practice labs
- Tokenising a quoted command line: Write a command-line tokeniser that supports single and double quotes and backslashes.
- Adding cd and pwd to a shell: Add cd with ~ and - support and pwd as built-ins to a shell and test the error cases.
- Adding >> and 2> redirection to a shell: Add append and stderr redirection to the shell without leaking file descriptors.
- Making Ctrl+C stop only the child: Make Ctrl+C stop only the foreground command, not the shell, using process groups and signals.
- Wildcard expansion in the shell: Add * and ? expansion to the shell with glob(), leaving the word as is when nothing matches.
- Splitting headers from an HTTP request: Write a function that splits a raw HTTP request into the request line and a header table with case-insensitive lookup.
- Choosing a content type from the extension: Add Content-Type selection by extension with a safe default for unknown types to the static file server.
- Normalising the request path: Write path normalisation and a root check that also catch encoded traversal such as %2e%2e.
- Limiting keep-alive connections: Add per-connection request and idle-time limits to the server so memory stays flat under a load test.
- Parsing a chunked transfer body: Write a function that parses a chunked request body with size limits and returns 400 for malformed chunks.
- Decoding the syslog priority value: Write a function that splits priority values such as <34> into facility and severity and rejects invalid ones.
- Rotating logs by size: Add rotation to the log collector that rolls to numbered backups past a size limit and keeps at most five.
- Measuring loss during a UDP burst: Send thousands of messages per second to the collector, measure loss, reduce it by enlarging the receive buffer and report.
- Separating listener and writer: Split a root writer that opens files from an unprivileged listener with a pipe and test the listener's UID.
- Adding single-pipe support to a shell: Add the 'cmd1 | cmd2' form to the mini shell, leave no descriptor open and return the exit code of the last command.
- Answering 304 for an unchanged file: Add Last-Modified and If-Modified-Since support to a static server and show with tests that it returns a bodiless 304 when unchanged and 200 otherwise.
- Splitting incoming data into lines: Write a buffer that accumulates bytes arriving in pieces, yields complete lines in order and keeps a partial line for the next piece.
- Applying a drop policy when the queue fills: Give a collector whose memory grows when the writer slows a bounded queue, drop the oldest records while counting them and measure that the memory cap holds.
About this course
You take three realistic C projects from design to testing and combine your memory, systems and secure coding skills at production quality.
What you will learn
- Project 1: a mini shell
- Project 2: an HTTP server
- Project 3: a log collector
- Capstone
Prerequisites
You should be experienced in the topics of the same path up to level 401.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- Is this course right for my level?
- The course is at level 501; it assumes you know the topics of the lower-level courses.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.