Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// Prerequisite: python2.7-dev
// Compile with: gcc -shared -fPIC -o override_pydict.c -ldl
// Run as: LD_PRELOAD=./ python
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <dlfcn.h>
#include "python2.7/Python.h"
PyObject* PyDict_New(void)
PyObject* (*orig_PyDict_New)(void) = dlsym(RTLD_NEXT, "PyDict_New");
printf("Calling PyDict_New\n");
return orig_PyDict_New();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment