Re: Copy Behavior w RegEx for binary

13 views
Skip to first unread message

Brandon Byars

unread,
Dec 21, 2021, 11:31:07 AM12/21/21
to Bruce Maginnis, mountebank-discuss
Responded on the other thread, but no, binary regexes are not possible. It may be possible to use an inject predicate to do what you're wanting.
-Brandon

On Fri, Dec 3, 2021 at 5:08 AM Bruce Maginnis <brucem...@gmail.com> wrote:
Trying to clarify, I'm essentially sending text via tcp/binary, so I was hoping to use the encoded text for regex matching and capture.

I've highlighted base64 here, but we use hex mainly which is why I wrote the custom protocol to convert it to hex.

Is that possible? Just not sure how to configure it for this or what way to approach extending mountebank to support

Thanks

On Friday, 3 December 2021 at 10:48:47 UTC Bruce Maginnis wrote:
Hi,
Trying to find information on whether its possible to use Regex in binary stubs

i.e. capture elements from the base64 string and use in response

"responses": [
{
"is": "MDMzMzAyNDk1{captured[0]}AzMjM2MzAzMDMwMzAzNTMwMzAzMTMwMzA0NjMyMzM0MzMwMzYzODMxMzIzODQ1MzEzODMwMzAzMjMwMzAzMDMwMzAzMDMwMzAzMDMwMzAzMDMwMzAzMDM4MzEzNjM0MzEzMTMxMzEzMTMxMzEzMTMxMzEzMTMxMzEzMT"
}

"predicates": [ { 
           matches : { "base64Str" : MDMzMzAyNDk1(.{8})AzMjM2MzAzMDMwMzAzNTMwMzAzMTMwMzA0NjMyMzM0MzMwMzYzODMxMzIzODQ1MzEzODMwMzAzMjMwMzAzMDMwMzAzMDMwMzAzMDMwMzAzMDMwMzAzMDM4MzEzNjM0MzEzMTMxMzEzMTMxMzEzMTMxMzEzMTMxMzEzMT
}
} ]

I have written a custom protocol to convert the binary to hex as its easier to work with for us, but concept is the same, just trying to see whether we can do this with built-in mountebank or if I have to expand the scope of the custom protocol

Thanks

--
You received this message because you are subscribed to the Google Groups "mountebank-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mountebank-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mountebank-discuss/ac0e16ee-beab-4321-b497-a25920a33db4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages