redirecting output from telnet

  • Follow


Is there a way to redirect the input and output from a telnet connection 
so you can interactivly use it. right now i enter in the commands
I need to shells to do this.
Shell#1 telnet x.x.x.x >myoutput
Shell#2 tail -f myoutput
I can then type into shell one but I dont see anything.
Shell#2 will show what I type and what is outputed from the device.
The reson I am tring to do this is I have a program that I run from a 
telnet and it spits out tons of info and lines so much the buffer on the 
  shelltool fills and I lose the begingin of the info, plus I need to 
have a softcopy to send to people. Any sugestions.

Thanks
Joe

0
Reply Joe 11/11/2003 11:12:32 PM

"Joe Mustafa" <kmustafa@austin.rr.com> wrote in message
news:3FB16CE0.7050601@austin.rr.com...
> The reson I am tring to do this is I have a program that I run from a
> telnet and it spits out tons of info and lines so much the buffer on the
>   shelltool fills and I lose the begingin of the info, plus I need to
> have a softcopy to send to people. Any sugestions.

If you don't need to access the data from your session immediately, i.e. you
simply want to record it for later, then the simple solution is to use the
'script' command.

$ script
$ telnet x.x.x.x
login: xxx
password:

otherhost $ ...
otherhost $ ^D
$ ^D
output in typescript
$

Script will capture pretty much everything from your session and save it to
a file (in this case the file 'typescript', which is the default). Actually,
it simply catches the output to your session, not your input (so it won't
record your password, for example).

Be aware that it does capture everything, including terminal control
characters like backspace (for when you edit the command line) and all of
the magic that vi spits out should you edit something.

Also, it will see most every line ends with a ^M vs a normal unix file of
simply ^J.

But if you simply want to capture the output of a command on a remote
system, it works really well.

Regards,

Will Hartung
(willh@msoft.com)


0
Reply Will 11/11/2003 11:43:53 PM


Will,

	Thanks thats exactly what I need i just to a text editor and find and 
replace the "^M" with "" and it takes care of all those pesky characters.
Thanks again
Joe

Will Hartung wrote:
> "Joe Mustafa" <kmustafa@austin.rr.com> wrote in message
> news:3FB16CE0.7050601@austin.rr.com...
> 
>>The reson I am tring to do this is I have a program that I run from a
>>telnet and it spits out tons of info and lines so much the buffer on the
>>  shelltool fills and I lose the begingin of the info, plus I need to
>>have a softcopy to send to people. Any sugestions.
> 
> 
> If you don't need to access the data from your session immediately, i.e. you
> simply want to record it for later, then the simple solution is to use the
> 'script' command.
> 
> $ script
> $ telnet x.x.x.x
> login: xxx
> password:
> 
> otherhost $ ...
> otherhost $ ^D
> $ ^D
> output in typescript
> $
> 
> Script will capture pretty much everything from your session and save it to
> a file (in this case the file 'typescript', which is the default). Actually,
> it simply catches the output to your session, not your input (so it won't
> record your password, for example).
> 
> Be aware that it does capture everything, including terminal control
> characters like backspace (for when you edit the command line) and all of
> the magic that vi spits out should you edit something.
> 
> Also, it will see most every line ends with a ^M vs a normal unix file of
> simply ^J.
> 
> But if you simply want to capture the output of a command on a remote
> system, it works really well.
> 
> Regards,
> 
> Will Hartung
> (willh@msoft.com)
> 
> 

0
Reply Joe 11/12/2003 12:05:19 AM

In article <borrhr$1hkvh7$1@ID-197644.news.uni-berlin.de>, Will Hartung wrote:
> 
> "Joe Mustafa" <kmustafa@austin.rr.com> wrote in message
> news:3FB16CE0.7050601@austin.rr.com...
>> The reson I am tring to do this is I have a program that I run from a
>> telnet and it spits out tons of info and lines so much the buffer on the
>>   shelltool fills and I lose the begingin of the info, plus I need to
>> have a softcopy to send to people. Any sugestions.
> 
> If you don't need to access the data from your session immediately, i.e. you
> simply want to record it for later, then the simple solution is to use the
> 'script' command.
> 
> $ script
> $ telnet x.x.x.x
> login: xxx
> password:
> 
> otherhost $ ...
> otherhost $ ^D
> $ ^D
> output in typescript
> $
> 
> Script will capture pretty much everything from your session and save it to
> a file (in this case the file 'typescript', which is the default). Actually,
> it simply catches the output to your session, not your input (so it won't
> record your password, for example).

Actually, it will capture everything printed on the screen, so it will
capture the login name, but not the password, since that string is not
echoed to the screen.

> 
> Be aware that it does capture everything, including terminal control
> characters like backspace (for when you edit the command line) and all of
> the magic that vi spits out should you edit something.
> 
> Also, it will see most every line ends with a ^M vs a normal unix file of
> simply ^J.
> 
> But if you simply want to capture the output of a command on a remote
> system, it works really well.
> 
> Regards,
> 
> Will Hartung
> (willh@msoft.com)
> 
> 


-- 
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
0
Reply Jim 11/12/2003 12:07:24 AM

Joe Mustafa wrote:
>     Thanks thats exactly what I need i just to a text editor and find 
> and replace the "^M" with "" and it takes care of all those pesky 
> characters.

It normally won't catch the backspace characters and such.
If you use the backspace key a lot, this will become noticeable.

Luckily, you can use "col -b" to get rid of both:

	$ script mylogfile
	Script started, file is mylogfile
	$ telnet otherhost
	    :
	    :
	otherhost$ exit
	$ exit
	Script done, file is mylogfile
	$ col -b < mylogfile > mylogfile.new && mv mylogfile.new mylogfile

Alternatively, load mylogfile in "vi" and type ":%! col -b", then save
and exit.

Hope that helps.

   - Logan

0
Reply Logan 11/12/2003 12:36:28 AM

Logan Shaw <lshaw-usenet@austin.rr.com> wrote:
>   Joe Mustafa wrote:
>   >     Thanks thats exactly what I need i just to a text editor and find 
>   > and replace the "^M" with "" and it takes care of all those pesky 
>   > characters.
>   
>   It normally won't catch the backspace characters and such.
>   If you use the backspace key a lot, this will become noticeable.
>   
>   Luckily, you can use "col -b" to get rid of both:

	Shhhhhhhhhh!!! You're letting out State secrets!!!

-am	© 2003
0
Reply Anthony 11/12/2003 1:51:16 AM

In article <3FB16CE0.7050601@austin.rr.com>,
Joe Mustafa  <kmustafa@austin.rr.com> wrote:
>Is there a way to redirect the input and output from a telnet connection 
>so you can interactivly use it. right now i enter in the commands
>I need to shells to do this.
>Shell#1 telnet x.x.x.x >myoutput
>Shell#2 tail -f myoutput
>I can then type into shell one but I dont see anything.
>Shell#2 will show what I type and what is outputed from the device.
>The reson I am tring to do this is I have a program that I run from a 
>telnet and it spits out tons of info and lines so much the buffer on the 
>  shelltool fills and I lose the begingin of the info, plus I need to 
>have a softcopy to send to people. Any sugestions.

Whenever I like to make similar things, I use "mconnect"

Note that you need to use the -p port option as the default port is 25.

-- 
EMail:joerg@schily.isdn.cs.tu-berlin.de (home) J�rg Schilling D-13353 Berlin
      js@cs.tu-berlin.de		(uni)  If you don't have iso-8859-1
      schilling@fokus.fraunhofer.de	(work) chars I am J"org Schilling
URL:  http://www.fokus.fraunhofer.de/usr/schilling ftp://ftp.berlios.de/pub/schily
0
Reply js 11/12/2003 1:02:10 PM

6 Replies
1678 Views

(page loaded in 0.142 seconds)

Similiar Articles:













7/19/2012 6:43:59 PM


Reply: