From 2ef717823e30d3da125c092c10957d6005ae4231 Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Sun, 21 Nov 2010 11:52:39 -0500 Subject: minor fixes for 3.0 --- config/ipblocklist/OUTBOUND | 0 config/ipblocklist/convert.pl | 0 config/ipblocklist/ipblocklist.tmp | 483 +++++++++++++++++++------------------ 3 files changed, 243 insertions(+), 240 deletions(-) create mode 100644 config/ipblocklist/OUTBOUND mode change 100755 => 100644 config/ipblocklist/convert.pl diff --git a/config/ipblocklist/OUTBOUND b/config/ipblocklist/OUTBOUND new file mode 100644 index 00000000..e69de29b diff --git a/config/ipblocklist/convert.pl b/config/ipblocklist/convert.pl old mode 100755 new mode 100644 diff --git a/config/ipblocklist/ipblocklist.tmp b/config/ipblocklist/ipblocklist.tmp index c562d80b..e27215ea 100644 --- a/config/ipblocklist/ipblocklist.tmp +++ b/config/ipblocklist/ipblocklist.tmp @@ -1,240 +1,243 @@ -0) { - - conf_mount_rw(); - - $ent = array(); - - if ($_POST['enable'] == 1) { - //echo "enabled"; - $config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] = 1; - - //Process list by downloading and extracting - - $myFile = "lists.txt"; - $myWFile = "wlists.txt"; - $fileContents = file_get_contents($myFile); - $fileWContents = file_get_contents($myWFile); - $lines = explode(PHP_EOL, $fileContents); - $Wlines = explode(PHP_EOL, $fileWContents); - //Remove DIR lists to eliminate duplates - exec("/bin/rm -R lists"); - exec("/bin/rm -R Wlists"); - //Process each list URL, Extract, and put in DIR lists - exec("/bin/mkdir lists"); - exec("/bin/mkdir Wlists"); - foreach ($lines as $line) { - exec("/usr/bin/fetch -o lists $line"); - $filename = basename($line); - //Extract list - exec("/usr/bin/gzip -d lists/$filename"); - } - foreach ($Wlines as $Wline) { - exec("/usr/bin/fetch -o Wlists $Wline"); - $Wfilename = basename($Wline); - //Extract Whitelist - exec("/usr/bin/gzip -d Wlists/$Wfilename"); - } - //Prep pfctl - mwexec("/usr/bin/touch lists/ipfw.ipfw"); - mwexec("/usr/bin/touch Wlists/whitelist"); - //Now clear ipfw, and process each list to ipfw commands - exec("/bin/sh convert-execute.sh"); - - } - else { - //echo "disabled"; - $config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] = 0; - //Clear Lists - mwexec("ipfw -f flush"); - mwexec("pfctl -t ipblocklist -T kill"); - mwexec("rm -R /usr/local/www/packages/ipblocklist/lists"); - mwexec("sed -i -e '/ipblocklist/d' /tmp/rules.debug"); - mwexec("pfctl -o basic -f /tmp/rules.debug"); - //Clear errorOUT.txt - mwexec("rm errorOUT.txt"); - - } - - - write_config(); - //services_dnsmasq_configure(); - sleep(1); - $savemsg_dnsb = "IP-Blocklist settings have been saved/updated. "; - conf_mount_ro(); -} -?> - - - -

- - -
-\n"; -} -else { - echo "\n"; -} -?> - -Enable IP-Blocklist

- - - - - - -
- - -
-
- - - - - - - - - - - - - -
Main
-
-
- -
- - - - - - - - - - -
- - - - - - - - -

- -

- -
- - - - - -"; -?> - -
-
-
-
-Usage -
- Add direct link to list and press - (Example: - Level1, - Level2, - Level3) -
- Compressed lists should have .gz extention and follows PeerBlock syntax
- -
Warning! - Apply after firewall change or state reset. Use at your own risk. -
Current Status = "; - ob_start(); - $results = exec("/sbin/pfctl -s rules | grep -c ipblocklist"); - ob_end_clean(); - if ($results > '2') echo "Running"; - else - echo "NOT running"; - - //Get Errors if exists - ob_start(); - $results = exec("/usr/bin/tail -r errorOUT.txt"); - ob_end_clean(); - echo "
"; - echo $results; - echo ""; - - //Get IP Count - echo "
You are blocking "; - ob_start(); - $results = exec("/sbin/pfctl -T show -t ipblocklist |grep -v -c Z"); - ob_end_clean(); - echo $results; - echo " Networks/IPs"; - ?> -

-

-

-
- - - - - +0) { + + conf_mount_rw(); + + $ent = array(); + + if ($_POST['enable'] == 1) { + //echo "enabled"; + $config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] = 1; + + //Process list by downloading and extracting + + $myFile = "lists.txt"; + $myWFile = "wlists.txt"; + $fileContents = file_get_contents($myFile); + $fileWContents = file_get_contents($myWFile); + $lines = explode(PHP_EOL, $fileContents); + $Wlines = explode(PHP_EOL, $fileWContents); + //Remove DIR lists to eliminate duplates + exec("/bin/rm -R lists"); + exec("/bin/rm -R Wlists"); + //Process each list URL, Extract, and put in DIR lists + exec("/bin/mkdir lists"); + exec("/bin/mkdir Wlists"); + foreach ($lines as $line) { + exec("/usr/bin/fetch -o lists $line"); + $filename = basename($line); + //Extract list + exec("/usr/bin/gzip -d lists/$filename"); + } + foreach ($Wlines as $Wline) { + exec("/usr/bin/fetch -o Wlists $Wline"); + $Wfilename = basename($Wline); + //Extract Whitelist + exec("/usr/bin/gzip -d Wlists/$Wfilename"); + } + //Prep pfctl + mwexec("/usr/bin/touch lists/ipfw.ipfw"); + mwexec("/usr/bin/touch Wlists/whitelist"); + mwexec("/bin/mkdir /usr/local/www/packages/countryblock/lists"); + mwexec("/usr/bin/touch /usr/local/www/packages/countryblock/lists/countries.txt"); + mwexec("/usr/bin/touch /usr/local/www/packages/countryblock/countries-white.txt"); + //Now clear ipfw, and process each list to ipfw commands + exec("/bin/sh convert-execute.sh"); + + } + else { + //echo "disabled"; + $config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] = 0; + //Clear Lists + mwexec("ipfw -f flush"); + mwexec("pfctl -t ipblocklist -T kill"); + mwexec("rm -R /usr/local/www/packages/ipblocklist/lists"); + mwexec("sed -i -e '/ipblocklist/d' /tmp/rules.debug"); + mwexec("pfctl -o basic -f /tmp/rules.debug"); + //Clear errorOUT.txt + mwexec("rm errorOUT.txt"); + + } + + + write_config(); + //services_dnsmasq_configure(); + sleep(1); + $savemsg_dnsb = "IP-Blocklist settings have been saved/updated. "; + conf_mount_ro(); +} +?> + + + +

+ + +
+\n"; +} +else { + echo "\n"; +} +?> + +Enable IP-Blocklist

+ + + + + + +
+ + +
+
+ + + + + + + + + + + + + +
Main
+
+
+ +
+ + + + + + + + + + +
+ + + + + + + + +

+ +

+ +
+ + + + + +"; +?> + +
+
+
+
+Usage +
+ Add direct link to list and press + (Example: + Level1, + Level2, + Level3) +
+ Compressed lists should have .gz extention and follows PeerBlock syntax
+ +
Warning! - Apply after firewall change or state reset. Use at your own risk. +
Current Status = "; + ob_start(); + $results = exec("/sbin/pfctl -s rules | grep -c ipblocklist"); + ob_end_clean(); + if ($results > '2') echo "Running"; + else + echo "NOT running"; + + //Get Errors if exists + ob_start(); + $results = exec("/usr/bin/tail -r errorOUT.txt"); + ob_end_clean(); + echo "
"; + echo $results; + echo ""; + + //Get IP Count + echo "
You are blocking "; + ob_start(); + $results = exec("/sbin/pfctl -T show -t ipblocklist |grep -v -c Z"); + ob_end_clean(); + echo $results; + echo " Networks/IPs"; + ?> +

+

+

+
+ + + + + -- cgit v1.2.3