27672 total geeks with 3539 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 



User's box

Forgot password?
New account

<br><strong> <a href="http:/ /www.the400t eam.com/">Me ns Nike Air Max for men</a></str ong> <br><st rong><a href="http:/ /www.the400t eam.com/">Wo mens Nike Air Max for women</a></s trong> <br>< strong><a href="http:/ /www.the400t eam.com/">Ch eap Nike Air Max shoes</
s that include the autos. * Developer emblems.Thes e kind of don't reflect personal layouts, but they may be great even now.Coming in several shapes, styles and styles, these symbols are popular with those who seem to don't wish to have a specialized emble
<title>Moncl er Scarf & Caps Generous Dark Blue [Moncler_Out let_80645] - $99.00 : moncler, moncler.nike ck.com</titl e> <meta http-equiv=" Content-Type " content="tex t/html; charset=UTF- 8" /> <meta name="keywor ds" content="Mon cler Scarf & Caps Generous Dark
[b][url=http ://www.fakew atchesrolex. com/]replica rolex[/url][ /b] [b]<br><stro ng><a href="http:/ /www.fakewat chesrolex.co m/">replica rolex</a></s trong> <br>< strong><a href="http:/ /www.fakewat chesrolex.co m/">replica rolex watches</a>< /strong> <st rong><a hre
[b][url=http ://www.pando racharmscana daonline.org /]pandora jewelry wholesale[/u rl][/b] [b][url=http ://www.pando racharmscana daonline.org /]pandora jewelry cheap[/url][ /b] cost-effecti ve ammo.Have the Remington ammunition from Wal-Mart with the yellow packa

Donate and help us fund new challenges
Due Date: Oct 31
October Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00

News Feeds
The Register
Android Auto isn"t
slurping Porsche
engine data, says
Google ? but
questions remain
HP and pals release
open source switch
Tiny Robot
Invasion Earth 2016
? prepare to be
facially recognised
Talk revealing
surveillance cams
pulled after legal
America"s top
courts may have to
prove how truly
dull they are by
Windows 10 mobile
upgrade coming in
To save mobile web,
we must destroy
JavaScript, HTML
and CSS
Post-Stuxnet hack
group builds
formidable LinkedIn
phish network
Microsoft starts
backup of on-prem
workloads and
desktops to Azure
Disk boxes,
security tools,
etc: What Amazon
announced at its
AWS shindig on
How To Make
Messages Easy For
an Alien Race To
A Remarkable Number
of People Think
"The Martian" Is
Based On a True
Google"s Effort To
Speed Up the Mobile
Microsoft Claims
110M Devices Now
Run Windows 10
Rookie Dongle Warns
Parents When Their
Kids Are Driving
Too Fast
Ask Slashdot: Where
Can I Find "Nuts
and Bolts" Info On
Cookies &
Researchers Unable
To Replicate
Findings of
Published Economics
Wealth of Personal
Data Found On Used
Purchased Online
Prison Debate Team
Beats Harvard"s
National Title
Marijuana Growers
Need Software, Too
Article viewer

Expect Telnet Example

Written by:dimport
Published by:dimport
Published on:2003-06-21 07:19:46
Search OSI about Linux.More articles by dimport.
 viewed 135388 times send this article printer friendly

Digg this!
    Rate this article :
Expect is a great scripting language developed by Don Libes, makes boring interaction so much easier. This is a nice telnet example, well commented.

#!/usr/bin/expect #Where the script should be run from.

set timeout 20 #If it all goes pear shaped the script will timeout after 20 seconds.

set name [lindex $argv 0] #First argument is assigned to the variable name

set user [lindex $argv 1] #Second argument is assigned to the variable user

set password [lindex $argv 2] #Third argument is assigned to the variable password

spawn telnet $name #This spawns the telnet program and connects it to the variable name

expect "login:" #The script expects login

send "$user " #The script sends the user variable

expect "Password:" #The script expects Password

send "$password " #The script sends the password variable

interact #This hands control of the keyboard over two you (Nice expect feature!)

This article was originally written by Sliptop

Did you like this article? There are hundreds more.

2006-04-24 07:09:19
But while sending so I am unable to send passwords that contain @.Please guide how to send such passwors through Expect.

2007-01-15 20:41:23
Try using the escape character / before the @ symbol. Alternatively, put the password in quotes.
2007-02-20 10:07:52
You need to add \r at the end of username and password - Leela
2008-05-16 06:14:43
Here's a working example, which logs into the Houston server, which is running Windows 2003 Server, from a laptop running MacOS 10.5:

spawn telnet -l Administrator houston.fubar.com 2368
expect "password: "
send "a1am0\r\n"

Just save into a file, chmod 700, and you're good to go.
2008-06-24 15:08:56
Is this an example, it made it more fuzzier to me
2008-08-15 21:29:54
I need to logon a legacy system ,needs a break after Escape char; so I send brk it prompts with an ? . If I put this it does not work:
expect "Escape"
send "^]\r"
send "send brk\r"
expect "?"
send "login"

and it gets stuck , any advise ?
2008-09-29 18:39:06
you need to "expect" after every "send". So, combine the two sends, or expect a ">" after you escape back to the telnet prompt.
2010-02-24 06:31:14
2011-06-16 07:21:08
Should you be even now undecided: pick up your selected earbuds, go into a new Greatest coupe and enquire of for you to select these people in a Microsoft zune and then a music player and discover what one looks preferable to anyone, along with which in turn program making you look far more. You'll recognize that's meets your needs.
obat asam urat
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:

Blogs: (People who have posted blogs on this subject..)
start svn on system boot in debian on Tue 21st Jul 10am
http://linux.justinhartman.com/Startup_S cript_for_Subversion I found this a really simple explanation of how to start svn when the server boots
SSHFS: Super Easy File Access over SSH on Wed 18th Feb 1pm
This was really useful, and worked great to communicate between servers. http://www.linuxjournal.com/article/8904 Thanks to gabbs
hellanzb nzb news downloader for NSLU2 on Tue 22nd May 7pm
Someone introduced me to the joyful NZB file recently. Its truly a wonderful invention, and allows my to explore usenet binary grabbing using my NSLU2. as previous nntp readers id tried made the process too painful. So simply .... 1) apt-get inst
edna mp3 streaming for nslu2 on Wed 9th May 11am
I've been streaming music from my home NSLU2 server for a while now using mt-daapd (firefly) which is an ITunes server for linux. I can connect to my home network from work using ITunes and a little daap proxy app called rendevous. My friend was doing
my blog on Thu 9th Nov 6am
Tweaking Apache and Mysql for Low Memory on Fri 20th Oct 11am
i implemented this to tweak my apache/mysql for better performance on my NSLU2. Hard to tell if its helping much though ;-) Mysql really doesnt run too well with apache on NSLU2 so I dont use it for much. http://www.unixshell.com/wiki/index.php/ Optimiz
Article on building rtorrent for arm5vtel NSLU2 with debianslug on Thu 19th Oct 7am
I wrote an article today on my efforts at compiling rtorrent for debianslug. its here ... Article on building rtorrent/libtorrent for arm5vtel NSLU2 with littleendian debianslug
How to mount .iso file on NSLU2 running debianslug on Tue 19th Sep 12pm
If like me your running debianslug on an NSLU2 and you'd like to mount an iso file so it can be directly streamed to Xbox Media Centre (its a beautiful solution isnt it!) then simply do the following. Ensure you have loop support in your debianslug k
TorrentFlux on NSLU2 DebianSlug on Wed 23rd Aug 5am
I installed torrentflux on my NSLU2 over the weekend - mainly because of some frustrations with rtorrent. rtorrent is a superb client (in spite of rakshasa's relucatance to include encryption support inline with azureus and utorrent) and version 0.6.0
Serving ITunes on your home NSLU2 to you remotely on Tue 15th Aug 9am
This presumes that you have mt-daapd running on your NSLU2 and have port forwarding setup on your router to forward port 3689 onto your SLUG ip within your local LAN. Download Rendezvous Proxy. Install and start Rendevous Proxy. Enter your home IP

Test Yourself: (why not try testing your skill on this subject? Clicking the link will start the test.)
Linux Test Simple by a13x4nd7u

This is a simple Linux commands test.
Linux Quiz by abhijangda

Trivia about your favorite OS
Linux Administration by typedeaF

Testing your knowledge of Linux administration tools, very light shell scripting, and good high level understanding of how the OS works at the user level. Anyone who has worked with Linux for 1-3 years should do good.
Linux Commands (Part 1) by nirus

If you think you know the linux command-line then this test is for you. For reference purposes, it is based on Debian/GNU Linux with a BASH Shell.

Your Ad Here
Copyright Open Source Institute, 2006