Skip to content

Instantly share code, notes, and snippets.

@cryptolok
Created June 26, 2025 11:05
Show Gist options
  • Save cryptolok/0f8efe0d97a8f7a09022e956e2cf09ea to your computer and use it in GitHub Desktop.
Save cryptolok/0f8efe0d97a8f7a09022e956e2cf09ea to your computer and use it in GitHub Desktop.
Linux libc derandomizer
#include <unistd.h>
ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
memset(buf, 0, buflen);
return buflen;}
//gcc -shared -fPIC -o libc-unrandom.so libc-unrandom.c -ldl
//LD_PRELOAD=./libc-unrandom.so python -c "import random; print(random.random())"
//LD_PRELOAD=./libc-unrandom.so shuf -e 1 2 3
//LD_PRELOAD=./libc-unrandom.so bash
// echo $SRANDOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment