You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(26) |
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(5) |
Feb
(3) |
Mar
(11) |
Apr
(10) |
May
(2) |
Jun
(5) |
Jul
(13) |
Aug
(2) |
Sep
(3) |
Oct
(10) |
Nov
(18) |
Dec
(29) |
2002 |
Jan
(12) |
Feb
(14) |
Mar
(73) |
Apr
(28) |
May
(21) |
Jun
(39) |
Jul
(40) |
Aug
(42) |
Sep
(20) |
Oct
(4) |
Nov
(9) |
Dec
(18) |
2003 |
Jan
(2) |
Feb
(8) |
Mar
(6) |
Apr
(24) |
May
(24) |
Jun
(14) |
Jul
(16) |
Aug
(36) |
Sep
(34) |
Oct
(23) |
Nov
(4) |
Dec
(15) |
2004 |
Jan
(6) |
Feb
(13) |
Mar
(7) |
Apr
(5) |
May
(11) |
Jun
(5) |
Jul
(4) |
Aug
|
Sep
(2) |
Oct
(16) |
Nov
(4) |
Dec
(9) |
2005 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
(10) |
May
(5) |
Jun
(13) |
Jul
(3) |
Aug
|
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(9) |
2006 |
Jan
|
Feb
(10) |
Mar
(22) |
Apr
(14) |
May
(5) |
Jun
(4) |
Jul
(19) |
Aug
(7) |
Sep
(16) |
Oct
(4) |
Nov
(1) |
Dec
(16) |
2007 |
Jan
(17) |
Feb
|
Mar
(35) |
Apr
(5) |
May
(20) |
Jun
(11) |
Jul
(33) |
Aug
(3) |
Sep
(2) |
Oct
(11) |
Nov
(23) |
Dec
(5) |
2008 |
Jan
(10) |
Feb
(9) |
Mar
|
Apr
(6) |
May
(8) |
Jun
(7) |
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(20) |
2009 |
Jan
(8) |
Feb
(8) |
Mar
(3) |
Apr
(8) |
May
(2) |
Jun
(11) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(7) |
Dec
(4) |
2010 |
Jan
(2) |
Feb
(1) |
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(7) |
Aug
(3) |
Sep
(7) |
Oct
(2) |
Nov
(1) |
Dec
(4) |
2011 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(2) |
Jun
|
Jul
(6) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(7) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
(30) |
Apr
(10) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(12) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <RGi...@a1...> - 2002-03-14 09:43:13
|
> I am using perl 5.6 with Expect module 1.12 and trying to get the > size of a file on a remote server. You don't need Expect for this, set up ssh with RSA key authentication without passphrase (so ssh doesn't prompt for a password) and use ssh directly: $filesize = (split " ", qx{ssh user@host ls -l /path/to/file})[4]; or $filesize = qx{ssh user@host perl -e 'print -s "/path/to/file"'}; chomp $filesize; From the FAQ: I want to automate password entry for su/ssh/scp/rsh/... You shouldn't use Expect for this. Putting passwords, especially root passwords, into scripts in clear text can mean severe security problems. I strongly recommend using other means. For 'su', consider switching to 'sudo', which gives you root access on a per-command and per-user basis without the need to enter passwords. 'ssh'/'scp' can be set up with RSA authentication without passwords. 'rsh' can use the .rhost mechanism, but I'd strongly suggest to switch to 'ssh'; to mention 'rsh' and 'security' in the same sentence makes an oxymoron. It will work for 'telnet', though, and there are valid uses for it, but you still might want to consider using 'ssh', as keeping cleartext passwords around is very insecure. I want to use Expect to automate [anything with a buzzword]... Are you sure there is no other, easier way? As a rule of thumb, Expect is useful for automating things that expect to talk to a human, where no formal standard applies. For other tasks that do follow a well-defined protocol, there are often better-suited modules that already can handle those protocols. Don't try to do HTTP requests by spawning telnet to port 80, use LWP instead. You don't use a screwdriver to hammer in your nails either, or do you? Hope this helps, Roland -- RGi...@cp... |
From: Austin S. <te...@of...> - 2002-03-13 20:17:17
|
On Wed, Mar 13, 2002 at 02:01:12PM -0600, al....@ac... wrote: > > Austin, > > Thank you. Your comments worked. Now I can see the remote file size on my > screen. I need to assign > that value to a variable so that I can compare it against the size of my > other files. How can I assign the > returned value to a local variable? > Take a look at $object->before() in the docs, or $before_match in the $object->expect() section. Basically the idea is to use the output before the matched prompt. In other words you would do something like $ssh->expect($timeout, $prompt); print $ssh "$command\r"; $ssh->expect($timeout, $prompt); $output = $ssh->before(); Austin |
From: <al....@ac...> - 2002-03-13 20:05:05
|
Austin, Thank you. Your comments worked. Now I can see the remote file size on my screen. I need to assign that value to a variable so that I can compare it against the size of my other files. How can I assign the returned value to a local variable? Al *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* Al Pashazadeh Accenture CIO Technology Services - Network Services Dallas, Infomart Phone: (214) 672-4255 VPN: 573-4255 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* Austin Schutz <te...@of...> To: al....@ac... cc: exp...@li... 03/13/2002 12:20 PM Subject: Re: [Expectperl-discuss] Need Help with Capturing Output On Wed, Mar 13, 2002 at 12:05:50PM -0600, al....@ac... wrote: > Hello, > > I am using perl 5.6 with Expect module 1.12 and trying to get the size of a > file on a remote server. > I tried piping the output of ls -l on the remote server to awk but that > only returned the output of the ls -l > commend. I searched the archived messages and noticed that this issue was > reported as a bug. > Does anyone knows if this bug is fixed? For now, I created a short script > on the remote server to > display the size of the file. The scritpt works fine when it is excuted > from within the spawned ssh > but I am not sure how to capture its output. I need to compare the > returned value (from my script) > against the size of a similar file on the local server. Any help is > appreciated. > > #!/usr/bin/perl use Expect; $ssh = Expect->spawn('ssh host.com'); $ssh->expect(60,"d: "); print $ssh 'password' . "\n"; $ssh->expect(60,'> '); print $ssh 'ls -l | awk \'{print $5}\''."\n"; $ssh->expect(60,'> '); I dunno, works for me. Austin This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |
From: Austin S. <te...@of...> - 2002-03-13 18:21:34
|
On Wed, Mar 13, 2002 at 12:05:50PM -0600, al....@ac... wrote: > Hello, > > I am using perl 5.6 with Expect module 1.12 and trying to get the size of a > file on a remote server. > I tried piping the output of ls -l on the remote server to awk but that > only returned the output of the ls -l > commend. I searched the archived messages and noticed that this issue was > reported as a bug. > Does anyone knows if this bug is fixed? For now, I created a short script > on the remote server to > display the size of the file. The scritpt works fine when it is excuted > from within the spawned ssh > but I am not sure how to capture its output. I need to compare the > returned value (from my script) > against the size of a similar file on the local server. Any help is > appreciated. > > #!/usr/bin/perl use Expect; $ssh = Expect->spawn('ssh host.com'); $ssh->expect(60,"d: "); print $ssh 'password' . "\n"; $ssh->expect(60,'> '); print $ssh 'ls -l | awk \'{print $5}\''."\n"; $ssh->expect(60,'> '); I dunno, works for me. Austin |
From: <al....@ac...> - 2002-03-13 18:09:39
|
Hello, I am using perl 5.6 with Expect module 1.12 and trying to get the size of a file on a remote server. I tried piping the output of ls -l on the remote server to awk but that only returned the output of the ls -l commend. I searched the archived messages and noticed that this issue was reported as a bug. Does anyone knows if this bug is fixed? For now, I created a short script on the remote server to display the size of the file. The scritpt works fine when it is excuted from within the spawned ssh but I am not sure how to capture its output. I need to compare the returned value (from my script) against the size of a similar file on the local server. Any help is appreciated. Al This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |
From: <al....@ac...> - 2002-03-13 16:07:21
|
Roland, Thank you for your help. kill TERM => $exp->pid; worked as you described. Al *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* Al Pashazadeh Accenture CIO Technology Services - Network Services Dallas, Infomart Phone: (214) 672-4255 VPN: 573-4255 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |
From: <RGi...@a1...> - 2002-03-13 13:10:03
|
> I need > to do is to send a kill signal to a child process, > that is waiting for input, on the remote server. I don't know how > to find > the child process id on the remote server so I thought > trying by sending something similar to CTRL+C. Any comment? Actually, signal propagation is the job of the communicating entity. Just send it to the spawned telnet/ssh client and he should do the rest. kill TERM => $exp->pid; should do the trick. HTH, Roland -- RGi...@cp... |
From: Austin S. <te...@of...> - 2002-03-12 22:57:58
|
On Tue, Mar 12, 2002 at 04:36:46PM -0600, al....@ac... wrote: > David, > > Thank you for your comment. I tried that approach before but what I need > to do is to send a kill signal to a child process, > that is waiting for input, on the remote server. I don't know how to find > the child process id on the remote server so I thought > trying by sending something similar to CTRL+C. Any comment? > Seems like it should work. You may also be able to send it an EOF ("\cd"). Most programs will respond to that also. Something we do here for routers is explicitly send them "exit\r" to make them close a connection, since they've been known to get confused otherwise. Austin |
From: <al....@ac...> - 2002-03-12 22:40:38
|
David, Thank you for your comment. I tried that approach before but what I need to do is to send a kill signal to a child process, that is waiting for input, on the remote server. I don't know how to find the child process id on the remote server so I thought trying by sending something similar to CTRL+C. Any comment? Al This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |
From: Blackstone, J. D. <jda...@ci...> - 2002-03-12 21:43:06
|
You can get control-anything with the special sequence "\cX" in a double-quoted string, where X is the character you want the control of. But that's a Perl question, not an Expect.pm question. :) jdb > -----Original Message----- > From: al....@ac... [mailto:al....@ac...] > Sent: Tuesday, March 12, 2002 3:22 PM > To: exp...@li... > Subject: [Expectperl-discuss] Sending Control Character > > > Hello, > > I need to send a CTRL+C (or CTRL+D) from within an Expect > module, running > on my local server, to a child process that is > waiting for an input on my remote server. Does anybody know > what is the > equivalent character to CTRL+C or CTRL+D that can be > sent to a child process? Thank you. > > > Al > > > > > This message is for the designated recipient only and may contain > privileged, proprietary, or otherwise private information. > If you have > received it in error, please notify the sender immediately > and delete the > original. Any other use of the email by you is prohibited. > > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: <al....@ac...> - 2002-03-12 21:26:17
|
Hello, I need to send a CTRL+C (or CTRL+D) from within an Expect module, running on my local server, to a child process that is waiting for an input on my remote server. Does anybody know what is the equivalent character to CTRL+C or CTRL+D that can be sent to a child process? Thank you. Al This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. |
From: Austin S. <te...@of...> - 2002-03-12 01:28:51
|
On Mon, Mar 11, 2002 at 04:15:35PM -0800, Wim Verhaert wrote: > Does anyone know how to send any control sequences (eg. CTRL+D) to the > expect module? > > Thanks > Expect objects are filehandles. $telnet = Expect->spawn('telnet'); print $telnet "\cd"; Austin |
From: Wim V. <wve...@re...> - 2002-03-12 00:15:36
|
Does anyone know how to send any control sequences (eg. CTRL+D) to the expect module? Thanks Wim |
From: Hal V. <ha...@th...> - 2002-03-08 15:47:32
|
Yes, it's Term::VT102. Oops. The system I'm dealing with has a habit of freezing at times, so VT102 by itself would not work, since I would have no way of detecting a timeout. I agree having a callback for a specific screen X,Y co-ord would be helpful, but it would not help me for this specific system. It always returns the cursor to 80,24 when posting a screen (on the other hand -- that could prove helpful...). If I were used to data structures and OOP, I'd look at finding a way to combine the two -- that would be extremely powerful. One could get callbacks if certain prompts were sent through the VT102, but could also check the exact screen locations, to get more information (with this system that would be a HUGE help). Off the top of my head, I was thinking I could do an expect statement and, after it's matched, feed the exp_before string into VT102. Assuming there's only been one screen of info (or less) since the last expect, that should put it all on the virtual screen, right? I'm going to look into that. Thanks for the comments. Hal On Friday 08 March 2002 08:04 am, RGi...@a1... wrote: > > I've been using Expect for Perl to handle a connection with > > another system > > over a modem and it's been working well, but I've recently found > > IO::VT102. > > That's Term::VT102, right? > > > I've been using IO:VT102 in post processing the capture files. > > Now I'm wondering if it's possible to use this mod with Expect. > > That would let me extract the need information while online. > > > > To use VT102, I need to be able to send it the input strings, like > > $vt->process($mydata). > > An Expect object is just a file handle that you can read from and write > to, so it should be easy to link that to Term::VT102, just read a chunk > and call process() with it. The OUTPUT callback should simply do a > syswrite to the Expect object. > > > Is there some way to feed data coming from the modem into both > > Expect and VT102 at the same time? It would mean I can use > > Expect to tell when data I need is on the screen, then I could > > pull it straight from the virtual VT102 terminal. > > No, you can't use the expect() method concurrently, as this would > consume the characters. Instead, you have to register a ROWCHANGE > callback and do your processing there via normal regexp matches. > > [BTW, what I think is missing from Term::VT102 is the ability to get a > callback when the cursor position enters certain coordinates (to be > able to react to a prompt).] > > Hope this helps, > > Roland |
From: <RGi...@a1...> - 2002-03-08 13:04:50
|
> I've been using Expect for Perl to handle a connection with > another system > over a modem and it's been working well, but I've recently found > IO::VT102. That's Term::VT102, right? > I've been using IO:VT102 in post processing the capture files. > Now I'm wondering if it's possible to use this mod with Expect. > That would let me extract the need information while online. > > To use VT102, I need to be able to send it the input strings, like > $vt->process($mydata). An Expect object is just a file handle that you can read from and write to, so it should be easy to link that to Term::VT102, just read a chunk and call process() with it. The OUTPUT callback should simply do a syswrite to the Expect object. > Is there some way to feed data coming from the modem into both > Expect and VT102 at the same time? It would mean I can use > Expect to tell when data I need is on the screen, then I could > pull it straight from the virtual VT102 terminal. No, you can't use the expect() method concurrently, as this would consume the characters. Instead, you have to register a ROWCHANGE callback and do your processing there via normal regexp matches. [BTW, what I think is missing from Term::VT102 is the ability to get a callback when the cursor position enters certain coordinates (to be able to react to a prompt).] Hope this helps, Roland -- RGi...@cp... |
From: Hal V. <ha...@th...> - 2002-03-08 01:56:30
|
I've been using Expect for Perl to handle a connection with another system over a modem and it's been working well, but I've recently found IO::VT102. I've been using IO:VT102 in post processing the capture files. Now I'm wondering if it's possible to use this mod with Expect. That would let me extract the need information while online. To use VT102, I need to be able to send it the input strings, like $vt->process($mydata). I'm sure if I were more experienced, the answer would be obvious, but I'm still getting used to perl and all the tools it and *nix have. Is there some way to feed data coming from the modem into both Expect and VT102 at the same time? It would mean I can use Expect to tell when data I need is on the screen, then I could pull it straight from the virtual VT102 terminal. Thanks for any thoughts or suggestions. Hal |
From: Yang Tj-A. <AT...@mo...> - 2002-03-07 13:44:48
|
Hi, there I got Expect-1.11 with IO-Stty-0.2,IO-Tty-0.92_02 to compiled and packaged on my solaris 2.6 box and it pass the "perl test.pl". But when I install these packages on solaris 8 and run perl test.pl again, it failed as shown below 1..7 ok 1 ok 2 ok 3 ok 4 not ok 5 # Failed test 5 in test.pl at line 50 ok 6 ok 7 test 5 is a test on getting eof from a process, should I concern about this failing test ? my program seems working fine so far. I am writing web page password changer using expect.pm. please help and I will make up a easy one for inclusion in faq or examples section.(if others think my example is good enough to be included). Thanks tj Install machine solaris 8 information ----------------------------------------------------------------- test> perl -v This is perl, version 5.005_02 built for sun4-solaris Copyright 1987-1998, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5.0 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. test> uname -a SunOS tango 5.8 Generic_108528-06 sun4u sparc SUNW,UltraAX-i2 test> Compile machine information ---------------------------------------------------------------- root> uname -a SunOS bingo 5.6 Generic_105181-12 sun4u sparc SUNW,Ultra-5_10 root> perl -v This is perl, version 5.005_02 built for sun4-solaris Copyright 1987-1998, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5.0 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. root> CC -V CC: WorkShop Compilers 5.0 98/12/15 C++ 5.0 root> gcc -v Reading specs from /opt/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1/specs gcc version 2.8.1 root> -- T.J. Yang |
From: Sorrell, A. <Al_...@tr...> - 2002-03-05 16:06:28
|
Thanks! That's what I needed. Working great now. Al -----Original Message----- From: RGi...@a1... [mailto:RGi...@a1...] Sent: Tuesday, March 05, 2002 6:10 AM To: Sorrell, Al Cc: 'exp...@li...' Subject: Re: RE: [Expectperl-discuss] does timeout => sub{} pass filehandle? > I'm still having a problem trying to "send" from inside a timeout > condition: Oh, sorry for that mistake: as the timeout is shared among all matches (which could be on different spawned programs), its callback doesn't get an expect object, you have to use one from the outer context, i.e. my $exp = new Expect; $exp->raw_pty(1); $exp->spawn(...); $exp->expect($timeout, ... [ timeout => sub { $exp->send() }]); Hope this helps, Roland -- RGi...@cp... |
From: <RGi...@a1...> - 2002-03-05 11:14:40
|
> I'm still having a problem trying to "send" from inside a timeout > condition: Oh, sorry for that mistake: as the timeout is shared among all matches (which could be on different spawned programs), its callback doesn't get an expect object, you have to use one from the outer context, i.e. my $exp = new Expect; $exp->raw_pty(1); $exp->spawn(...); $exp->expect($timeout, ... [ timeout => sub { $exp->send() }]); Hope this helps, Roland -- RGi...@cp... |
From: Sorrell, A. <Al_...@tr...> - 2002-03-04 17:00:10
|
I loaded gcc 2.95.3 and resolved the cpp issue and so installed Expect-1.13_08 & IO-Tty-0.97_01 successfully. The $exp->raw_pty(1) works fine now. Thanks! I'm still having a problem trying to "send" from inside a timeout condition: code frag: my $timeouts=0; $exp->send("\n"); $exp->expect($timeout, ['OVL111', sub { my $fh = shift; $fh->send("login\n"); }], ['-ex','.', sub { my $fh = shift; $fh->send("****\nlogo\n");exp_continue; }], # ['SCH', sub { my $fh = shift; $fh->send("****\nlogo\n");exp_continue; }], # [timeout => sub {die "Timed out trying to login";}] [timeout => sub { $timeouts++; if($timeouts < 5) {my $fh = shift; $fh->send("****\nlogo\n");exp_continue; } else { die "Timed out trying to clear loging";} }] ); results in: TIMEOUT Calling timeout function ARRAY(0x3831fc)... Can't call method "send" on unblessed reference at get_pbx_routes.pl line 166. line 166 is the timeout in the code above ================= This is the original Expect script code that I'm trying to mimic: send -- "\r" expect { timeout {send_error "System still logged in-sending logout\n"; send "****\rlogo\r"} "." {send_error "System still logged in-sending logout\n"; send "****\rlogo\r"} "OVL111" } send -- "login\r" -----Original Message----- From: Sorrell, Al Sent: Thursday, February 28, 2002 11:54 AM To: 'RGi...@cp...' Subject: RE: [Expectperl-discuss] does timeout => sub{} pass filehandle? Thanks for the new material. 1) In trying to perl Makefile.PL, I'm running into a problem. Looks like you changed from 'cc' to 'cpp'. Is cpp really needed, and if so what version (I'm assuming that's gcc's C++ compiler). I currently have 2.8.1 installed, which creates a c++ 2) I really was trying to match "." - this app is going to the console of a Nortel Meridian PBX via a router's AUX port and the logged-in prompt for this thing is "." Thanks, Al -----Original Message----- From: RGi...@a1... [mailto:RGi...@a1...] Sent: Thursday, February 28, 2002 5:23 AM To: Sorrell, Al Cc: 'exp...@li...' Subject: Re: [Expectperl-discuss] does timeout => sub{} pass filehandle? > Solaris 2.6 Expect 1.12 > In all the examples, when a timeout is encountered you simply die(); > In my case, a device can get into a state where what is returned is > unpredictable. There is a specific sequence that I can then send > to log out the previous action and get back to a known state. > However, the code below doesn't seem to work correctly > $exp->expect($timeout, > ['OVL111', sub { my $fh = shift; $fh->send("login\n"); }], > ['\.', sub { my $fh = shift; $fh- > >send("****\nlogo\n");exp_continue;}], Are you matching for a dot here? > [timeout => sub { my $fh = shift; > $fh->send("****\nlogo\n");exp_continue; }] > ); exp_continue for timeout only started working a few beta versions ago. > Using a regex of '.*' would be another way - but risky - > especially until I can get "raw" working. Any suggestions? I'm attaching the latest version, much improved and almost ready for release (I still need a few test results for IO-Tty, especially on HPUX, OSF and SCO). Please try it (be sure to browse the docs for all the new features) and tell me if it solves your problems. Thanks! Roland -- RGi...@cp... |
From: <RGi...@a1...> - 2002-03-04 14:57:57
|
> Here's what I'd like to do with Expect.pm: > > * Spawn a telnet to somewhere. > * Invoke a subshell > * From within that subshell, call another Perl program one or more > times to interact with the telnet process spawned by the parent > process. Let me try to summarize what I think you want to accomplish: * connect to another machine via telnet/whatever * have the user either 1) interact with the other machine 2) or start procedures/macros/scripts/whatever to do more complicated things on the other machine. So what you effectively want to do is to impose yourself between the user and the remote connection. Sounds like a job for interact ()/interconnect()... > My first try was to write a short Perl program that spawned a telnet, > did an expect to get to the prompt, then did 'system("bash");' to get > into the subshell. I then invoked program#2 which tried to interact > with the telnet. I used the pty that the spawned telnet was using > as fd's 0,1 and 2 (found via lsof) as the filename to re-open with > exp_init(), but that didn't work. It did sent the data to the pty, > but it was received by the parent program rather than the spawned > telnet.I suspect I'probably running afoul of the pty master/slave > business,which I'm not very familiar with. Ugh, that sounds twisted. Why do you want to start another shell? If you just want to ask the user what procedure/macro to start, why not do it yourself? Use Readline and just give the user a prompt to enter something, then send that to the other machine or evaluate it yourself. Or use interact() to have the user directly talk to the other machine. If you want to write different perl subroutines for some tasks on the other machine, just get a string from the user and eval() it (there is no need to invent another language/write another parser, you already have perl at hand). That way, the user can call predefined procedures from a library. If you want to write scripts or programs in other languages to handle such tasks, have them set up to use stdin/out to communicate with the other machine, then spawn them with Expect and use interconnect() to get them talking to the spawned telnet connection. I hope I presented some new ideas to get you started into the right direction. Remember: KISS: Keep It Small and Simple! Roland -- RGi...@cp... |
From: <RGi...@a1...> - 2002-03-04 14:27:20
|
> This error occured because of the way I was creating the > $exp object. I wanted to create it before spawning the > command so that I could do a $exp->log_user(0) before > the process started spitting out stuff. Ah, yes, you are a premature coder, this splitting of new() and spawn() was introduced in one of the latest beta versions and is not available in v1.12. And BTW you are right to want to do it that way... Just a few more days 'til the next release... Roland -- RGi...@cp... What I discovered > is that you can go it after just fine, as below: > > $exp = Expect->spawn ( $command, @params ); > $exp->log_user(0); > $exp->expect (..... > > So now things are working. Thought this might help > others trying to do something similar. > > Patrick > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: Austin S. <te...@of...> - 2002-03-03 02:53:19
|
> > But for an ssh or Kerberized telnet session, that won't work - telnet or > ssh has to stay running to encrypt/decrypt the data - the only way to > talk to the remote router is via the pty of ssh/telnet. I could have > the perl/expect program start ssh/telnet, but my program is meant to be > a tool that you run multiple times against the router, so I want the ssh/ > telnet to persist. > > > Another way is to have an expect script that does interact() at > > some point and uses named pipes as i/o. I think that's how things like > > kibitz work. Performance-wise it's less efficient, but probably easier to > > code. > > Easy to code, I like that :-). I had earlier tried using ksh93, > which has a built-in for doing this - when you > start a process and background it with "|&" instead of "&", you > end up with two pipes (meant for use with ksh's "read -p" and "print -p" > commands). I suppose I can try hooking one of the pipes to the Expect > object, and teaching my script to send the output data for the telnet/ssh > session to the other? Something like that would probably be my approach. Austin |
From: Ed R. <er...@pa...> - 2002-03-02 22:27:12
|
Austin Schutz writes: > On Sat, Mar 02, 2002 at 12:40:25AM -0500, Ed Ravin wrote: > > Here's what I'd like to do with Expect.pm: > > * Spawn a telnet to somewhere. > > * Invoke a subshell > > * From within that subshell, call another Perl program one or more > > times to interact with the telnet process spawned by the parent process. > Thirdly, you could have the called perl program call the telnet > expect process and work with it as if it were any other process. It's hard to > tell (for me anyway) what you're trying to accomplish. What I want to do (and why this option won't work) is to set up Kerberized telnet or ssh session to a Cisco router, drop into a shell, and be able to run shell commands that manipulate the router via the session. I've already got this working with regular (cleartext) telnet sessions - the filehandle with the telnet session is inherited by telnet's children - I subshell from telnet and then have the Perl/Expect program use exp_init() to hook up to fd3 and I'm all set. I can call the Perl/Expect program multiple times to manipulate the router via the Telnet session, I can call the editor or other shell programs as needed, and when I'm done I exit the shell and return back to the telnet prompt. But for an ssh or Kerberized telnet session, that won't work - telnet or ssh has to stay running to encrypt/decrypt the data - the only way to talk to the remote router is via the pty of ssh/telnet. I could have the perl/expect program start ssh/telnet, but my program is meant to be a tool that you run multiple times against the router, so I want the ssh/ telnet to persist. > Another way is to have an expect script that does interact() at > some point and uses named pipes as i/o. I think that's how things like > kibitz work. Performance-wise it's less efficient, but probably easier to > code. Easy to code, I like that :-). I had earlier tried using ksh93, which has a built-in for doing this - when you start a process and background it with "|&" instead of "&", you end up with two pipes (meant for use with ksh's "read -p" and "print -p" commands). I suppose I can try hooking one of the pipes to the Expect object, and teaching my script to send the output data for the telnet/ssh session to the other? |
From: Hal V. <ha...@th...> - 2002-03-02 14:36:42
|
I spent last week developing a program that does almost the same thing and this week I've been successfully testing and using it online with another system. If you're going through the modem, or another device, you can open it like a file (open DEVICE, "+>/dev/modem/"). There are a few other commands to use to handle IO. I can't remember them, but if you look at the MODEMINIT example in the tutorial, included with the Expect module, you will see all you need for initializing the connection with the modem and for closing it. This method, which I am using quite successfully (with only 1 problem, which I'll mention in a bit), lets you easily dial in and communicate with another computer using only perl, no telnet, no other programs at all. I love it, since I was previously using TCL and the Expect that was developed using TCL. That system controlled Minicom, which worked well, but I found TCL a pain to program in, and, although I like Minicom, I feel much more comfortable using only perl, instead of TCL, Expect, and Minicom. Fewer programs means less to go wrong. You send any commands to the modem (or whatever device you want to open) this way, which gives you full control. If you're using any capture files, you may get many more escape and control codes in the capture than you're used to, but they can be purged with a simple filter subroutine (or awk, if you want). There are examples in the tutorial files that also use telnet (I think). If, for some reason, you don't have the tutorial files, you can download the lastest archive from CPAN, and they're in there. If that doesn't work, I'll be glad to send them to you. The only problem I'm having with this setup is when I try to capture screenfuls of ino. The program I'm communicating with prints a screen of info, then I type in a new ID number, and it prints a new screen of info. I use Expect to detect when each screen is finished displaying. After the last screen, I terminate a loop, then close the log file. I've found if I don't display the last screen again, and use Expect to wait for the display to complete again, the last screen is never caught in the capture file. In this case the last screen is displayed twice to get it once. It seems like the input for the last "expect" command is tossed and never makes it to the log file. This can be worked around, so it isn't a huge problem, but I've noticed it, so I thought a heads-up was appropriate. Hal On Saturday 02 March 2002 12:40 am, you wrote: > Here's what I'd like to do with Expect.pm: > > * Spawn a telnet to somewhere. > * Invoke a subshell > * From within that subshell, call another Perl program one or more > times to interact with the telnet process spawned by the parent process. > > My first try was to write a short Perl program that spawned a telnet, > did an expect to get to the prompt, then did 'system("bash");' to get > into the subshell. I then invoked program#2 which tried to interact > with the telnet. I used the pty that the spawned telnet was using > as fd's 0,1 and 2 (found via lsof) as the filename to re-open with > exp_init(), but that didn't work. It did sent the data to the pty, > but it was received by the parent program rather than the spawned telnet. > I suspect I'probably running afoul of the pty master/slave business, > which I'm not very familiar with. > > Any idea how to get what I want to happen? Is it even possible? > > Thanks, > -- Ed > > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |