https://github.com/smercer10/spartan
Bare bones FASM TCP server.
https://github.com/smercer10/spartan
assembly fasm linux tcp
Last synced: 2 months ago
JSON representation
Bare bones FASM TCP server.
- Host: GitHub
- URL: https://github.com/smercer10/spartan
- Owner: smercer10
- License: mit
- Created: 2024-06-07T17:02:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-05T11:35:34.000Z (almost 2 years ago)
- Last Synced: 2025-05-25T01:43:57.669Z (about 1 year ago)
- Topics: assembly, fasm, linux, tcp
- Language: Assembly
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spartan
Spartan is an ultra-lightweight FASM TCP server that utilises pure Linux syscalls.
[](https://github.com/smercer10/spartan/blob/main/LICENSE)
[](https://github.com/smercer10/spartan/actions/workflows/build.yml)
## 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)
```bash
./spartan
```
### Process 2 (Client)
```bash
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).

## Build Locally
### Prerequisites
- x64 Linux
- FASM
- Make
- readelf (optional)
- GDB (optional)
- strace (optional)
- GCC (optional)
### Makefile Targets
- Build the executable:
```bash
make
```
- Run the server:
```bash
make run
```
- Debug with the GDB TUI:
```bash
make header
make debug ENTRY=
```
- Monitor system calls:
```bash
make strace
```
- Find relevant syscall option values:
```bash
make constants
```
## Future Plans
- Add a graceful shutdown mechanism
- Add command-line configuration options
- Experiment with multithreading