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: <db...@CT...> - 2003-05-01 19:36:24
|
Since you're looking at standard cisco router output, it sounds like you're seeing linefeeds without carriage-returns instead of backspaces. Depending on how you're capturing and echoing the text, you could set $Expect::Log_Stdout=0 and in your expect loop, do your own echoing from the session, doing some search-and-replace to fix this. I'm guessing that you're seeing this just looking at STDOUT from router (session) to your console. I'm wondering if something like this would work for you: $Expect::Log_Stdout=0; $exp->send(".......\n"); expect($timeout, '-i', $obj, 'eof', sub { #-------------------------------------------------- # do whatever is required if telnet session closes # on us, like close any files that are open. #-------------------------------------------------- } '-re', "([^\r\n]+)[\r\n]+", sub { #--------------------------------------------------- # if we see a line of text from router, grab all up # to EOL characters, and echo to STDOUT using \n as # our line termination character. Go back into loop # and wait for the next line from the router #--------------------------------------------------- my $match = ($obj->matchlist)[0]; print "$match\n"; exp_continue; } '-re', "[#>]+\s*", #--------------------------------------------------- # if we see the router prompt, do nothing (drop out) #--------------------------------------------------- ); "Miguel" <mt...@mt...> Sent by: To: <exp...@li...> exp...@li...urc cc: eforge.net Subject: [Expectperl-discuss] Solaris horizontal linewrap problem 05/01/2003 02:39 PM Summary ------- Problem with horizontal line-wrap when spawning telnet on SunOS 5.8. How do I turn off this 'feature' of solaris in a portable way? Detail ------ I developed some perl code which uses Expect on a linux box. The script spawns telnet to talk to a cisco router. I encountered a problem when I moved the script to a Solaris box (where I don't have much operational experience). When I $exp->send(a-line-of-text-which-is-very-long) then the echoed results has lots of backspaces in it. I can see this behavior when I run Solaris telnet from the command line ... rather than wrapping to the next line the telnet is (apparently) doing me the 'favor' of wrapping the text on the same line. The result is that my script is broken. I tried setting $exp->raw_tty(1) ... no joy I tried $exp->spawn('COLUMNS=250 ; telnet foo') ... no joy ... although this does work from the command line I tried $exp->spawn('TERM=dumb ; telnet foo') ... no joy ... although this does work from the command line I didn't see anything in the man page I searched the web and found a few people complaining, but did not see a fix. bash has a similar feature. I saw one person complaining that bash was broken was doing this to him on his Solaris system. I suspect that this may have been a case of Solaris doing it to him. Any suggestions? Thanks in advance for your help. Miguel ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Miguel <mt...@mt...> - 2003-05-01 18:42:38
|
Summary ------- Problem with horizontal line-wrap when spawning telnet on SunOS 5.8. How do I turn off this 'feature' of solaris in a portable way? Detail ------ I developed some perl code which uses Expect on a linux box. The script spawns telnet to talk to a cisco router. I encountered a problem when I moved the script to a Solaris box (where I don't have much operational experience). When I $exp->send(a-line-of-text-which-is-very-long) then the echoed results has lots of backspaces in it. I can see this behavior when I run Solaris telnet from the command line ... rather than wrapping to the next line the telnet is (apparently) doing me the 'favor' of wrapping the text on the same line. The result is that my script is broken. I tried setting $exp->raw_tty(1) ... no joy I tried $exp->spawn('COLUMNS=250 ; telnet foo') ... no joy ... although this does work from the command line I tried $exp->spawn('TERM=dumb ; telnet foo') ... no joy ... although this does work from the command line I didn't see anything in the man page I searched the web and found a few people complaining, but did not see a fix. bash has a similar feature. I saw one person complaining that bash was broken was doing this to him on his Solaris system. I suspect that this may have been a case of Solaris doing it to him. Any suggestions? Thanks in advance for your help. Miguel |
From: <db...@CT...> - 2003-04-24 12:50:56
|
Looks like a permissions problem with opening pty's in the /dev/.. directory. Expect needs to open these so as to use them to buffer IO between any spawned processes and your script. If it were me, I'd do a= re-run of "make test" on the IO::Tty module again to have it check all required functionality for you on your system. I'd think that would cl= ear this up. If you can't do that, maybe you could check write permissions= on these directories. = =20 "Kemp, Donald" <dk...@em...> = =20 Sent by: To: = "Expectperl-Discuss (E-mail)" =20 exp...@li...urc <expect= per...@li...> =20 eforge.net cc: = =20 Subject= : [Expectperl-discuss] Problem with Pty.pm / Tty.pm=20 = =20 04/24/2003 07:53 AM = =20 = =20 = =20 Hi, Can anyone tell me why I get these messages when using expect ...... IO::Tty::open_slave(nonfatal): open(/dev/pts/4): Permission denied at /usr/local/lib/perl5/site_perl/5.6.1/aix-thread/IO/Pty.pm line 24. pty_allocate(nonfatal): open(/dev/ptc): Permission denied at /usr/local/lib/perl5/site_perl/5.6.1/aix-thread/IO/Pty.pm line 24. What do these messages actually mean? Best Regards / Vriendelijke groeten / Mit Freundlichen Gr=FC=DFen / Cordialement / Cordiali Saluti / Med V=E4nlig H=E4lsning / Atentamente Donald.E.S.Kemp AT&T Labs Network Management Solutions, Building 6000, Langstone Technology Park, Langstone Road, Havant, Hampshire, United Kingdom, PO9 1SA Phone: +44(0)23 9222 8424 email: dk...@em... ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss = |
From: Kemp, D. <dk...@em...> - 2003-04-24 11:53:34
|
Hi, Can anyone tell me why I get these messages when using expect ...... IO::Tty::open_slave(nonfatal): open(/dev/pts/4): Permission denied at /usr/local/lib/perl5/site_perl/5.6.1/aix-thread/IO/Pty.pm line 24. pty_allocate(nonfatal): open(/dev/ptc): Permission denied at /usr/local/lib/perl5/site_perl/5.6.1/aix-thread/IO/Pty.pm line 24. What do these messages actually mean? =20 Best Regards / Vriendelijke groeten / Mit Freundlichen Gr=FC=DFen / = Cordialement / Cordiali Saluti / Med V=E4nlig H=E4lsning / Atentamente Donald.E.S.Kemp AT&T Labs Network Management Solutions, Building 6000, Langstone Technology Park, Langstone Road, Havant, Hampshire, United Kingdom, PO9 1SA Phone: +44(0)23 9222 8424 email: dk...@em... |
From: Austin S. <te...@of...> - 2003-04-22 18:44:44
|
On Tue, Apr 22, 2003 at 12:26:32PM -0600, Ed Arnold wrote: > I've attached two short scripts to this email: > > o "expsu" is an expect/tcl program which su-s to another user. It works > correctly. > o "explsu" is a perl program which attempts to do the same thing with > the Expect module. It doesn't work; it sees the shell prompt, but it > exits prematurely somewhere in interact(). > What output have you gotten from turning on debug and exp_internal? What platform are you running this on? I don't see any obvious bugs - at first glance it looks like it should run just fine. Austin > Is there something I need to change/add in explsu to make it work, or is > this a bug in perl's Expect module? > #!/usr/local/bin/expect > > set user test > set pasw pop,eye > set send_slow { 1 .1 } > spawn /bin/su $user > expect -re "Password: " > send -s "$pasw\r" > > interact { > } > #!/local/s/perl/bin/perl > > use Expect; # www.cpan.org: Expect-1.15, IO-Stty-.02, IO-Tty-1.02 > use IO::Stty; > > $ENV{PATH} = "/bin"; $ENV{SHELL} = "/bin/sh"; > my $user = "test"; > my $passwd = "pop,eye"; > my $exp = new Expect(); > #$exp->manual_stty(1); > #$ostty = IO::Stty::stty(\*STDIN,'-g'); > $exp->slave->clone_winsize_from(\*STDIN); > $exp->log_stdout(0); > $exp->exp_internal(0); > $Expect::Debug = 0; > #$exp->raw_pty(1); # don't go there > $exp->spawn("/bin/su",$user); > $expstr = "Password: "; > $exp->expect(4,$expstr); > $got = $exp->exp_match(); print "$expstr TILT!\n" if $got ne $expstr; > $exp->send_slow(0.1,"$passwd\r\n"); > $expstr = "\$ "; > $exp->expect(4,$expstr); > $got = $exp->exp_match(); print "$expstr TILT!\n" if $got ne $expstr; > print "$expstr"; # print sh prompt and interact > $exp->interact(); |
From: Ed A. <er...@uc...> - 2003-04-22 18:26:40
|
I've attached two short scripts to this email: o "expsu" is an expect/tcl program which su-s to another user. It works correctly. o "explsu" is a perl program which attempts to do the same thing with the Expect module. It doesn't work; it sees the shell prompt, but it exits prematurely somewhere in interact(). Is there something I need to change/add in explsu to make it work, or is this a bug in perl's Expect module? |
From: Sascha G. (02838) <Sas...@al...> - 2003-04-22 13:37:14
|
Chris Snyder wrote: > A copy and paste of your code, replacing the: > $mtnm->spawn("csteMTNM -c"); > with: > $mtnm->spawn("ls"); > seems to indicate success. > > Are you sure your Expect install is kosher? > Chris I did not install Expect cause i have no root privilegs. I use it locally but the test.pl and also my script worked until now. If i modify my code this way: sub start { $mtnm = new Expect; # $mtnm->raw_pty(1); $mtnm->spawn("csteMTNM -c"); $mtnm->log_file("rmtest.log", "w"); $mtnm->expect(30, "STARTUP FINISHED\r\n"); } I get the following error message: Can't locate object method "_init_vars" via package "Expect=GLOB(0x109088)" at /tools/perl-5.6.0/lib/site_perl/5.6.0/Expect.pm line 93. Cannot exec `': Maybe it is all about the Expect installation like you mentioned. I think it is weired that $var = new Expect; $var->spawn("ls"); does not work but $var = Expect->spawn("ls); does work for me. |
From: Chris S. <cas...@pe...> - 2003-04-22 13:19:49
|
A copy and paste of your code, replacing the: $mtnm->spawn("csteMTNM -c"); with: $mtnm->spawn("ls"); seems to indicate success. Are you sure your Expect install is kosher? Chris At 02:54 PM 4/22/2003 +0200, Sascha Gagalon (02838) wrote: >thx, my fault. > >now it looks like that: > >#!/tools/perl-5.6.0.sol26/bin/perl > >#use strict; >$^W = 1; # warnings too > > >use Expect; >#$Expect::Exp_Internal = 1; >#$Expect::Debug = 1; > > >&start; >$mtnm->hard_close(); >exit(0); > > > >sub start >{ > $mtnm = new Expect; > $mtnm->raw_pty(1); > $mtnm->spawn("csteMTNM -c"); > $mtnm->log_file("rmtest.log", "w"); > $mtnm->expect(30, "STARTUP FINISHED\r\n"); >} > > >and the error message tells me: > >ERROR: cannot find method `raw_pty' in class Expect at ./rmtest.pl line 25 > >Cannot exec `': > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Expectperl-discuss mailing list >Exp...@li... >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Chris S. <cas...@pe...> - 2003-04-22 12:59:01
|
You might find that "$mtnm = new Expect;" will do wonders for providing an object upon which to call methods such as 'raw_pty();' God bless, Chris At 08:39 AM 4/22/2003 -0400, John Mahoney wrote: >On Tue, Apr 22, 2003 at 02:21:09PM +0200, Sascha Gagalon (02838) wrote: >> I am using Expect-1.15 and IO-Tty-1.02 on Sun Solaris 2.6 >> >> A little code: >> >> #!/tools/perl-5.6.0.sol26/bin/perl >> >> #use strict; >> $^W = 1; # warnings too >> >> >> use Expect; >> #$Expect::Exp_Internal = 1; >> #$Expect::Debug = 1; >> >> >> &start; >> $mtnm->hard_close(); >> exit(0); >> >> >> >> sub start >> { >> $mtnm = Expect->spawn("csteMTNM -c"); >> $mtnm->raw_pty(1); >> $mtnm->log_file("rmtest.log", "w"); >> $mtnm->expect(30, "STARTUP FINISHED\r\n"); >> } >> >> >> What's wrong? >> > >I believe that you need to place > $mtnm->raw_pty(1); >BEFORE > $mtnm = Expect->spawn("csteMTNM -c"); > >At least my notes tell that I must set pty to raw mode >before spawning... > >-- >John Mahoney <ex...@h0...> > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Expectperl-discuss mailing list >Exp...@li... >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Sascha G. (02838) <Sas...@al...> - 2003-04-22 12:55:00
|
thx, my fault. now it looks like that: #!/tools/perl-5.6.0.sol26/bin/perl #use strict; $^W = 1; # warnings too use Expect; #$Expect::Exp_Internal = 1; #$Expect::Debug = 1; &start; $mtnm->hard_close(); exit(0); sub start { $mtnm = new Expect; $mtnm->raw_pty(1); $mtnm->spawn("csteMTNM -c"); $mtnm->log_file("rmtest.log", "w"); $mtnm->expect(30, "STARTUP FINISHED\r\n"); } and the error message tells me: ERROR: cannot find method `raw_pty' in class Expect at ./rmtest.pl line 25 Cannot exec `': |
From: John M. <ex...@h0...> - 2003-04-22 12:40:32
|
On Tue, Apr 22, 2003 at 02:21:09PM +0200, Sascha Gagalon (02838) wrote: > I am using Expect-1.15 and IO-Tty-1.02 on Sun Solaris 2.6 > > A little code: > > #!/tools/perl-5.6.0.sol26/bin/perl > > #use strict; > $^W = 1; # warnings too > > > use Expect; > #$Expect::Exp_Internal = 1; > #$Expect::Debug = 1; > > > &start; > $mtnm->hard_close(); > exit(0); > > > > sub start > { > $mtnm = Expect->spawn("csteMTNM -c"); > $mtnm->raw_pty(1); > $mtnm->log_file("rmtest.log", "w"); > $mtnm->expect(30, "STARTUP FINISHED\r\n"); > } > > > What's wrong? > I believe that you need to place $mtnm->raw_pty(1); BEFORE $mtnm = Expect->spawn("csteMTNM -c"); At least my notes tell that I must set pty to raw mode before spawning... -- John Mahoney <ex...@h0...> |
From: Sascha G. (02838) <Sas...@al...> - 2003-04-22 12:21:23
|
I am using Expect-1.15 and IO-Tty-1.02 on Sun Solaris 2.6 A little code: #!/tools/perl-5.6.0.sol26/bin/perl #use strict; $^W = 1; # warnings too use Expect; #$Expect::Exp_Internal = 1; #$Expect::Debug = 1; &start; $mtnm->hard_close(); exit(0); sub start { $mtnm = Expect->spawn("csteMTNM -c"); $mtnm->raw_pty(1); $mtnm->log_file("rmtest.log", "w"); $mtnm->expect(30, "STARTUP FINISHED\r\n"); } What's wrong? |
From: Christian G. <cg...@hq...> - 2003-04-10 23:03:05
|
>> If this poster is still on the list, could you provide >> some additional details about your environment? I am >> on Solaris 2.6, perl 5.004_04. There was no Policy.sh >> in this release and the Configure script autodetects >> the byte order to be 4321. I have tried it with 4321 >> and 1234 and still the spawned process hangs. > I am not said poster, but my understanding is that byte order changes > from 4321 to 2143, swapping bytes in the word. I was the inital poster, and I was using perl 5.6.1. I do not know if this option is implemented on perl 5.004_04. I also think that Policy.sh is something that gets generated by running ./Configure, for you to use later. In my build process, this allows to pre-define configration variables and then run ./Configure -der to merge your values with the autodetected values. I can confirm that the byte order autodetected by ./Configure is "4321", and that the configuration variable to use is "byteorder", at least for 5.6.1. My problem was that this auto-detection is turned off when I had some other option turned on... -- cg |
From: Austin S. <te...@of...> - 2003-04-10 22:27:59
|
> +http://sourceforge.net/mailarchive/forum.php?thread_id=1896340&forum_id=6382 > > If this poster is still on the list, could you provide > some additional details about your environment? I am > on Solaris 2.6, perl 5.004_04. There was no Policy.sh > in this release and the Configure script autodetects > the byte order to be 4321. I have tried it with 4321 > and 1234 and still the spawned process hangs. I am not said poster, but my understanding is that byte order changes from 4321 to 2143, swapping bytes in the word. I am, of course, probably wrong as usual. Well, you only have 24 different possibilities anyway :-) Austin > > I appreciate any suggestions. > Jeff > > ===== > Planet Earth (tm) > http://jefferycann.com/ > > __________________________________________________ > Do you Yahoo!? > Yahoo! Tax Center - File online, calculators, forms, and more > http://tax.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger > for complex code. Debugging C/C++ programs can leave you feeling lost and > disoriented. TotalView can help you find your way. Available on major UNIX > and Linux platforms. Try it free. www.etnus.com > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |
From: Jeffery C. <jc...@ya...> - 2003-04-10 21:53:12
|
I read on this list a posting from last month regarding the spawn command in expect-perl. I observe the same behavior: 1. Spawn generates a new process for the command - I see it in the process table and I can see that it is running and collecting output. 2. Expect perl module will wait indefinitely and not return control from the Expect->spawn(). The poster said: "It turns out that I compiled perl with the wrong value for "byteorder". How that came in there is a long story, but I do think it is a bug that a specific setting for "byteorder" in Policy.sh is ignored when "crosscompile" is defined... but it isn't an expectperl bug :)" +http://sourceforge.net/mailarchive/forum.php?thread_id=1896340&forum_id=6382 If this poster is still on the list, could you provide some additional details about your environment? I am on Solaris 2.6, perl 5.004_04. There was no Policy.sh in this release and the Configure script autodetects the byte order to be 4321. I have tried it with 4321 and 1234 and still the spawned process hangs. I appreciate any suggestions. Jeff ===== Planet Earth (tm) http://jefferycann.com/ __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com |
From: Ed A. <er...@uc...> - 2003-04-10 21:21:56
|
I'm looking for someone who knows the internals of Expect.pm well enough to tell me if there is a mod I can make which will cause the following program to work. The environment is: solaris-9, Expect-1.15, IO-Stty-.02, IO-Tty-1.02, perl-5.6.0. The following program forks /bin/su and feeds it a password in the hopes of getting a shell with the permissions of another user, in this case user "test". No, this isn't what I really want to do; the application I need this for is a challenge-response thing. I cut the c-r code down to the simpler example below, which reproduces the problem. The problem is that the /bin/sh exec-ed by /bin/su dies almost immediately, as evidenced by control exiting from interact() immediately. I can see the '$ ' prompt from sh, but that's about it. In the debug output, I see an "Attempting interconnection" followed by setting of tty modes on fd 4, and then an immediate close of fd 4 & 5. I tried fooling around with IO::Stty to try to set the tty modes back to cooked, but that didn't help. Perhaps su does something horrible with file descriptors? The petulant code is: #!/local/s/perl-5.6.0/bin/perl use Expect; use IO::Stty; $ENV{PATH} = "/bin"; $ENV{SHELL} = "/bin/sh"; my $user = "test"; my $passwd = "pop,eye"; my $exp = new Expect(); #$exp->manual_stty(1); #$ostty = IO::Stty::stty(\*STDIN,'-g'); $exp->slave->clone_winsize_from(\*STDIN); $exp->log_stdout(0); $exp->exp_internal(0); $Expect::Debug = 1; #$exp->raw_pty(1); # don't go there $exp->spawn("/bin/su",$user); $expstr = "Password: "; $exp->expect(4,$expstr); $got = $exp->exp_match(); print "$expstr TILT!\n" if $got ne $expstr; $exp->send("$passwd\n"); $expstr = "\$ "; $exp->expect(4,$expstr); $got = $exp->exp_match(); print "$expstr TILT!\n" if $got ne $expstr; print "$expstr"; # print sh prompt and interact $exp->interact(); |
From: BLACKSTONE, J. D. <jda...@ci...> - 2003-04-10 19:41:24
|
> -----Original Message----- > From: Roland Giersig [mailto:RGI...@cp...] > Sent: Thursday, April 10, 2003 2:08 PM > To: exp...@li... > Subject: Re: [Expectperl-discuss] SUCCESS! parsing non-ascii char's > > > Sorry for replying so late... > > >> It would theoretically be possible to write a program that > >>maintained an 80x24 "screen" array of characters, read the control > >>codes, and updated the appropriate places in the array. If you do, > >>put it on CPAN!!! But I didn't find it necessary. > > > It already is: Term::VT102 > > Complete with position-dependend triggers, a kind of 2-dimensional > Expect. No need to reinvent the wheel... ;o) I will wait for the next version to support 3-dimensions. ;) > Sorry for replying so late... Four years for me. ;) Just kidding. I'm glad to hear it's out there! jdb |
From: Roland G. <RGI...@cp...> - 2003-04-10 19:08:15
|
Sorry for replying so late... >> It would theoretically be possible to write a program that maintained an >>80x24 "screen" array of characters, read the control codes, and updated the >>appropriate places in the array. If you do, put it on CPAN!!! But I didn't >>find it necessary. It already is: Term::VT102 Complete with position-dependend triggers, a kind of 2-dimensional Expect. No need to reinvent the wheel... ;o) Hope this helps, Roland |
From: John M. <ex...@h0...> - 2003-04-10 18:01:47
|
On Tue, Apr 08, 2003 at 03:10:44PM -0500, BLACKSTONE, J. DAVID wrote: > > > -----Original Message----- > > From: Christian Goetze [mailto:cg...@hq...] > > Sent: Tuesday, April 08, 2003 2:22 PM > > To: exp...@li... > > Subject: Re: [Expectperl-discuss] parsing non-ascii char's > > > > > > > Thx for your suggestion and I can see some merit here. > > > I am, however, starting to think I am off topic for this list. > > > > > > My real problem is that I do not have multiple lines of > > > data to parse. It's all one long line with lots of > > > control chars. > > > > > > When I print the data to a file > > > cat <filename> > > > shows output that looks just like my telnet session. > > > cat -v <filename> > > > shows all the ugly special chars > > > wc -l <filename> > > > shows I have one line of data and > > > cat <filename> | wc -l > > > still tells me I have one line of data. > > > > What you need here is a terminal emulator. If you're really > > unlucky, the other side will optimize redraws and you will > > not easily get the correct picture. As a first step, you > > could simply try ignoring the special chars, but you may end > > up having to emulate the screen and do "screen scraping". > > I have had to do some of that and it was not fun. Two things that might > help you: > > If you capture your session to a file, write a program to "play it back" > as a "movie" by clearing the screen and sending each character to the screen > in sequence with a small delay in between (like 0.1 seconds). > > The terminal garbage may likely include codes that position the cursor. I > think in my case those codes were something like escape, control-[ , row, > semicolon, height, control-G. Or something awful like that; I can't > remember what. But I could parse out the row and column and use it. I > wrote a program to take a cut and paste terminal screen capture and print it > out with - and | characters, with row and column numbers at the top and > bottom. I made printouts of these to see where my data displayed, and > checked the session capture log to make sure the row and column appeared > exactly in the control garbage. Watching the movie also became important > because sometimes things did not print out on the screen in the order you > would expect. > > It would theoretically be possible to write a program that maintained an > 80x24 "screen" array of characters, read the control codes, and updated the > appropriate places in the array. If you do, put it on CPAN!!! But I didn't > find it necessary. > > jdb Thanks to everyone for your help. The biggest things to help me were: use \c for reg exp's involving control chars; learning that someone else had faced text that included strings similar to "escape, control-[ , row, semicolon, height, control-G" etc (yuk!); reading my text with /usr/local/bin/less which is kind enough to display chars like "ESC[12;31HPort:"; Presently, I am successfully parsing this string with: #start by stripping the CTRL-[ chars $line =~ s/\c[//g; #strip the stupid NULL MAC $line =~ s/00-00-00-00-00-00//; #find the 1st MAC if ( $line =~ /(..\-..\-..\-..\-..\-..)/ ) { $first_mac = $1; } #throw away everything before the 1st MAC $line =~ s/^.*$first_mac/$first_mac/; #replace weird chars before each MAC $line =~ s/\[\d+\;1H/\n/g; #replace weird chars before each Port $line =~ s/\[\d+\;\d+H/\t/g; #find the last line and split it off if ( $line =~ m#\s+\[\d+K(Press\s.*)# ) { $last_line = $1; #(I need this $last_line data too) $line =~ s/\s+\[\d+KPress\s.*//; } @array = split ( /\n/, $line ); push ( @all_arrays, @array ); Seems like a lot a work to get what I want, but it works and I can get on with solving a problem. Thx again for all the help. -- John Mahoney ex...@h0... |
From: <db...@CT...> - 2003-04-08 22:50:59
|
hmm... That shouldn't matter. However to find all matches, the example I gave would have to be modified slightly. You can do multiple expect matches for a known pattern on a single input stream, or single line of text, etc.. . A modified example that would find all mac's on a single line of output would look something like this (below). Each time it matched on a MAC address, it would print it, and then jump back into the input stream looking for the next one: expect($timeout, '-i', $session, '-re', "(..-..-..-..-..-..)", sub { my $macAddr= ($session->matchlist)[0]; print "mac $macAddr found\n"; exp_continue; } ); of course, the only way out of this loop is timeout, so I'd probably throw in there something inthe way of a match to deal with your switch prompt. I Really think there should be no problem parsing this kind of input stream you describe. If you cannot get this working, only thing I can suggest is you might want to run using internal diagnostics turned on. (exp_internal=1 or something like this) and see what Expect is trying to match on. If it's just VT220 or something terminal emulation, then no reason expect cannot handle these characters, and line-by-line matching is not required for using an expect loop. John Mahoney <ex...@h0...ient2. To: db...@ct..., attbi.com> exp...@li..., exp...@li... 04/08/2003 03:03 PM cc: Subject: Re: [Expectperl-discuss] parsing non-ascii char's Thx for your suggestion and I can see some merit here. I am, however, starting to think I am off topic for this list. My real problem is that I do not have multiple lines of data to parse. It's all one long line with lots of control chars. When I print the data to a file cat <filename> shows output that looks just like my telnet session. cat -v <filename> shows all the ugly special chars wc -l <filename> shows I have one line of data and cat <filename> | wc -l still tells me I have one line of data. I think I have to teach the script to break this output into separate lines. Maybe this is an IO::Stty puzzle or something. Again, thx for your suggestion. -- Thx John Mahoney On Tue, Apr 08, 2003 at 01:53:32PM -0400, db...@CT... wrote: > > Generally speaking, those characters shouldn't be a problem; just ignore > them. I'm assuming you're just interested in the printable stuff. > > My approach is to match on one line at a time, and then parse that match > (an arbitrary line) for the desired info, only because it's what I'm used > to. In the Tcl version, this keeps the expect buffers flushing as you look > for your match and this simulates more of a perlish feel. That's just > personal preference. The point really is just parse out what you need and > forget the rest. > > For the purpose of illustration, I'll assume you are looking for MAC > addresses and ports they're on. So for each line where we see something > that looks like a mac address followed by "Port: ", parse this stuff out > and print it to stdout: > > #!/usr/local/bin/perl > > use Expect; > > $Expect::Log_Stdout=0; > > $session = Expect->spawn("/bin/cat /tmp/mac.txt"); > $timeout = 10; > > expect($timeout, > '-i', $session, > '-re', "([^\r\n]+)[\r\n]+", sub { > my $line = ($session->matchlist)[0]; > if ($line =~ /(..-..-..-..-..-..).*Port:\s+(\d+)/) { > print "mac $1 found on port $2\n"; > } > exp_continue; > } > ); > > I simply spawned a "cat" of the snippet of Catalyst output you included > with your email to simulate the effect, but obviously this would be > replaced with the login sequence and telnet specifics of a real session. I > didn't bother doing the shift in the sub { } portion of code because I'm > assuming that $session is the only object you have (i.e., you have spawned > only one telnet to Catalyst switch). You can use fancier patterns if you > feel it's warranted to eliminate ambiguity but that would be up to you. > > Hope this helps, > > David Basham > CTC Communications > > > > > > John Mahoney > <ex...@h0...t To: exp...@li... > bi.com> cc: > Sent by: Subject: [Expectperl-discuss] parsing non-ascii char's > exp...@li...urc > eforge.net > > > 04/08/2003 08:38 AM > > > > > > > Could use some tips on how to handle/translate non-ascii > char's. > > I am using Expect.pm v 1.15 > perl, v5.6.1 > running on a Solaris 8 box. > > I am using expect to log into Nortel switches and I want > to gather the forwarding database and vlan info. > > When I simply telnet into a switch, I can see the > terminal screen cleared and then get text that looks > like: > MAC Address Table > > Aging Time: [ 300 seconds ] > Find an Address: [ 00-00-00-00-00-00 ] > Fast Aging: [ Enabled ] > > 00-00-86-1D-BF-BF Port: 11 > 00-00-86-4D-68-D4 Port: 1 > etc, > BUT it's really one long line with lots of special > char's in it. > > I've tried several things including adding the line > $exp->raw_pty(1); > but, so far, I've been disappointed. I'm wondering if I > can get Expect, IO:Stty, and/or IO:Tty to send me text > that's easier to parse. > > -- > Thx > John Mahoney > ex...@h0... > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > > |
From: BLACKSTONE, J. D. <jda...@ci...> - 2003-04-08 20:10:23
|
> -----Original Message----- > From: Christian Goetze [mailto:cg...@hq...] > Sent: Tuesday, April 08, 2003 2:22 PM > To: exp...@li... > Subject: Re: [Expectperl-discuss] parsing non-ascii char's > > > > Thx for your suggestion and I can see some merit here. > > I am, however, starting to think I am off topic for this list. > > > > My real problem is that I do not have multiple lines of > > data to parse. It's all one long line with lots of > > control chars. > > > > When I print the data to a file > > cat <filename> > > shows output that looks just like my telnet session. > > cat -v <filename> > > shows all the ugly special chars > > wc -l <filename> > > shows I have one line of data and > > cat <filename> | wc -l > > still tells me I have one line of data. > > What you need here is a terminal emulator. If you're really > unlucky, the other side will optimize redraws and you will > not easily get the correct picture. As a first step, you > could simply try ignoring the special chars, but you may end > up having to emulate the screen and do "screen scraping". I have had to do some of that and it was not fun. Two things that might help you: If you capture your session to a file, write a program to "play it back" as a "movie" by clearing the screen and sending each character to the screen in sequence with a small delay in between (like 0.1 seconds). The terminal garbage may likely include codes that position the cursor. I think in my case those codes were something like escape, control-[ , row, semicolon, height, control-G. Or something awful like that; I can't remember what. But I could parse out the row and column and use it. I wrote a program to take a cut and paste terminal screen capture and print it out with - and | characters, with row and column numbers at the top and bottom. I made printouts of these to see where my data displayed, and checked the session capture log to make sure the row and column appeared exactly in the control garbage. Watching the movie also became important because sometimes things did not print out on the screen in the order you would expect. It would theoretically be possible to write a program that maintained an 80x24 "screen" array of characters, read the control codes, and updated the appropriate places in the array. If you do, put it on CPAN!!! But I didn't find it necessary. jdb |
From: BLACKSTONE, J. D. <jda...@ci...> - 2003-04-08 20:01:16
|
> -----Original Message----- > From: John Mahoney [mailto:ex...@h0...] > Sent: Tuesday, April 08, 2003 2:03 PM > To: db...@CT...; > exp...@li...; > exp...@li... > Subject: Re: [Expectperl-discuss] parsing non-ascii char's > > > Thx for your suggestion and I can see some merit here. > I am, however, starting to think I am off topic for this > list. > > My real problem is that I do not have multiple lines of > data to parse. It's all one long line with lots of > control chars. > > When I print the data to a file > cat <filename> > shows output that looks just like my telnet session. > cat -v <filename> > shows all the ugly special chars > wc -l <filename> > shows I have one line of data and > cat <filename> | wc -l > still tells me I have one line of data. > > I think I have to teach the script to break this output > into separate lines. > > Maybe this is an IO::Stty puzzle or something. I'm suspecting all you need is some training with regular expressions. Start with the Llama book, the Camel book, or the Perl regular expressions tutorial (http://www.perldoc.com/perl5.8.0/pod/perlretut.html) or quick start (http://www.perldoc.com/perl5.8.0/pod/perlrequick.html). You should be able to keep that one line and break it up into separate strings (try the split function) or use it over and over again with multiple operations. By and large, the presence of control characters and/or 8-bit characters shouldn't interfere with this, but if you need to represent a control character in a string or expression you can do so with for example "\cX" to represent control-X. jdb |
From: Christian G. <cg...@hq...> - 2003-04-08 19:24:01
|
> Thx for your suggestion and I can see some merit here. > I am, however, starting to think I am off topic for this > list. > > My real problem is that I do not have multiple lines of > data to parse. It's all one long line with lots of > control chars. > > When I print the data to a file > cat <filename> > shows output that looks just like my telnet session. > cat -v <filename> > shows all the ugly special chars > wc -l <filename> > shows I have one line of data and > cat <filename> | wc -l > still tells me I have one line of data. What you need here is a terminal emulator. If you're really unlucky, the other side will optimize redraws and you will not easily get the correct picture. As a first step, you could simply try ignoring the special chars, but you may end up having to emulate the screen and do "screen scraping". -- cg |
From: John M. <ex...@h0...> - 2003-04-08 19:04:37
|
Thx for your suggestion and I can see some merit here. I am, however, starting to think I am off topic for this list. My real problem is that I do not have multiple lines of data to parse. It's all one long line with lots of control chars. When I print the data to a file cat <filename> shows output that looks just like my telnet session. cat -v <filename> shows all the ugly special chars wc -l <filename> shows I have one line of data and cat <filename> | wc -l still tells me I have one line of data. I think I have to teach the script to break this output into separate lines. Maybe this is an IO::Stty puzzle or something. Again, thx for your suggestion. -- Thx John Mahoney On Tue, Apr 08, 2003 at 01:53:32PM -0400, db...@CT... wrote: > > Generally speaking, those characters shouldn't be a problem; just ignore > them. I'm assuming you're just interested in the printable stuff. > > My approach is to match on one line at a time, and then parse that match > (an arbitrary line) for the desired info, only because it's what I'm used > to. In the Tcl version, this keeps the expect buffers flushing as you look > for your match and this simulates more of a perlish feel. That's just > personal preference. The point really is just parse out what you need and > forget the rest. > > For the purpose of illustration, I'll assume you are looking for MAC > addresses and ports they're on. So for each line where we see something > that looks like a mac address followed by "Port: ", parse this stuff out > and print it to stdout: > > #!/usr/local/bin/perl > > use Expect; > > $Expect::Log_Stdout=0; > > $session = Expect->spawn("/bin/cat /tmp/mac.txt"); > $timeout = 10; > > expect($timeout, > '-i', $session, > '-re', "([^\r\n]+)[\r\n]+", sub { > my $line = ($session->matchlist)[0]; > if ($line =~ /(..-..-..-..-..-..).*Port:\s+(\d+)/) { > print "mac $1 found on port $2\n"; > } > exp_continue; > } > ); > > I simply spawned a "cat" of the snippet of Catalyst output you included > with your email to simulate the effect, but obviously this would be > replaced with the login sequence and telnet specifics of a real session. I > didn't bother doing the shift in the sub { } portion of code because I'm > assuming that $session is the only object you have (i.e., you have spawned > only one telnet to Catalyst switch). You can use fancier patterns if you > feel it's warranted to eliminate ambiguity but that would be up to you. > > Hope this helps, > > David Basham > CTC Communications > > > > > > John Mahoney > <ex...@h0...t To: exp...@li... > bi.com> cc: > Sent by: Subject: [Expectperl-discuss] parsing non-ascii char's > exp...@li...urc > eforge.net > > > 04/08/2003 08:38 AM > > > > > > > Could use some tips on how to handle/translate non-ascii > char's. > > I am using Expect.pm v 1.15 > perl, v5.6.1 > running on a Solaris 8 box. > > I am using expect to log into Nortel switches and I want > to gather the forwarding database and vlan info. > > When I simply telnet into a switch, I can see the > terminal screen cleared and then get text that looks > like: > MAC Address Table > > Aging Time: [ 300 seconds ] > Find an Address: [ 00-00-00-00-00-00 ] > Fast Aging: [ Enabled ] > > 00-00-86-1D-BF-BF Port: 11 > 00-00-86-4D-68-D4 Port: 1 > etc, > BUT it's really one long line with lots of special > char's in it. > > I've tried several things including adding the line > $exp->raw_pty(1); > but, so far, I've been disappointed. I'm wondering if I > can get Expect, IO:Stty, and/or IO:Tty to send me text > that's easier to parse. > > -- > Thx > John Mahoney > ex...@h0... > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > > |
From: <db...@CT...> - 2003-04-08 18:04:00
|
Generally speaking, those characters shouldn't be a problem; just ignore them. I'm assuming you're just interested in the printable stuff. My approach is to match on one line at a time, and then parse that match (an arbitrary line) for the desired info, only because it's what I'm used to. In the Tcl version, this keeps the expect buffers flushing as you look for your match and this simulates more of a perlish feel. That's just personal preference. The point really is just parse out what you need and forget the rest. For the purpose of illustration, I'll assume you are looking for MAC addresses and ports they're on. So for each line where we see something that looks like a mac address followed by "Port: ", parse this stuff out and print it to stdout: #!/usr/local/bin/perl use Expect; $Expect::Log_Stdout=0; $session = Expect->spawn("/bin/cat /tmp/mac.txt"); $timeout = 10; expect($timeout, '-i', $session, '-re', "([^\r\n]+)[\r\n]+", sub { my $line = ($session->matchlist)[0]; if ($line =~ /(..-..-..-..-..-..).*Port:\s+(\d+)/) { print "mac $1 found on port $2\n"; } exp_continue; } ); I simply spawned a "cat" of the snippet of Catalyst output you included with your email to simulate the effect, but obviously this would be replaced with the login sequence and telnet specifics of a real session. I didn't bother doing the shift in the sub { } portion of code because I'm assuming that $session is the only object you have (i.e., you have spawned only one telnet to Catalyst switch). You can use fancier patterns if you feel it's warranted to eliminate ambiguity but that would be up to you. Hope this helps, David Basham CTC Communications John Mahoney <ex...@h0...t To: exp...@li... bi.com> cc: Sent by: Subject: [Expectperl-discuss] parsing non-ascii char's exp...@li...urc eforge.net 04/08/2003 08:38 AM Could use some tips on how to handle/translate non-ascii char's. I am using Expect.pm v 1.15 perl, v5.6.1 running on a Solaris 8 box. I am using expect to log into Nortel switches and I want to gather the forwarding database and vlan info. When I simply telnet into a switch, I can see the terminal screen cleared and then get text that looks like: MAC Address Table Aging Time: [ 300 seconds ] Find an Address: [ 00-00-00-00-00-00 ] Fast Aging: [ Enabled ] 00-00-86-1D-BF-BF Port: 11 00-00-86-4D-68-D4 Port: 1 etc, BUT it's really one long line with lots of special char's in it. I've tried several things including adding the line $exp->raw_pty(1); but, so far, I've been disappointed. I'm wondering if I can get Expect, IO:Stty, and/or IO:Tty to send me text that's easier to parse. -- Thx John Mahoney ex...@h0... ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |