Skip to content

smercer10/spartan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spartan

Spartan is an ultra-lightweight FASM TCP server that utilises pure Linux syscalls.

MIT License GitHub Actions Workflow Status

Key Features

  • ~1 kb static binary
  • Nagle-disabled packet transmission
  • Complete error handling and logging via the standard streams

Usage

To test Spartan, simply run the binary, and then establish a connection to localhost:1337 using any preferred method. E.g., with netcat:

Process 1 (Server)

./spartan

Process 2 (Client)

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).

image

Build Locally

Prerequisites

  • x64 Linux
  • FASM
  • Make
  • readelf (optional)
  • GDB (optional)
  • strace (optional)
  • GCC (optional)

Makefile Targets

  • 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

Future Plans

  • Add a graceful shutdown mechanism
  • Add command-line configuration options
  • Experiment with multithreading