How to?
autotelnet.exp < tail -f /tmp/$$
/tmp/$$ is <-- plain text with
string commands, such as:
status
!ls
open localhost
quit
I need to use "tail -f" because I
don't want to close the process or look for an EOF this could conceivably use many processes to write to /tmp/$$
############################################
#This is what I've tried so far in a
#expect script called tel-server.exp
set timeout -1
spawn telnet
match_max 100000
expect -exact "telnet> "
send -- "status\r"
expect -exact "status\r
No connection.\r\r
Escape character is '^\]'.\r\r
#########################################
#It is at this point that I would like
#to send strings of #commands to this #interactive telnet session. The key,
#is that I need the strings to come from a #file via:
# tail -f /tmp/$$
# It has to be tail on a file, no
# pipes or redirection
# This is useful for doing multiple
# telnet sessions to query a great
# many ports/services all from one
# telnet client.
telnet> "
### DO I??
while [ gets "/tmp/$$ line ] {
sleep 1
send -- $line
}
expect eof
# If you "?" at the telnet prompt
# you will see the type of strings
# that will need to be in /tmp/$$.
# Replys greatly needed. Thanks!
autotelnet.exp < tail -f /tmp/$$
/tmp/$$ is <-- plain text with
string commands, such as:
status
!ls
open localhost
quit
I need to use "tail -f" because I
don't want to close the process or look for an EOF this could conceivably use many processes to write to /tmp/$$
############################################
#This is what I've tried so far in a
#expect script called tel-server.exp
set timeout -1
spawn telnet
match_max 100000
expect -exact "telnet> "
send -- "status\r"
expect -exact "status\r
No connection.\r\r
Escape character is '^\]'.\r\r
#########################################
#It is at this point that I would like
#to send strings of #commands to this #interactive telnet session. The key,
#is that I need the strings to come from a #file via:
# tail -f /tmp/$$
# It has to be tail on a file, no
# pipes or redirection
# This is useful for doing multiple
# telnet sessions to query a great
# many ports/services all from one
# telnet client.
telnet> "
### DO I??
while [ gets "/tmp/$$ line ] {
sleep 1
send -- $line
}
expect eof
# If you "?" at the telnet prompt
# you will see the type of strings
# that will need to be in /tmp/$$.
# Replys greatly needed. Thanks!