Skip to content

Instantly share code, notes, and snippets.

View DGivney's full-sized avatar

Daniel Givney DGivney

  • danielgivney.com
View GitHub Profile
@DGivney
DGivney / socket.asm
Created May 2, 2019 02:11
NASM socket programming example
; Socket
; Compile with: nasm -f elf socket.asm
; Link with (64 bit systems require elf_i386 option): ld -m elf_i386 socket.o -o socket
; Run with: ./socket
%include 'functions.asm'
SECTION .data
; our response string
response db 'HTTP/1.1 200 OK', 0Dh, 0Ah, 'Content-Type: text/html', 0Dh, 0Ah, 'Content-Length: 14', 0Dh, 0Ah, 0Dh, 0Ah, 'Hello World!', 0Dh, 0Ah, 0h
@DGivney
DGivney / httpd.asm
Last active August 29, 2024 12:31 — forked from xenomuta/httpd.asm
section .text
global _start
_start:
xor eax, eax ; init eax 0
xor ebx, ebx ; init ebx 0
xor esi, esi ; init esi 0
jmp _socket ; jmp to _socket
_socket_call: