Skip to content

Instantly share code, notes, and snippets.

@imaami

imaami/trick_tty.c

Created Jul 5, 2020
Embed
What would you like to do?
Trick programs into thinking they're piping to an interactive terminal
/**
* Overrides the glibc function. Will always return true.
*
* Note: Although this should be ok for most applications it can
* lead to unwanted side effects. It depends on the question
* why the programm calls isatty()
*
* Compiling
*
* $ gcc -s -fpic -shared -o libtricktty.so trick_tty.c
*
* Installing
*
* # cp libtricktty.so /usr/local/lib/
*
* Usage
*
* $ alias trick_tty='LD_PRELOAD=/usr/local/lib/libtricktty.so'
* $ trick_tty <command>
*
* From https://stackoverflow.com/a/14694983
*/
int isatty (int param __attribute__((__unused__)))
{
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.