I have this defined in bb-services:
[smtp-transaction] send "helo hobbit.domain.com\r\nmail from: <test at domain.com>\r\nrcpt to: <test at anotherdomain.com>\r\nquit\r\n" expect "220-mx01.domain.com ESMTP\r\n220 ESMTP READY\r\n250 mx01.domain.com\r\n250 sender <test at domain.com> ok\r\n" port 25
and a host that uses it in bb-hosts. This works great, except that it's tied to the host mx01.domain.com in the expect string.
Is it possible to use regexes in the expect string, such as expect "220-mx0[0|1].domain.com"? So far my attempts have been unsuccessful and the man pages don't seem to indicate if this is possible.
Aaron Zink Manager, Corporate IT eHarmony.com 626.795.4814
On Wed, 2 Jul 2008, Aaron Zink wrote:
Is it possible to use regexes in the expect string?
I'm wondering about the same, and haven't seen any answer to this.
I'm trying to match some xml, and first line is: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
The problem is the quotes, as bbtest-net terminates the string on the first quote, no matter what, it seems.
I have tried escaping like this: expect "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
but "bbtest-net --services" shows "Exp.text: <?xml version=", adding more \ doesnt help, the extra \ will then just be part of Exp.text.
I notice that --services show: Exp.text: <?xml version= Exp.len : 14 Exp.ofs : 0
All my services show "Exp.ofs : 0", I suppose "ofs" means offset? Is there a way to set this to something else than 0?
The services I try to monitor also seems to puke out some ctrl-chars at the start (and it it uses ssl), a connection with openssl s_client looks like this:
[snip SSL stuff] Verify return code: 19 (self signed certificate in certificate chain)
^@^@^D<FE><?xml version="1.0" encoding="UTF-8" standalone="no"?> [snip rest of xml]
Should my "expect" also include "\x00\x00\x04\xFE" before "<?xml version"?
Again, if I could use regexp, I would probably just go for ".*<?xml ..", and if offset can be used, I'd jump over the control chars.
Any tip?
-- Kolbjørn Barmen UNINETT Driftsenter
I never saw a reply to this, so I'll bump it since I have exactly the same need ;)
Regards,
Johan
-----Original Message----- From: Kolbjørn Barmen [mailto:kolbjorn.barmen at uninett.no] Sent: den 24 mars 2010 08:53 To: hobbit at hswn.dk Subject: Re: [hobbit] bb-services: regexes in expect string?
On Wed, 2 Jul 2008, Aaron Zink wrote:
Is it possible to use regexes in the expect string?
I'm wondering about the same, and haven't seen any answer to this.
I'm trying to match some xml, and first line is: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
The problem is the quotes, as bbtest-net terminates the string on the first quote, no matter what, it seems.
I have tried escaping like this: expect "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
but "bbtest-net --services" shows "Exp.text: <?xml version=", adding more \ doesnt help, the extra \ will then just be part of Exp.text.
I notice that --services show: Exp.text: <?xml version= Exp.len : 14 Exp.ofs : 0
All my services show "Exp.ofs : 0", I suppose "ofs" means offset? Is there a way to set this to something else than 0?
The services I try to monitor also seems to puke out some ctrl-chars at the start (and it it uses ssl), a connection with openssl s_client looks like this:
[snip SSL stuff] Verify return code: 19 (self signed certificate in certificate chain)
^@^@^D<FE><?xml version="1.0" encoding="UTF-8" standalone="no"?> [snip rest of xml]
Should my "expect" also include "\x00\x00\x04\xFE" before "<?xml version"?
Again, if I could use regexp, I would probably just go for ".*<?xml ..", and if offset can be used, I'd jump over the control chars.
Any tip?
-- Kolbjørn Barmen UNINETT Driftsenter
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
participants (3)
-
AaronZink@eharmony.com
-
johan.karlsson@deltamanagement.se
-
kolbjorn.barmen@uninett.no