Call Telnet From Within A Shell?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Call Telnet From Within A Shell?
# 1  
Old 08-14-2003
Data Call Telnet From Within A Shell?

Hi there,


I got a big problem.
For one of our customers I did a website (php) that connects to another machine "A" (server) to machine "B" via expect.

Now he wants that after the the connection with "B" is established, a telnet connection to "C" is opened, and some commands are executed. The results need to be retrieved too.

The problem is, it's not so easy to start telnet from a shell, since you only can give the username with it when its started but not the password. We don't have any permissions to install anything on "B" nor "C"; we could put a script on "B" though to connect with "C".

Does anyone have a shell skript that connects to another machine via telnet? Or a php skript which connects from "A" to "B" to "C"?

Any ideas on this? I'm going nuts about this ...


Thanks for your help!


Steff
# 2  
Old 09-01-2003
Re: Call Telnet From Within A Shell?

try rlogin (which need to edit file /etc/hosts.equiv) so,
use man rlogin or rcmd

Quote:
Originally posted by Tubbietoeter
Hi there,


I got a big problem.
For one of our customers I did a website (php) that connects to another machine "A" (server) to machine "B" via expect.

Now he wants that after the the connection with "B" is established, a telnet connection to "C" is opened, and some commands are executed. The results need to be retrieved too.

The problem is, it's not so easy to start telnet from a shell, since you only can give the username with it when its started but not the password. We don't have any permissions to install anything on "B" nor "C"; we could put a script on "B" though to connect with "C".

Does anyone have a shell skript that connects to another machine via telnet? Or a php skript which connects from "A" to "B" to "C"?

Any ideas on this? I'm going nuts about this ...


Thanks for your help!


Steff
# 3  
Old 10-01-2003
Okay.... in the script:

$host = "your_'c'_machine_here";

exec("telnet $host", $output);

et voila!

Now, if you want to interface directly with telnet, you can make a simple form with <textarea>'s and <input type="text">'s to interface with telnet via the $output array, and maybe a JavaScript that will auto-refresh the browser every 10 seconds or whatnot.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using telnet in my shell script

Hello Guys, I have a linux server where I already logged in, once logged in, i telnet to local host using some dedicated port and do some action. This I can easily do manually. Since I need to fire a lot requests so I would like to optimize it using a shell script to avoid telnetting each... (3 Replies)
Discussion started by: umarsatti
3 Replies

2. Shell Programming and Scripting

Telnet using shell Scripting

i have written a script as shown below : telnet 10.161.240.2 8100 <?xml version="1.0"?> <login_command> <sequence id="1" /> <access id="1"/> <user name = "user1" password = "pass"/> </login_command> <?xml version="1.0"?> <RegistrationDescriptor> <sequence id="1" /> <access id="1"/>... (4 Replies)
Discussion started by: akrati1
4 Replies

3. Shell Programming and Scripting

How to call a function in Shell..?

#!/bin/bash FUN_ECHO(){ echo $1 } FUN_ECHO "hi how are you ?" This code will work fine. BUT is it possible to make the following to work ? FUN_ECHO "hi how are you ?" FUN_ECHO(){ echo $1 } I know that the code will be executed line by line. But i have a number of... (5 Replies)
Discussion started by: linuxadmin
5 Replies

4. Shell Programming and Scripting

Shell Call

Can someone help me figure out how to call a c program from this shell script? I want to echo a #9 option and have it call and execute a c file called dmcc.c. #!/bin/sh # dmc.sh #clear # display menu   while : do echo "1. Display date and time." echo "2. Display what users are doing."... (7 Replies)
Discussion started by: jiro
7 Replies

5. Red Hat

how to call a particular function from one shell another shell script

please help me in this script shell script :1 *********** >cat file1.sh #!/bin/bash echo "this is first file" function var() { a=10 b=11 } function var_1() { c=12 d=13 (2 Replies)
Discussion started by: ponmuthu
2 Replies

6. Shell Programming and Scripting

Telnet using shell script

Hi I need to telnet a device with IP Address and port. After logging in, I need to execute some commands in that device. Please find the example below telnet 170.10.11.1 2100 #170.10.11.1 is the IP address. 2100 is the Port after telnet, the device will show the command prompt as : ... (2 Replies)
Discussion started by: sudharsan23
2 Replies

7. Shell Programming and Scripting

telnet in shell

hi guruz, i have problem i have 2 servers running IBM AIX-UNIX i have already made a shell which will take input from user & execute accordingly .... this input is then ftp to another system as .txt (which i have done too) Now in the same shell i wanna invoke a shell on system B to be... (2 Replies)
Discussion started by: The_Archer
2 Replies

8. Shell Programming and Scripting

how can i call one korn shell from a shell

Hi guys, please help me I have a ksh script (second picture down), in that script I define the function DATECALC. Now I want to use this function KSH in a program shell. How can I call this ksh from my shell program? My shell program is... in the first two lines I tried to call... (1 Reply)
Discussion started by: acevallo
1 Replies

9. Solaris

using shell script to telnet

I would like to log into a server read a certain file and get the results back. I have tried like below to no avail; #!/bin/ksh -x ( sleep 2 echo sdpuser sleep 2 echo cs3reloaded sleep 5 cd /export/home/scripts/daily_checks sleep 5 head daily_check_report.txt > test160108.txt exit )... (6 Replies)
Discussion started by: ricky katix
6 Replies

10. Shell Programming and Scripting

Shell scripting with Telnet

Hi, im brasilian, sorry for bad english ok? Well, im writing one honeypot, look: #!/bin/bash echo "" echo `cat /etc/welcome.pot` echo "" echo -n "login: "; read usuario echo -n "Password: " #stty -echo read -s senha #stty echo exit Running it in localhost, thats right: ... (1 Reply)
Discussion started by: juniordevil
1 Replies
Login or Register to Ask a Question