aboutsummaryrefslogtreecommitdiffstats
path: root/config/ipblocklist/ipblocklist.tmp
diff options
context:
space:
mode:
authorTom Schaefer <tom@tomschaefer.org>2010-11-21 11:03:19 -0500
committerTom Schaefer <tom@tomschaefer.org>2010-11-21 11:03:19 -0500
commitae0d47554b5a8a0c0c5d8bab70e4334840edae89 (patch)
tree9418e9a3df111e0f2a57265f90a2eae429e6609d /config/ipblocklist/ipblocklist.tmp
parent8608438108be0c8c9523fca5cfa45291d9c6cb2f (diff)
downloadpfsense-packages-ae0d47554b5a8a0c0c5d8bab70e4334840edae89.tar.gz
pfsense-packages-ae0d47554b5a8a0c0c5d8bab70e4334840edae89.tar.bz2
pfsense-packages-ae0d47554b5a8a0c0c5d8bab70e4334840edae89.zip
IP-Blocklist 3.0 fix for BETA2.0 and 1.2.3
Diffstat (limited to 'config/ipblocklist/ipblocklist.tmp')
-rw-r--r--[-rwxr-xr-x]config/ipblocklist/ipblocklist.tmp430
1 files changed, 240 insertions, 190 deletions
diff --git a/config/ipblocklist/ipblocklist.tmp b/config/ipblocklist/ipblocklist.tmp
index 3c07817b..c562d80b 100755..100644
--- a/config/ipblocklist/ipblocklist.tmp
+++ b/config/ipblocklist/ipblocklist.tmp
@@ -1,190 +1,240 @@
-<?php
- //Version 2.2
-
- require_once('config.inc');
- require("guiconfig.inc");
- include("head.inc");
-
- //set the config as a global variable
- global $config;
-
- $global_usage = '/usr/local/www/packages/ipblocklist/global_usage';
- //$fh = fopen($global_usage, 'r');
-
- //phpinfo();
-
-if (count($_POST)>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("rm -R lists");
- exec("rm -R Wlists");
- //Process each list URL, Extract, and put in DIR lists
- exec("mkdir lists");
- exec("mkdir Wlists");
- foreach ($lines as $line) {
- exec("fetch -o lists $line");
- $filename = basename($line);
- //Extract list
- exec("gzip -d lists/$filename");
- }
- foreach ($Wlines as $Wline) {
- exec("fetch -o Wlists $Wline");
- $Wfilename = basename($Wline);
- //Extract Whitelist
- exec("gzip -d Wlists/$Wfilename");
- }
- //Prep pfctl
- mwexec("touch lists/ipfw.ipfw");
- mwexec("touch Wlists/whitelist");
- //Now clear ipfw, and process each list to ipfw commands
- mwexec("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();
-}
-?>
-
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: IP-Blocklist</p>
-<form method=POST action="">
-
-<?php
-if ($config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] == 1) {
- echo "<input name='enable' type='checkbox' value='1' checked>\n";
-}
-else {
- echo "<input name='enable' type='checkbox' value='1'>\n";
-}
-?>
-<?php
-if(isset($_POST['formSubmit']))
- {
-
-
- if(isset($_POST['formlogging']))
- {
- exec("touch logging");
- }
- else
- {
- exec("rm logging");
- }
-
- }
-?>
-<strong>Enable IP-Blocklist</strong><br><br>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr>
- <td class="tabcont" >
- <?php if ($savemsg_dnsb) print_info_box($savemsg_dnsb); ?>
-
- </form>
- <?php
-
- if (file_exists("logging")) {
- echo "<input name='formlogging' type='checkbox' value='Yes' checked/>";
- } else {
- echo "<input name='formlogging' type='checkbox' value='Yes'/>";
- }
-?>
- Enable Logging <input type="submit" name="formSubmit" value="Save" /><br />
- <center>
- <iframe frameboarder=0 boarder=0 src="ipblocklist_list.php" name="lists" id="lists" width="100%" height="200">
- </iframe>
- </center>
- <br/>
- <u>Usage</u>
- <br/>
- Add direct link to list and press <img src="../../themes/nervecenter/images/icons/icon_plus.gif">
- (Example:
- <a href="http://iblocklist.whitacrecomputers.com/files/bt_level1.gz">Level1</a>,
- <a href="http://iblocklist.whitacrecomputers.com/files/bt_level2.gz">Level2</a>,
- <a href="http://iblocklist.whitacrecomputers.com/files/bt_level3.gz">Level3</a>)
- <br/>
- Compressed lists should have .gz extention and follows PeerBlock syntax <br/>
-
- <br/><span style="color:red">Warning!</span> - Apply after firewall change or state reset. Use at your own risk.
- <?php
- echo "<br/><br/>Current Status = ";
- ob_start();
- $results = exec("pfctl -s rules | grep -c ipblocklist");
- ob_end_clean();
- if ($results > '2') echo "Running";
- else
- echo "<span style='color:red'>NOT running</span>";
-
- //Get Errors if exists
- ob_start();
- $results = exec("tail -r errorOUT.txt");
- ob_end_clean();
- echo "<br/><span style='color:red'>";
- echo $results;
- echo "</span>";
-
- //Get IP Count
- echo "<br>You are blocking ";
- ob_start();
- $results = exec("pfctl -T show -t ipblocklist |grep -v -c Z");
- ob_end_clean();
- echo $results;
- echo " IPs";
- ?>
-
-
-
-<br/>
-<br/>
-
-
-
-
-</div>
-<?php
- //This input guarantees that a POST is sent
- echo "<input type='hidden' name='zzz' value='required'>";
-?>
-
-</td>
-</tr>
-</table>
-<input type="submit" value="Save/Update">
-</form>
-
-<?php include("fend.inc"); ?>
-
-</body>
-</html>
+<?php
+ //Version 2.2
+ header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
+ require_once('config.inc');
+ require("guiconfig.inc");
+ include("head.inc");
+
+ //set the config as a global variable
+ global $config;
+
+ $global_usage = '/usr/local/www/packages/ipblocklist/global_usage';
+ //$fh = fopen($global_usage, 'r');
+
+ //phpinfo();
+
+if (count($_POST)>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();
+}
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<form method=POST action="">
+<?php
+if ($config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] == 1) {
+ echo "<input name='enable' type='checkbox' value='1' checked>\n";
+}
+else {
+ echo "<input name='enable' type='checkbox' value='1'>\n";
+}
+?>
+<?php
+if(isset($_POST['formSubmit']))
+ {
+
+
+ if(isset($_POST['formlogging']))
+ {
+ exec("/usr/bin/touch logging");
+ }
+ else
+ {
+ exec("/bin/rm logging");
+ }
+
+ }
+?>
+<strong>Enable IP-Blocklist</strong><br><br>
+<?php if ($savemsg_cb) print_info_box($savemsg_cb);
+ //if ($output) print_info_box($output,$output2);
+ echo($output);
+ echo($output2);
+ ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("IP-Blocklist", true, "ipblocklist.php");
+ $tab_array[1] = array("Settings", false, "settings.php");
+ $tab_array[2] = array("Whitelist", false, "whitelist.php");
+ $tab_array[3] = array("Interfaces", false, "ipblocklist_if.php");
+ $tab_array[4] = array("Help", false, "http://forum.pfsense.org/index.php/topic,24769.0.html");
+ $tab_array[5] = array("Email", false, "email.php");
+ display_top_tabs($tab_array);
+?>
+</form>
+</td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr">Main</td>
+
+ </tr>
+
+ <tr>
+ <td class="listlr" valign="middle">
+ <br />
+ <center>
+ <iframe frameboarder=0 boarder=0 src="ipblocklist_list.php" name="lists" id="lists" width="100%" height="200">
+ </iframe>
+ </center>
+
+
+
+
+
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr>
+ <td >
+
+
+ </form>
+
+
+
+
+
+ <br/><br/>
+ <input type="submit" name="formSubmit" value="Save/Update" />
+ </p>
+</form>
+<br/>
+
+
+
+
+</div>
+<?php
+ //This input guarantees that a POST is sent
+ echo "<input type='hidden' name='zzz' value='required'>";
+?>
+
+</td>
+</tr>
+</table>
+ </td>
+
+
+ </tr>
+
+
+</table>
+</div>
+<br>
+<u>Usage</u>
+ <br/>
+ Add direct link to list and press <img src="../../themes/nervecenter/images/icons/icon_plus.gif">
+ (Example:
+ <a href="http://iblocklist.whitacrecomputers.com/files/bt_level1.gz">Level1</a>,
+ <a href="http://iblocklist.whitacrecomputers.com/files/bt_level2.gz">Level2</a>,
+ <a href="http://iblocklist.whitacrecomputers.com/files/bt_level3.gz">Level3</a>)
+ <br/>
+ Compressed lists should have .gz extention and follows PeerBlock syntax <br/>
+
+ <br/><span style="color:red">Warning!</span> - Apply after firewall change or state reset. Use at your own risk.
+ <?php
+ echo "<br/><br/>Current Status = ";
+ ob_start();
+ $results = exec("/sbin/pfctl -s rules | grep -c ipblocklist");
+ ob_end_clean();
+ if ($results > '2') echo "Running";
+ else
+ echo "<span style='color:red'>NOT running</span>";
+
+ //Get Errors if exists
+ ob_start();
+ $results = exec("/usr/bin/tail -r errorOUT.txt");
+ ob_end_clean();
+ echo "<br/><span style='color:red'>";
+ echo $results;
+ echo "</span>";
+
+ //Get IP Count
+ echo "<br>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";
+ ?>
+<br><br>
+<!--<input type="submit" value="Save/Update"><br><br>
+--><p>
+</p>
+</td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
+