Command after telnet

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command after telnet
# 1  
Old 02-24-2014
Command after telnet


I'm trying to send a HTTP POST command after doing a telnet to a machine, like below:

telnet ip port
POST http://ip:port/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "test#Login"
Content-Length: 200
Host: ip:port
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

The problem is that adding it in a script, the POST doesn't work after doing the telnet. Launching them by hand, this work and, after doing the telnet, the POST commands return a right command.

How can I do this also from the script?

Thank you
# 2  
Old 02-24-2014
I wonder if you should not use expect for that...
# 3  
Old 02-24-2014
Actually the problem in the script is that the POST command runs only after the telnet is closed...The idea here is the POST to run immediately after the telnet.

I used here "echo -n command", in order to run the lines immediately after telnet, but it doesn't work

---------- Post updated at 04:01 AM ---------- Previous update was at 03:57 AM ----------

I'm trying with expect and I let you know.


---------- Post updated at 05:13 AM ---------- Previous update was at 04:01 AM ----------

---------- Post updated at 05:13 AM ---------- Previous update was at 05:13 AM ----------

It seems I don't have it installed, and unfortunately I cannot make any change you know another way to execute commands on the remote machine after doing a telnet?

Thank you
# 4  
Old 02-24-2014
Not sure I understood...
After the telnet where should we be? Because on your previous update you seem to say on the remote...
# 5  
Old 02-24-2014

After the telnet I should be able to launch commands on the remote machine...using expect was great, but unfortunately, I don't have it installed and I don't have permission to install it...
# 6  
Old 02-24-2014
You should have a look at this:
I modified it years ago for automating passwords change...
Automated FTP task | Unix Linux Forums | IP Networking
See if you cant adapt to your needs... It may work...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Telnet command on AIX

Hello, I need to verify whether I am able to make connection to a remote server from my AIX (os level : host. The host has 2 Alias IP's how can I force an source Alias IP on the telnet command. I tried the below options but none of them worked. Is there any other command that... (6 Replies)
Discussion started by: rosebud123
6 Replies

2. Solaris

Not able to disable finger & telnet command in Solaris 8

Hi I need to disable finger & telnet command in solaris 8 I have put the # infront of finger and telnet line in /etc/inetd.conf file. Further I have run the below command kill -1 <process id of inetd > But when I am running finger command it is till giving information for remote machine... (8 Replies)
Discussion started by: amity
8 Replies

3. Shell Programming and Scripting

Telnet connection closes before i execute GET command

I tried the below steps for telnet command from a remote server: 1. telnet 443 2. GET / HTTP/1.0 3. Press enter key twice Please see the output below: bash-3.2$ hostname remoteserver1 bash-3.2$ telnet 443 Trying Connected to... (7 Replies)
Discussion started by: mohtashims
7 Replies

4. Shell Programming and Scripting

If Telnet fail abort other command..??

Hi Team, I my script i telent my node ip and after loging i run some commands...But some time login fail so i want to stop script at that time.. printf 'Please Input Node ID : ' read node node="$node" #exec > node_log_$node.log 2>&1 #set -x >... (2 Replies)
Discussion started by: Ganesh Mankar
2 Replies

5. Shell Programming and Scripting

Need shell script for SMS via telnet command

I am not very much familiar with telnet based scripting so I would need your help to directly submitting sms as deliver_sm or submit_sm msg to SMSC (IP & system_id and password are already known). So, need your help to provide such script. I previously used such script but my harddisk crashed and... (1 Reply)
Discussion started by: wasay
1 Replies

6. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

7. Shell Programming and Scripting

how to Redirect the output of telnet command on a terminal to a file ?

(/home/user1)-> more #!/bin/ksh ( echo open devicename sleep 3; echo user; sleep 2; echo password; sleep 2; echo "/info/dump"; ---------> This needs to redirect to a file .Can be number of pages sleep 2; echo "exit" ) | telnet Please use code tags next time for... (2 Replies)
Discussion started by: necro98
2 Replies

8. Shell Programming and Scripting

Telnet to router and execute command

I am trying to write a shell script to execute some commands.. telnet <IP address of the router> wait 10 echo "username" echo "password" sh log exit but i am unable to execute it properly ..please help me .. thanks in advance Sri (1 Reply)
Discussion started by: srikanthus2002
1 Replies

9. Shell Programming and Scripting

Telnet in command prompt

Hi, i have typed telnet 80 in command prompt it displays as a blank command prompt page titling as Telnet Other than that i am not able to get anything. can anyone sort me out the reason for this (12 Replies)
Discussion started by: satheeshkr_cse
12 Replies

10. Shell Programming and Scripting

Automatic command to Telnet

I'm trying to send a command automatically via Telnet, but without success. I can do this: > telnet 8080 Trying Connected to Escape character is '^]'. Whereby I enter "command" and everything works like a charm, but I'd like to do this... (3 Replies)
Discussion started by: Ilja
3 Replies
Login or Register to Ask a Question