Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regex with zero byte does not work #87

Closed
jackyspy opened this issue Apr 9, 2016 · 3 comments
Closed

regex with zero byte does not work #87

jackyspy opened this issue Apr 9, 2016 · 3 comments

Comments

@jackyspy
Copy link

jackyspy commented Apr 9, 2016

I've tested some rules like "^\x10.\x00\x06MQIsdp" or "^\\x10.\\x00\\x06MQIsdp" to match MQTT v3.1, but It does not work, can not match binary data as bellow:

0x000000: 10 25 00 06 4d 51 49 73 64 70 03 02 00 3c 00 17 .%..MQIsdp.

I was completely confused. Any help will be appreciated!

BTW: Can LUA engine be embeded into sslh for some completed and flexible protocol choosing?

@rdebath
Copy link
Contributor

rdebath commented Jul 12, 2017

Bit of a long time but for other people too ...

The configuration library converts the \x00 into a nul byte that ends the string before it's passed to the RE library. If you use \\x00 this is passed to the RE library as \x00, however, the library is by default the standard POSIX library in 'dumb regex' mode so it doesn't understand.

I suggest you recompile your copy with PCRE support linked in and then use your second example.

Note: in an ideal world the \x00 processing of the configuration library would be disabled (and \x would passed as \x) if it's using PCRE, but that doesn't seem to be possible.

@Fashaun
Copy link

Fashaun commented Sep 8, 2018

It is work for the mqtt connection "^\x10.\00\x06MQIsdp"

@yrutschle
Copy link
Owner

I assume I can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants