I am using [rt] and would like to create an action to parse a series of firewall rules and pick up the IP addresses in them as a comma-separated value to be applied to a field. My firewall rules look like this:
access-list ACL-outside-1net extended permit tcp host 172.16.0.7 host 10.0.1.55 eq www
access-list ACL-outside-1net extended permit tcp host 172.16.0.9 host 10.0.1.56 eq www
And it would be great if I could have a regex that will snarf whatever occurs after "host" and return them as a comma-separated string without picking up everything until the end of the line, which is my current point of failure.
i.e. my ideal output from the regex would be:
172.16.0.7,10.0.1.55,172.16.0.9,10.0.1.56
The rules I'm interested in will always end in eq $service or $port
and the IP address will be preceded by host
, but the IP address can be ipv4 or ipv6 and [rt] will be smart about parsing the address, so I would rather pick up "after host up to host" and "after host up to eq", but I'm having a hard time getting a regex to match, let alone replace into a comma-separated string.
lil' help?
edit 201305080832
I've been asked (and appropriately downvoted) to share my work, so here is my template that I'm working in for [rt].
IPs|Body|host(.*)||
My custom field is named IPs
and I'm doing a Body
search for "host" and then have been doing a greedy match that isn't an acceptable IP address for the Multi-value IP address
field in [rt]. The suggestions below may be workable if I change from using a template and ExtractCustomFieldValue
to writing a scrip action specific for this use case.
[rt]
Request Tracker