rapid7 / recog

Pattern recognition for hosts, services, and content

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add tests to ensure portability of regex syntax

gschneider-r7 opened this issue · comments

There are some regexes using Ruby's \h syntax for hexadecimal values, but in other runtimes \h means horizontal whitespace. These regexes will not match correctly outside of Ruby. Instead we should be using [a-f\d] (unless someone has a better idea).

There should be test coverage to ensure that the regexes are not relying on special Ruby-only features so we can avoid any issues with this in the future.

Examples:
https://github.com/rapid7/recog/blob/master/xml/ftp_banners.xml#L219
https://github.com/rapid7/recog/blob/master/xml/ftp_banners.xml#L1126
https://github.com/rapid7/recog/blob/master/xml/ftp_banners.xml#L1136
https://github.com/rapid7/recog/blob/master/xml/ftp_banners.xml#L1194