Created
July 5, 2020 11:59
-
-
Save imaami/576a5581e7e3df07d6ecf181bd2e16ea to your computer and use it in GitHub Desktop.
Trick programs into thinking they're piping to an interactive terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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