aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schaefer <tom@tomschaefer.org>2011-10-03 00:35:17 -0400
committerThomas Schaefer <tom@tomschaefer.org>2011-10-03 00:35:17 -0400
commitd4d0fcbadc7817f1a0a675d04c4005afc58d9b19 (patch)
tree49a884bd489ae4ca9b2cd78c9b139d0688a8577f
parent26e504fbacb47031869a7ab204bcd54e54315c15 (diff)
downloadpfsense-packages-d4d0fcbadc7817f1a0a675d04c4005afc58d9b19.tar.gz
pfsense-packages-d4d0fcbadc7817f1a0a675d04c4005afc58d9b19.tar.bz2
pfsense-packages-d4d0fcbadc7817f1a0a675d04c4005afc58d9b19.zip
added widget for countryblock and ipblocklist
-rw-r--r--config/countryblock/countryblock.inc5
-rw-r--r--config/countryblock/countryblock.xml12
-rw-r--r--config/countryblock/countryblock_IPBlocklist.widget.tmp39
-rw-r--r--config/countryblock/countryblock_ipblocklist_widget.tmp116
-rw-r--r--config/ipblocklist/8/countryblock_IPBlocklist.widget.tmp39
-rw-r--r--config/ipblocklist/8/countryblock_ipblocklist_widget.tmp116
-rwxr-xr-xconfig/ipblocklist/8/ipblocklist.inc5
-rwxr-xr-xconfig/ipblocklist/8/ipblocklist.xml12
-rwxr-xr-xpkg_config.7.xml2
-rw-r--r--pkg_config.8.xml4
-rw-r--r--pkg_config.8.xml.amd644
11 files changed, 347 insertions, 7 deletions
diff --git a/config/countryblock/countryblock.inc b/config/countryblock/countryblock.inc
index 79b223ce..cba04cb7 100644
--- a/config/countryblock/countryblock.inc
+++ b/config/countryblock/countryblock.inc
@@ -62,6 +62,11 @@ function php_install_command_cb()
//rename PHP files from .tmp to .php
+ exec("cp /tmp/countryblock_IPBlocklist.widget.tmp /usr/local/www/widgets/widgets/countryblock_IPBlocklist.widget.php");
+ unlink_if_exists("/tmp/countryblock_IPBlocklist.widget.tmp");
+ exec("cp /tmp/countryblock_ipblocklist_widget.tmp /usr/local/www/widgets/widgets/countryblock_ipblocklist_widget.php");
+ unlink_if_exists("/tmp/ccountryblock_ipblocklist_widget.tmp");
+
exec("cp /tmp/class.phpmailer.tmp /usr/local/www/packages/countryblock/class.phpmailer.php");
unlink_if_exists("/tmp/class.phpmailer.tmp ");
exec("cp /tmp/class.smtp.tmp /usr/local/www/packages/countryblock/class.smtp.php");
diff --git a/config/countryblock/countryblock.xml b/config/countryblock/countryblock.xml
index dbbefd18..6e2ec635 100644
--- a/config/countryblock/countryblock.xml
+++ b/config/countryblock/countryblock.xml
@@ -41,7 +41,7 @@
<requirements>Active Internet</requirements>
<faq>http://forum.pfsense.org/index.php/topic,25732.0.html</faq>
<name>Country Block Settings</name>
- <version>0.2.2</version>
+ <version>0.2.4</version>
<title>Settings</title>
<include_file>/usr/local/pkg/countryblock.inc</include_file>
<menu>
@@ -164,6 +164,16 @@
<chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/countryblock/email.tmp</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock_IPBlocklist.widget.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/countryblock/countryblock_ipblocklist_widget.tmp</item>
+ </additional_files_needed>
<fields>
<field>
<fielddescr>Variable One</fielddescr>
diff --git a/config/countryblock/countryblock_IPBlocklist.widget.tmp b/config/countryblock/countryblock_IPBlocklist.widget.tmp
new file mode 100644
index 00000000..e81f1a55
--- /dev/null
+++ b/config/countryblock/countryblock_IPBlocklist.widget.tmp
@@ -0,0 +1,39 @@
+<script type="text/javascript">
+
+ function Ajax()
+ {
+ var
+ $http,
+ $self = arguments.callee;
+
+ if (window.XMLHttpRequest) {
+ $http = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ try {
+ $http = new ActiveXObject('Msxml2.XMLHTTP');
+ } catch(e) {
+ $http = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ }
+
+ if ($http) {
+ $http.onreadystatechange = function()
+ {
+ if (/4|^complete$/.test($http.readyState)) {
+ document.getElementById('ReloadThis').innerHTML = $http.responseText;
+ setTimeout(function(){$self();}, 10000);
+ }
+ };
+ $http.open('GET', '/countryblock_ipblocklist_widget.php');
+ $http.send(null);
+ }
+
+ }
+
+</script>
+
+ <script type="text/javascript">
+ setTimeout(function() {Ajax();}, 10000);
+ </script>
+ <div id="ReloadThis">Ajax Loading...</div>
+
diff --git a/config/countryblock/countryblock_ipblocklist_widget.tmp b/config/countryblock/countryblock_ipblocklist_widget.tmp
new file mode 100644
index 00000000..d8d0f780
--- /dev/null
+++ b/config/countryblock/countryblock_ipblocklist_widget.tmp
@@ -0,0 +1,116 @@
+<?php
+/*
+ Copyright 2011 Thomas Schaefer - Tomschaefer.org
+ Part of pfSense widgets (www.pfsense.com)
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+$nocsrf = true;
+
+@require_once("guiconfig.inc");
+@require_once("pfsense-utils.inc");
+@require_once("functions.inc");
+
+$ipblocklist_file = "/usr/local/www/packages/ipblocklist/ipblocklist.php";
+$countryblock_file = "/usr/local/www/packages/countryblock/countryblock.php";
+
+echo "<table style=\"padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"";
+echo" <tr>";
+if (file_exists($ipblocklist_file)) {
+ echo " <td class=\"listhdrr\">IP-Blocklist";
+ ob_start();
+ $results = exec("/sbin/pfctl -s rules | grep -c ipblocklist");
+ ob_end_clean();
+ if ($results > '2') echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+ else
+ echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>";
+ echo "</td>";
+}
+if (file_exists($countryblock_file)) {
+ echo " <td class=\"listhdrr\">Countryblock";
+ ob_start();
+ $results = exec("/sbin/pfctl -s rules | grep -c countryblock");
+ ob_end_clean();
+ if ($results > '0') echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+ else
+ echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>";
+ echo "</td>";
+}
+echo" </tr>";
+echo" <tr>";
+if (file_exists($ipblocklist_file)) {
+ echo " <td class=\"listlr\">";
+ ob_start();
+ $resultsIP = exec("/sbin/pfctl -T show -t ipblocklist |grep -v -c Z");
+ ob_end_clean();
+ echo $resultsIP;
+ echo " Networks";
+ echo "</td>";
+}
+if (file_exists($countryblock_file)) {
+ echo " <td class=\"listr\">";
+ ob_start();
+ $resultsCB = exec("pfctl -T show -t countryblock |grep -v -c Z");
+ ob_end_clean();
+ echo $resultsCB;
+ echo " Networks";
+ echo "</td>";
+}
+echo" </tr>";
+echo" <tr>";
+if (file_exists($ipblocklist_file)) {
+ ob_start();
+ $resultsIP = exec("tail -r /usr/local/www/packages/ipblocklist/errorOUT.txt");
+ ob_end_clean();
+ if ($resultsIP == "") {
+ echo " <td></td>";
+ } else {
+ echo " <td class=\"listlr\">";
+ echo "<br/><span style='color:red'>";
+ echo $resultsIP;
+ echo "</span>";
+ echo "</td>";
+ }
+}
+if (file_exists($countryblock_file)) {
+ ob_start();
+ $resultsCB = exec("tail -r /usr/local/www/packages/countryblock/errorOUT.txt");
+ ob_end_clean();
+ if ($resultsCB == "") {
+ echo " <td></td>";
+ } else {
+ echo " <td class=\"listlr\">";
+ echo "<br/><span style='color:red'>";
+ echo $resultsCB;
+ echo "</span>";
+ echo "</td>";
+ }
+}
+echo" </tr>";
+//echo" <tr>";
+//if (file_exists($ipblocklist_file)) echo " <td>&nbsp;</td>";
+//if (file_exists($countryblock_file)) echo " <td>&nbsp;</td>";
+//echo" </tr>";
+echo"</table>";
+
+?> \ No newline at end of file
diff --git a/config/ipblocklist/8/countryblock_IPBlocklist.widget.tmp b/config/ipblocklist/8/countryblock_IPBlocklist.widget.tmp
new file mode 100644
index 00000000..e81f1a55
--- /dev/null
+++ b/config/ipblocklist/8/countryblock_IPBlocklist.widget.tmp
@@ -0,0 +1,39 @@
+<script type="text/javascript">
+
+ function Ajax()
+ {
+ var
+ $http,
+ $self = arguments.callee;
+
+ if (window.XMLHttpRequest) {
+ $http = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ try {
+ $http = new ActiveXObject('Msxml2.XMLHTTP');
+ } catch(e) {
+ $http = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ }
+
+ if ($http) {
+ $http.onreadystatechange = function()
+ {
+ if (/4|^complete$/.test($http.readyState)) {
+ document.getElementById('ReloadThis').innerHTML = $http.responseText;
+ setTimeout(function(){$self();}, 10000);
+ }
+ };
+ $http.open('GET', '/countryblock_ipblocklist_widget.php');
+ $http.send(null);
+ }
+
+ }
+
+</script>
+
+ <script type="text/javascript">
+ setTimeout(function() {Ajax();}, 10000);
+ </script>
+ <div id="ReloadThis">Ajax Loading...</div>
+
diff --git a/config/ipblocklist/8/countryblock_ipblocklist_widget.tmp b/config/ipblocklist/8/countryblock_ipblocklist_widget.tmp
new file mode 100644
index 00000000..d8d0f780
--- /dev/null
+++ b/config/ipblocklist/8/countryblock_ipblocklist_widget.tmp
@@ -0,0 +1,116 @@
+<?php
+/*
+ Copyright 2011 Thomas Schaefer - Tomschaefer.org
+ Part of pfSense widgets (www.pfsense.com)
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+$nocsrf = true;
+
+@require_once("guiconfig.inc");
+@require_once("pfsense-utils.inc");
+@require_once("functions.inc");
+
+$ipblocklist_file = "/usr/local/www/packages/ipblocklist/ipblocklist.php";
+$countryblock_file = "/usr/local/www/packages/countryblock/countryblock.php";
+
+echo "<table style=\"padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"";
+echo" <tr>";
+if (file_exists($ipblocklist_file)) {
+ echo " <td class=\"listhdrr\">IP-Blocklist";
+ ob_start();
+ $results = exec("/sbin/pfctl -s rules | grep -c ipblocklist");
+ ob_end_clean();
+ if ($results > '2') echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+ else
+ echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>";
+ echo "</td>";
+}
+if (file_exists($countryblock_file)) {
+ echo " <td class=\"listhdrr\">Countryblock";
+ ob_start();
+ $results = exec("/sbin/pfctl -s rules | grep -c countryblock");
+ ob_end_clean();
+ if ($results > '0') echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up.gif'>";
+ else
+ echo "<img src ='/themes/{$g['theme']}/images/icons/icon_interface_down.gif'>";
+ echo "</td>";
+}
+echo" </tr>";
+echo" <tr>";
+if (file_exists($ipblocklist_file)) {
+ echo " <td class=\"listlr\">";
+ ob_start();
+ $resultsIP = exec("/sbin/pfctl -T show -t ipblocklist |grep -v -c Z");
+ ob_end_clean();
+ echo $resultsIP;
+ echo " Networks";
+ echo "</td>";
+}
+if (file_exists($countryblock_file)) {
+ echo " <td class=\"listr\">";
+ ob_start();
+ $resultsCB = exec("pfctl -T show -t countryblock |grep -v -c Z");
+ ob_end_clean();
+ echo $resultsCB;
+ echo " Networks";
+ echo "</td>";
+}
+echo" </tr>";
+echo" <tr>";
+if (file_exists($ipblocklist_file)) {
+ ob_start();
+ $resultsIP = exec("tail -r /usr/local/www/packages/ipblocklist/errorOUT.txt");
+ ob_end_clean();
+ if ($resultsIP == "") {
+ echo " <td></td>";
+ } else {
+ echo " <td class=\"listlr\">";
+ echo "<br/><span style='color:red'>";
+ echo $resultsIP;
+ echo "</span>";
+ echo "</td>";
+ }
+}
+if (file_exists($countryblock_file)) {
+ ob_start();
+ $resultsCB = exec("tail -r /usr/local/www/packages/countryblock/errorOUT.txt");
+ ob_end_clean();
+ if ($resultsCB == "") {
+ echo " <td></td>";
+ } else {
+ echo " <td class=\"listlr\">";
+ echo "<br/><span style='color:red'>";
+ echo $resultsCB;
+ echo "</span>";
+ echo "</td>";
+ }
+}
+echo" </tr>";
+//echo" <tr>";
+//if (file_exists($ipblocklist_file)) echo " <td>&nbsp;</td>";
+//if (file_exists($countryblock_file)) echo " <td>&nbsp;</td>";
+//echo" </tr>";
+echo"</table>";
+
+?> \ No newline at end of file
diff --git a/config/ipblocklist/8/ipblocklist.inc b/config/ipblocklist/8/ipblocklist.inc
index 24147562..ed096d44 100755
--- a/config/ipblocklist/8/ipblocklist.inc
+++ b/config/ipblocklist/8/ipblocklist.inc
@@ -62,6 +62,11 @@ function php_install_command_ip()
exec("rehash");
//rename PHP files from .tmp to .php
+ exec("cp /tmp/countryblock_IPBlocklist.widget.tmp /usr/local/www/widgets/widgets/countryblock_IPBlocklist.widget.php");
+ unlink_if_exists("/tmp/countryblock_IPBlocklist.widget.tmp");
+ exec("cp /tmp/countryblock_ipblocklist_widget.tmp /usr/local/www/widgets/widgets/countryblock_ipblocklist_widget.php");
+ unlink_if_exists("/tmp/ccountryblock_ipblocklist_widget.tmp");
+
exec("cp /tmp/lists.txt /usr/local/www/packages/ipblocklist/lists.txt");
exec("cp /tmp/class.phpmailer.tmp /usr/local/www/packages/ipblocklist/class.phpmailer.php");
unlink_if_exists("/tmp/class.phpmailer.tmp ");
diff --git a/config/ipblocklist/8/ipblocklist.xml b/config/ipblocklist/8/ipblocklist.xml
index ca488d01..4d38eae4 100755
--- a/config/ipblocklist/8/ipblocklist.xml
+++ b/config/ipblocklist/8/ipblocklist.xml
@@ -41,7 +41,7 @@
<requirements>perl</requirements>
<faq>http://forum.pfsense.org/index.php/topic,24769.0.html</faq>
<name>IP Blocklist Settings</name>
- <version>0.3.4</version>
+ <version>0.3.5</version>
<title>Settings</title>
<include_file>/usr/local/pkg/ipblocklist.inc</include_file>
<menu>
@@ -154,6 +154,16 @@
<chmod>0755</chmod>
<item>http://www.pfsense.org/packages/config/ipblocklist/8/lists.txt</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/ipblocklist/8/countryblock_IPBlocklist.widget.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/ipblocklist/8/countryblock_ipblocklist_widget.tmp</item>
+ </additional_files_needed>
<fields>
<field>
<fielddescr>Variable One</fielddescr>
diff --git a/pkg_config.7.xml b/pkg_config.7.xml
index c1431fa7..06fe4b86 100755
--- a/pkg_config.7.xml
+++ b/pkg_config.7.xml
@@ -23,7 +23,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,25732.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/countryblock/countryblock.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url>
- <version>0.2.3</version>
+ <version>0.2.4</version>
<status>Beta</status>
<required_version>1.2.2</required_version>
<maintainer>tom@tomschaefer.org</maintainer>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 07916686..bfed5e32 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -52,7 +52,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,25732.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/countryblock/countryblock.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url>
- <version>0.2.3</version>
+ <version>0.2.4</version>
<status>Beta</status>
<required_version>2.0</required_version>
<maintainer>tom@tomschaefer.org</maintainer>
@@ -66,7 +66,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,24769.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/ipblocklist/8/ipblocklist.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url>
- <version>0.3.4</version>
+ <version>0.3.5</version>
<status>Beta</status>
<required_version>2.0</required_version>
<maintainer>tom@tomschaefer.org</maintainer>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 91392ce4..e12aa71e 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -108,7 +108,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,25732.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/countryblock/countryblock.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url>
- <version>0.2.3</version>
+ <version>0.2.4</version>
<status>Beta</status>
<required_version>2.0</required_version>
<maintainer>tom@tomschaefer.org</maintainer>
@@ -122,7 +122,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,24769.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/ipblocklist/8/ipblocklist.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url>
- <version>0.3.4</version>
+ <version>0.3.5</version>
<status>Beta</status>
<required_version>2.0</required_version>
<maintainer>tom@tomschaefer.org</maintainer>