wierd scripting query via telnet - Protocols

This is a discussion on wierd scripting query via telnet - Protocols ; Hi guys.. I'm trying to write a little utility which does the following: connect via telnet to port 1494 (citrix ica) wait about 5 seconds after connecting and dump to a bash variable the contents of what was echoed to ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: wierd scripting query via telnet

  1. wierd scripting query via telnet

    Hi guys..

    I'm trying to write a little utility which does the following:

    connect via telnet to port 1494 (citrix ica) wait about 5 seconds
    after connecting and dump to a bash variable the contents of what was
    echoed to screen for checking if the citrix machine is working
    properly.

    The citrix ica client just echo's ICAICA until it closes the port.
    this takes too long so i just want to script kermit-telnet to keep the
    connection open for around 5 seconds and keep the data so I can check
    the contents.

    How would I go about this?

    So far all i've got is:

    #!/usr/local/bin/kermit
    telnet /nowait 102.12.76.37 1494

    But this takes ages to run and doesn't dump back the contents...

    Many thanks All!

  2. Re: wierd scripting query via telnet

    In article ,
    Mark Swarbrick wrote:
    : I'm trying to write a little utility which does the following:
    :
    : connect via telnet to port 1494 (citrix ica) wait about 5 seconds
    : after connecting and dump to a bash variable the contents of what was
    : echoed to screen for checking if the citrix machine is working
    : properly.
    :
    Conceptually it's easy (except for the "bash variable" part; see below).
    In practice it depends on whether Citrix ICA is normal enough to allow a
    regular non-protocol raw-socket connection to be made to it. I have no
    idea.

    : The citrix ica client just echo's ICAICA until it closes the port.
    : this takes too long so i just want to script kermit-telnet to keep the
    : connection open for around 5 seconds and keep the data so I can check
    : the contents.
    :
    : How would I go about this?
    :
    : So far all i've got is:
    :
    : #!/usr/local/bin/kermit
    : telnet /nowait 102.12.76.37 1494
    :
    : But this takes ages to run and doesn't dump back the contents...
    :
    If it takes ages to run, then maybe there's something about Citrix that
    Kermit needs to know, but does not. Is it using some Microsoft-specific
    protocol, such as VTNT? If so, C-Kermit does not support it (but K95
    might).

    Leaving Citrix out of the picture, let's say you were making a connection
    to some normal, text-based TCP service and you wanted to capture 5 seconds
    worth of whatever it spewed out:

    clear input
    set host 102.12.76.37 1494 /raw
    input 5 STRING_THAT_WILL_NEVER_COME
    if success exit 1 "Uh oh - STRING_THAT_WILL_NEVER_COME did come!"
    close

    At this point all the characters that arrived (except NULs) are in the
    Kermit variable \v(input). You can do whatever you want with this variable
    except assign its value to a bash variable that will be visible when the
    script (and Kermit) exit, because of a fundamental rule of Unix: a process
    may not manipulate the environment of a superior process.

    To pass the value back to bash, you could write it out to a file. That's
    easy enough:

    log session
    set host 102.12.76.37 1494 /raw
    input 5 STRING_THAT_WILL_NEVER_COME
    if success exit 1 "Uh oh - STRING_THAT_WILL_NEVER_COME did come!"
    exit 0

    All the bytes that arrived will be in the session.log file.

    - Frank

  3. Re: wierd scripting query via telnet

    in comp.protocols.kermit.misc i read:

    >At this point all the characters that arrived (except NULs) are in the
    >Kermit variable \v(input).


    >To pass the value back to bash, you could write it out to a file.


    or perhaps capture it via command substitution:

    var=$(/path/to/kermit_script)

    --
    a signature

  4. Re: wierd scripting query via telnet

    In article ,
    those who know me have no need of my name wrote:
    : in comp.protocols.kermit.misc i read:
    :>At this point all the characters that arrived (except NULs) are in the
    :>Kermit variable \v(input).
    :
    :>To pass the value back to bash, you could write it out to a file.
    :
    : or perhaps capture it via command substitution:
    :
    : var=$(/path/to/kermit_script)
    :
    If you had the Kermit script echo the material to stdout and then exit,
    and then you invoked the script from the Unix shell like this:

    export var=`somepath/kermit_script`

    it would assign some stuff to $var but (a) you'd have to configure Kermit
    not to emit any extraneous messages (heralds, messages from init file, etc)
    and (b) the resulting text is likely to be "edited", e.g. by the removal
    of linebreaks.

    - Frank

+ Reply to Thread