/HTTP-ASM64

The most basic HTTP Server written in x86 Assembly

Primary LanguageAssembly

HTTP-ASM64

The most basic HTTP Server written in 64-bit Assembly with NASM Assembler.

Currently it is extremely primitive and is only able to serve a single page, index.html

Learned

  • Switching from MASM in Windows to NASM in Linux
  • Basics of NASM and 64-bit Assembly
  • How to use Linux system calls
  • How to use Sockets
  • Refresh on Assembly in general
  • Basics of MakeFiles

Setup

  • Dependencies sudo apt-get -y install nasm build-essential
  • Assembling+Linking+Running make build && ./server or ./Run-NASM.sh server.asm
  • Listening on http://127.0.0.1:3926

Screenshots

console

index

firefox-console

To Do Eventually ... Maybe?

  • Refactor duplicate code
  • Make Utils.asm and export functions
  • Proper 404 message handling
  • 404 Error Page
  • Multiple file handling for external css,js, more html files, images, etc.
  • Proper socket shutdown
  • POST method handling

Source Dump

char strAddr[] = "127.0.0.1"
DWORD ip = inet_addr(strAddr); // ip contains 16777343 [0x0100007f in hex]

struct in_addr paddr;
paddr.S_un.S_addr = ip;

char *strAdd2 = inet_ntoa(paddr); // strAdd2 contains the same string as strAdd