5
1
I need to record the output of a telnet session.
I can't just pipe or output it because I need to authenticate first.
How I can achieve this log?
5
1
I need to record the output of a telnet session.
I can't just pipe or output it because I need to authenticate first.
How I can achieve this log?
4
First run 'script' and specify the log file
script mylogfile.log
Then a new bash session is initialized and all you need to do is run telnet.
When you're done just quit telnet, and type exit to stop recording. All the output will be in mylogfile.log
1
You should be able to do what you want with 'tee'
telnet HOST | tee -i session-recording.log
You still can login and your password will not display in the recording.
Unfortunately, in MSYS2, this will make it impossible to break out of/exit telnet
with the usual Ctrl+] - so you'll have to kill
telnet
from another MSYS2 terminal. – sdbbs – 2019-05-22T08:54:54.797
0
You can use gnu screen as a telnet client to do this:
screen -L -Logfile session.txt //telnet 10.10.0.10 23
This will log a telnet session with 10.10.0.10:23 to session.txt The port number is for illustration only, and not actually needed if you're on the standard port 23.
You can also turn on/off logging while the session is in progress. See https://unix.stackexchange.com/questions/240796/gnu-screen-how-to-enable-or-disable-logging-while-screen-is-already-attached
/usr/bin/script makes files that are full of control characters, like tabs, backspaces, and carriage returns, and a program like 'tr' or 'sed' may have to be used to get rid of 'em. (This looks crappy, and should be in an answer...)
tr -cd '\11\12\15\40-\176' < mylogfile.log > mycleanfile.log – Nevin Williams – 2016-01-12T18:17:24.013
Note: use
exit
to exit the script session and close yourmylogfile.log
– Gabriel Staples – 2019-02-06T22:07:04.187