]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ipblocklist-functions.pl: Initial commit.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 1 Mar 2022 14:23:44 +0000 (15:23 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 7 Jul 2022 15:26:13 +0000 (17:26 +0200)
This library file will contain a collection of functions, which are
required to deal with the ipblocklist feature.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ipblocklist-functions.pl [new file with mode: 0644]

diff --git a/config/cfgroot/ipblocklist-functions.pl b/config/cfgroot/ipblocklist-functions.pl
new file mode 100644 (file)
index 0000000..2072f3f
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/perl -w
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 2 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+package IPblocklist;
+
+require '/var/ipfire/ipblocklist/sources';
+
+#
+## Function to get all available blocklists.
+#
+sub get_blocklists () {
+       my @blocklists;
+
+       # Loop through the hash of blocklists.
+       foreach my $blocklist ( keys %IPblocklist::List::sources ) {
+               # Add the list to the array.
+               push(@blocklists, $blocklist);
+       }
+
+       # Sort and return the array.
+       return sort(@blocklists);
+}
+
+1;