Spartan is an ultra-lightweight FASM TCP server that utilises pure Linux syscalls.
- ~1 kb static binary
- Nagle-disabled packet transmission
- Complete error handling and logging via the standard streams
To test Spartan, simply run the binary, and then establish a connection to localhost:1337 using any preferred method. E.g., with netcat:
./spartan
nc localhost 1337
The server will respond with a small HTTP packet. Since the socket has TCP_NODELAY enabled and responses aren't buffered, connecting via a browser will likely trigger multiple responses due to additional resource requests (e.g., a favicon).
- x64 Linux
- FASM
- Make
- readelf (optional)
- GDB (optional)
- strace (optional)
- GCC (optional)
- Build the executable:
make
- Run the server:
make run
- Debug with the GDB TUI:
make header
make debug ENTRY=<entry point address from the ELF header>
- Monitor system calls:
make strace
- Find relevant syscall option values:
make constants
- Add a graceful shutdown mechanism
- Add command-line configuration options
- Experiment with multithreading