in reply to Inserting domain name into Snort rule
Here's one way to get the text string you want, then you just have to plug it in where you need it.
#!/usr/bin/env perl use Modern::Perl; sub fix { return join '|', '', ( map { sprintf('%02d',length $_), $_ } split + /\./, shift ), '00', ''; } say fix 'foo.com'; say fix 'foo.foobar.com'; say fix 'foo.foobar.foo.com';
Aaron B.
Available for small or large Perl jobs; see my home node.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inserting domain name into Snort rule
by miniperl (Initiate) on Oct 05, 2012 at 14:01 UTC | |
by aaron_baugher (Curate) on Oct 05, 2012 at 16:01 UTC | |
by miniperl (Initiate) on Oct 05, 2012 at 16:40 UTC | |
by aaron_baugher (Curate) on Oct 06, 2012 at 08:22 UTC | |
by miniperl (Initiate) on Oct 10, 2012 at 14:12 UTC |