[3/4] ids-functions.pl: Add function to get the info url for a given rule id
Commit Message
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
config/cfgroot/ids-functions.pl | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
@@ -1909,4 +1909,29 @@ sub is_sid_in_range($\@) {
return undef;
}
+#
+## Function to get the sid info url in case it is defined
+#
+sub get_sid_info_url($) {
+ my ($sid) = @_;
+
+ # Call function to get the provider for this rule id.
+ my $provider = &get_provider_by_sid($sid);
+
+ # Exit if no provder could be determined.
+ return unless($provider);
+
+ # Exit if no info URL is known for the provider.
+ return unless($IDS::Ruleset::Providers{$provider}{"sid_info_url"});
+
+ # Grab the URL for the given provider.
+ my $info_url = $IDS::Ruleset::Providers{$provider}{"sid_info_url"};
+
+ # Replace the <sid> placeholder with the given sid.
+ $info_url =~ s/\<sid\>/$sid/g;
+
+ # Return the URL.
+ return $info_url;
+}
+
1;