Skip to main content
deleted 50 characters in body
Source Link
Mad Scientist
  • 1.3k
  • 3
  • 12
  • 17

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?

Update:

I tried the shell script placeholder idea to grab all the data using the following script:

#!/bin/bash
export LOGFILE=/tmp/logname
echo `env` > $LOGFILE-env
echo "$@" >> $LOGFILE-arguments
tee -a $LOGFILE-stdin | /path/to/real/executable 2>&1 | tee -a $LOGFILE-stdout

Unfortunately the executableThis works fine for test input, but it just hangs if it is called directly, in a way that does not work for shell scriptsreal. I get an error message that the executableProbably there is in ascii, soeven more going on than I need somehow to do the same thing in a compiled executablesuspected.

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?

Update:

I tried the shell script placeholder idea to grab all the data using the following script:

#/bin/bash
export LOGFILE=/tmp/logname
echo "$@" >> $LOGFILE-arguments
tee -a $LOGFILE-stdin | /path/to/real/executable | tee -a $LOGFILE-stdout

Unfortunately the executable is called directly, in a way that does not work for shell scripts. I get an error message that the executable is in ascii, so I need somehow to do the same thing in a compiled executable.

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?

Update:

I tried the shell script placeholder idea to grab all the data using the following script:

#!/bin/bash
export LOGFILE=/tmp/logname
echo `env` > $LOGFILE-env
echo "$@" >> $LOGFILE-arguments
tee -a $LOGFILE-stdin | /path/to/real/executable 2>&1 | tee -a $LOGFILE-stdout

This works fine for test input, but it just hangs if it is called for real. Probably there is even more going on than I suspected.

added 497 characters in body
Source Link
Mad Scientist
  • 1.3k
  • 3
  • 12
  • 17

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?

Update:

I tried the shell script placeholder idea to grab all the data using the following script:

#/bin/bash
export LOGFILE=/tmp/logname
echo "$@" >> $LOGFILE-arguments
tee -a $LOGFILE-stdin | /path/to/real/executable | tee -a $LOGFILE-stdout

Unfortunately the executable is called directly, in a way that does not work for shell scripts. I get an error message that the executable is in ascii, so I need somehow to do the same thing in a compiled executable.

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?

Update:

I tried the shell script placeholder idea to grab all the data using the following script:

#/bin/bash
export LOGFILE=/tmp/logname
echo "$@" >> $LOGFILE-arguments
tee -a $LOGFILE-stdin | /path/to/real/executable | tee -a $LOGFILE-stdout

Unfortunately the executable is called directly, in a way that does not work for shell scripts. I get an error message that the executable is in ascii, so I need somehow to do the same thing in a compiled executable.

Tweeted twitter.com/#!/StackUnix/status/65342677301993472
Source Link
Mad Scientist
  • 1.3k
  • 3
  • 12
  • 17

Intercept input and output from specific executable

I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred.

So, I'd like to monitor the command line parameters, stdin and stdout if this executable is called. The normal operation of the executable should not be disturbed.

Is there an easy way to do that?