How to log telnet session?

How to log telnet session?

Post by Ralph A. Moerit » Thu, 14 Jul 2005 17:14:24



Hi everyone,

  I would like to run a telnet session, and have the session
logged to a file. I want to manipulate the contents of the
session log with a text editor while the session is still
active, so I can copy/paste lines into files to then be
manipulated by shell scripts. I've tried the following:

$ telnet ADDRESS 1>&2 2>LOG_FILE

  But nothing gets copied to LOG_FILE. Help, anyone? I know
it sounds bizarre, and you're probably thinking ``Why doesn't
he just use rcp/scp?''. Well, I can't because I am not
talking to a shell on the remote side. So I need to be able
to save the output it is sending back to me. Help, anyone?

Thanks,
Ralph

 
 
 

How to log telnet session?

Post by matt_left_coas » Thu, 14 Jul 2005 17:29:04



> Hi everyone,

>   I would like to run a telnet session, and have the session
> logged to a file. I want to manipulate the contents of the
> session log with a text editor while the session is still
> active, so I can copy/paste lines into files to then be
> manipulated by shell scripts. I've tried the following:

> $ telnet ADDRESS 1>&2 2>LOG_FILE

I'm not sure why you would use that context. The usable way of doing this is
to send 2 into 1 something like this:

$telnet ADDRESS >LOG_FILE 2>&1

but this should leave you with no command line output. I don't use telnet
anymore but I think I did it with something like

$telnet ADDRESS | tee LOG_FILE

Not sure if that is right, it was a very long time ago, so you will have to
try it and see.

 
 
 

How to log telnet session?

Post by nasi » Fri, 15 Jul 2005 03:06:27



> Hi everyone,

>   I would like to run a telnet session, and have the session
> logged to a file.

I dont know why did not my last post appeared that I wrote over an hour
ago.
Anyways, try "script" command. It worked to me for SSH, it must work
for telnet as well.

cheers - nasir

 
 
 

How to log telnet session?

Post by nasi » Fri, 15 Jul 2005 01:37:10



> Hi everyone,

>   I would like to run a telnet session, and have the session
> logged to a file.

try the "script" command on the server which is telnet client. I just
tried it with ssh and it worked, it should work with telnet as well. It
will save the session in the file named "typescript" on the telnet
client. Yuo get out of script command using exit command. Read MAN page
of "script".

cheers - nasir

 
 
 

How to log telnet session?

Post by THum » Fri, 15 Jul 2005 05:07:48


how about

script -c 'telnet some.server' -f /tmp/telnet.log

 
 
 

How to log telnet session?

Post by nasi » Fri, 15 Jul 2005 05:44:39


i have ksh(88) and it does not have -c and -f parameters. Just -c.
What shell and version are you using?

> how about

> script -c 'telnet some.server' -f /tmp/telnet.log

 
 
 

How to log telnet session?

Post by Chris F.A. Johnso » Fri, 15 Jul 2005 05:57:26




>> how about

>> script -c 'telnet some.server' -f /tmp/telnet.log

[please don't top post]

Quote:> i have ksh(88) and it does not have -c and -f parameters. Just -c.
> What shell and version are you using?

    It doesn't matter what ksh has; the options are for the "script"
    command.

--
    Chris F.A. Johnson                     <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/cfaj/ssr.html>

 
 
 

How to log telnet session?

Post by Alan Conno » Thu, 14 Jul 2005 23:08:10



Quote:

> Hi everyone,

>   I would like to run a telnet session, and have the session
> logged to a file. I want to manipulate the contents of the
> session log with a text editor while the session is still
> active, so I can copy/paste lines into files to then be
> manipulated by shell scripts. I've tried the following:

> $ telnet ADDRESS 1>&2 2>LOG_FILE

>   But nothing gets copied to LOG_FILE. Help, anyone? I know
> it sounds bizarre, and you're probably thinking ``Why doesn't
> he just use rcp/scp?''. Well, I can't because I am not
> talking to a shell on the remote side. So I need to be able
> to save the output it is sending back to me. Help, anyone?

> Thanks,
> Ralph

Icarus has some decent ideas, but there is a much better way.
When you have taken care of basics like using a real newsreader,
get back to me.

Google is for reading the Archives.

And for incompetent windoze weenies to post from.

Google does not format replies correctly and it is pain
in the ass to use and to read.

There are FREE Usnet newsservers out there.

Here's one that was posted on alt.free.newsservers a while
back, and I'd use it if Earthlink didn't have one:

news.aioe.org

No registration. No authentication. No fees.

Newsreaders for linux/unix are free too.

AC

--
If you are posting through google for any purpose
other than learning to use a real newsreader,
many of us will not answer your questions.
  ----  news.software.readers  ----

 
 
 

How to log telnet session?

Post by Icarus Sparr » Thu, 14 Jul 2005 22:31:02



> Hi everyone,

>   I would like to run a telnet session, and have the session
> logged to a file. I want to manipulate the contents of the session log
> with a text editor while the session is still active, so I can
> copy/paste lines into files to then be manipulated by shell scripts.
> I've tried the following:

> Ralph

Three things come to mind.
1) 'script'. This program will log output, but because of buffering the
output file will not have the last output.

2) Since you mention 'cut and paste', you may well be using something like
'xterm'. If so xterm can log all output to a file.

3) 'expect', which is almost certainly the tool you want. It will even be
able to automate the cut and paste.