1

I'm not even sure whether I've framed this question correctly. Let me explain my situation.

I have an Application hosted in a OpenVMS environment which is being accessed via Telnet. I'm in need to programmatically accomplish certain tasks.

So far I could send and receive messages using a C# Telnet Client. I am able to execute tasks by sending commands and receiving responses. But for one task, I have to edit a Form to change some information. The command looks like below

>modify page <page_no>

As soon as I enter the above command, the entire terminal gets loaded with this Form, I have to use page-down to go through the fields, press enter to edit the text and use Ctrl-Z to save it.

I'm not sure how to accomplish this task programmatically.

I'm not familiar with telnet or VxWorks. I'm not sure the above is a feature of Telnet or OpenVMS. Kindly help.

deena102
  • 41
  • 4
  • Can you use other tools? Like ssh instead of telnet, where you can pass ssh a parameter that is the command to execute, and sed or awk or perl to edit the file instead of vi? – atk Dec 25 '13 at 03:17

1 Answers1

1

This should be easy to figure out thanks to the clear text of telnet :D It shouldn't matter what platform your target is running. All you have to remember is that special keys like ctrl-z or page down, are just chars in the data stream. Ctrl-z is typically 0x1a, and I am not sure what page down is off the top of my head, but here is how you can figure it out:

  1. Get wireshark http://www.wireshark.org/ and install it if you don't already have it.
  2. Start wireshark up and capture all traffic on your NIC that will carry the connection to the target.
  3. Start a normal telnet session to the target and issue all of the commands (including the page downs and the ctrl-z).
  4. Stop wireshark capture and then filter out everything except telnet communication between you and the target.
  5. Look at the data that was sent to issue the ctrl-z, and page downs.
  6. Put those chars in your telnet stream when you are ready to issue those commands.

Easy.

Chris Desjardins
  • 2,631
  • 1
  • 23
  • 25
  • Thank you Chris :). I will try your suggestion and update it here. – deena102 Dec 26 '13 at 05:20
  • @deena102 - If you can't use Wireshark, most Telnet clients support some sort of log file for a session. You could puzzle out the escape codes with a text editor that displays control characters. Appendix A [here](http://vt100.net/docs/vt100-tm/ek-vt100-tm-002.pdf) might help. If you use Wireshark, it may help to set the capture filter to ignore other traffic before starting the capture. – HABO Dec 26 '13 at 16:27