[Whonix-devel] [Help-bash] How to create a real copy of file descriptors stdout / stderr?

Patrick Schleizer patrick-mailinglists at whonix.org
Wed Mar 1 16:36:00 CET 2017


Patrick Schleizer:
> The following worked for me.
> 
> echo "int isatty(int fd) { return 1; }" | gcc -O2 -fpic -shared -ldl -o
> "$isatty_so_file" -xc -
> 
> LD_PRELOAD+=" $isatty_so_file
> 
> LD_PRELOAD="$LD_PRELOAD" apt-get "$@" 2>&1 | tee -a "$logfile"
> 
> gcc compilation on the fly seems crazy but was a worthwhile test.
> 
> Is there some pre-build command line tool isatty or shared object isatty.so?

Need to specify what I meant. Sorry for the confusion.

What the shared object for LD_PRELOAD with "int isatty(int fd) { return
1; }" apparently does not not showing if a tool is running inside a tty
or not. It's fooling the application asking for "am I running in a tty"
with "yes". It overwrites the C function "am I running in a tty" with
"always return yes". That's my understanding from testing it.

Is there a pre-build command line tool for that?

(I am asking, because then there is a chance I can install it using the
package manager of my distribution, which would be a much cleaner solution.)

> For now, ending up using the following.
> 
> python -c 'import pty, sys; pty.spawn(sys.argv[1:])' \
>    | apt-get "$@" 2>&1 \
>    | tee -a "$logfile"
> 
> 
> 



More information about the Whonix-devel mailing list