dshahin has asked for the wisdom of the Perl Monks concerning the following question:

I need a program, lets call it IOcap, that I can invoke like this from the command line:

% IOcap /bin/bash

that will give me an interactive session, but capture (duplicate?) all the IO, especially my keyboard input, and log it to a file or perhaps a socket.

Sort of like what the Input_log, Output_log, and Dump_log options in Net:::Telnet, without the telnet connection.

yes, I know this will be a lot of garbage characters and stuff, especially the output. That's why logging the input and output separately would be ideal.

Any suggestions on what the simplest and most effective approach would be?

Replies are listed 'Best First'.
Re: capturing all IO of a process
by japhy (Canon) on Feb 14, 2001 at 23:20 UTC
      I don't want script, because it is only writes to a local file.
      Does anyone know how script works? I'd like to write an equivalent perl program, with a few added features...

      I've had a hard time finding the source code for script, where can I find it?

Re: capturing all IO of a process
by InfiniteSilence (Curate) on Feb 15, 2001 at 02:36 UTC
    Hmmm. You don't want it to store to a local file and you 'especially' want keyboard input? What are you trying to build, a password sniffer?

    Celebrate Intellectual Diversity