Skip to content

Instantly share code, notes, and snippets.

@qknight
qknight / ucurl.c
Created April 7, 2017 20:52 — forked from ato/ucurl.c
LD_PRELOAD wrapper which tricks curl (or anything else) into connecting to a unix domain socket
/*
* LD_PRELOAD wrapper which tricks curl (or anything else) into connecting to a unix domain socket
*
* Compile: gcc -o ucurl.so -shared ucurl.c -ldl -fPIC
* Usage: LD_PRELOAD=/path/to/ucurl.so SOCKET=/path/to/socket curl http://0.0.0.0/
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>