Skip to content

Instantly share code, notes, and snippets.

View darrenmartyn's full-sized avatar
💭
hacking

darrenmartyn

💭
hacking
View GitHub Profile
@L-P
L-P / exec-notify.c
Created March 11, 2014 14:52
Watch process creation.
/* exec-notify, so you can watch your acrobat reader or vim executing "bash -c"
* commands ;-)
* Requires some 2.6.x Linux kernel with proc connector enabled.
*
* $ cc -Wall -ansi -pedantic -std=c99 exec-notify.c
*
* (C) 2007-2010 Sebastian Krahmer <[email protected]> original netlink handling
* stolen from an proc-connector example, copyright folows:
*/
/*
@apsun
apsun / hax.c
Last active October 21, 2024 19:19
Hook main() using LD_PRELOAD
/*
* Hook main() using LD_PRELOAD, because why not?
* Obviously, this code is not portable. Use at your own risk.
*
* Compile using 'gcc hax.c -o hax.so -fPIC -shared -ldl'
* Then run your program as 'LD_PRELOAD=$PWD/hax.so ./a.out'
*/
#define _GNU_SOURCE
#include <stdio.h>