diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/ipblocklist/OUTBOUND | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | config/ipblocklist/convert.pl | 0 | ||||
-rw-r--r-- | config/ipblocklist/ipblocklist.tmp | 483 |
3 files changed, 243 insertions, 240 deletions
diff --git a/config/ipblocklist/OUTBOUND b/config/ipblocklist/OUTBOUND new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/config/ipblocklist/OUTBOUND diff --git a/config/ipblocklist/convert.pl b/config/ipblocklist/convert.pl index f3e9db12..f3e9db12 100755..100644 --- a/config/ipblocklist/convert.pl +++ b/config/ipblocklist/convert.pl 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 @@ -<?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>
-
+<?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"); + 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(); +} +?> + +<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> + |