LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   interactive telnet/netcat script help (https://www.linuxquestions.org/questions/linux-software-2/interactive-telnet-netcat-script-help-693581/)

Hailey's_Comet 12-29-2008 02:20 AM

interactive telnet/netcat script help
 
I am wondering if it is possible to write an interactive script to run telnet or nc. I want to write a graphical front end with menus (default selections and such) for point and click... a telnet server is on the other end.

The issue I have is that the connection can't be broken once started. I can't have a program flow like this:

Code:

first:
 (item 1 selected)
  telnet << item1script
  (connection broken)
then:
 (item 3 selected)
  telnet << item3script
  (connection broken)

The script has to flow like this:

Code:

start_telnet
 (item 1 selected)
  send_command_1
  receive_data
  display_data
 (item 4 selected)
  send_command_4
  receive_data
  display_data
 (item 1 selected)
  send_command_1
  receive_data
  display_data
 (quit selected)
  connection_broken_and_quit

Is this at all possible? Maybe someone already has this capability written? I have been on google for hours... Any help would be appreciated, thanks in advance.

Hailey's_Comet 12-29-2008 02:58 AM

BTW: the interaction has to be dynamic, as the next choice is determined by the return data. I am using this to control the target host in an unusual way, and the menued script allows for far less typing on my part - also, it will allow others to have the same setup without difficulty.


All times are GMT -5. The time now is 01:35 PM.