Skip to content

Commit

Permalink
Merge pull request #331 from BBcan177/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgarga committed Mar 29, 2017
2 parents 954f8b3 + 139b5ca commit 38e9e3c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 21 deletions.
2 changes: 1 addition & 1 deletion net/pfSense-pkg-pfBlockerNG/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORTNAME= pfSense-pkg-pfBlockerNG
PORTVERSION= 2.1.1
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,11 @@ function pfb_download($list_url, $file_dwn, $pflex=FALSE, $header, $format, $log
}
}

// '304 not modified' - Utilize previously downloaded file if available
if ($http_status == '304' && file_exists("{$file_dwn}.orig")) {
return TRUE;
}

if ($http_status == '200 OK') {
// Collect file mime-type
$file_type = exec("/usr/bin/file -b --mime-type {$file_dwn}.raw");
Expand Down Expand Up @@ -2467,11 +2472,12 @@ function pfb_livetail($logfile, $mode) {
else {
// DNSBL Lighttpd 'dnsbl_error.log' conditional log parser
while (($pfb_buffer = @fgets($f, 1024)) !== FALSE) {
if (strpos($pfb_buffer, 'HTTPhost') !== FALSE) {
if (strpos($pfb_buffer, 'SERVERsocket') !== FALSE) {
$checkpos = 0;
}

if ($checkpos == 3 && strpos($pfb_buffer, 'HTTP["host"]') !== FALSE) {
if ($checkpos == 2 && strpos($pfb_buffer, 'HTTP["host"]') !== FALSE) {

$line = strstr($pfb_buffer, ' ) compare', TRUE);
$line = ltrim(strstr($line, '] ( ', FALSE), '] ( ');
if (!empty($line)) {
Expand Down Expand Up @@ -4036,7 +4042,7 @@ function sync_package_pfblockerng($cron='') {

// IPv4 REGEX Definitions
$pfb['range'] = '/((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))-((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))/';
$pfb['ipv4'] = '/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/(3[012]|[12]?[0-9]))?/';
$pfb['ipv4'] = '/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)((\/(3[012]|[12]?[0-9]))?(?![-0-9a-zA-Z]))/';

// IPv6 REGEX Definitions - Reference: http://labs.spritelink.net/regex
$pfb['ipv6'] = '/((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?(\/[0-9][0-9]?|1([01][0-9]|2[0-8]))?/';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function pfb_htmlspecialchars($line) {

// Load log
if ($_REQUEST['action'] == 'load') {
if (!$pfb_logfilename) {
if (!file_exists($pfb_logfilename)) {
print ("|3|" . gettext('Log file is empty or does not exist') . ".|");
} else {
$data = implode(array_map('pfb_htmlspecialchars', @file($pfb_logfilename)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
*
* part of pfSense (https://www.pfsense.org)
* Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
* Copyright (c) 2015-2016 BBcan177@gmail.com
* Copyright (c) 2015-2017 BBcan177@gmail.com
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the \"License\");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an \"AS IS\" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

$pgtitle = array(gettext('pfBlockerNG'), gettext('Threat Source Lookup'));
$pgtitle = array(gettext('Firewall'), gettext('pfBlockerNG'), gettext('Alerts'), gettext('Threat Source Lookup'));
$pglinks = array('', '/pfblockerng/pfblockerng_general.php', '/pfblockerng/pfblockerng_alerts.php', '@self');
require('guiconfig.inc');

if (isset($_REQUEST['host'])) {
Expand All @@ -38,7 +39,7 @@
<h4 class="panel-title"><?=gettext("Threat:&emsp;" . $host . $domain); ?></h4>
</div>
<div>
<p class="text-center"><br />NOTE:&emsp;The following links are to external services, so their reliability cannot be guaranteed
<p class="text-center"><br />NOTE:&emsp;The following links are to external services, so their reliability cannot be guaranteed.
It is also recommended to open these links in a different Browser</p>
</div>
<div>
Expand All @@ -59,7 +60,7 @@
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://www.tcpiputils.com/browse/ip-address/<?=$host;?>/">
<td><a target="_blank" href="https://www.tcpiputils.com/browse/ip-address/<?=$host;?>/">
<?=gettext("TCPUtils");?></a></td>
</tr>
<tr>
Expand All @@ -79,7 +80,7 @@
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://www.fortiguard.com/ip_rep/index.php?data=/<?=$host;?>?">
<td><a target="_blank" href="https://www.fortiguard.com/ip_rep/index.php?data=<?=$host;?>?">
<?=gettext("FortiGuard");?></a></td>
</tr>
<tr>
Expand Down Expand Up @@ -142,6 +143,16 @@
<td><a target="_blank" href="https://ransomwaretracker.abuse.ch/ip/<?=$host;?>">
<?=gettext("Ransomware Tracker");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://www.shodan.io/host/<?=$host;?>">
<?=gettext("Shodan");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://viewdns.info/reverseip/?host=<?=$host;?>&t=1">
<?=gettext("ViewDNS.info Reverse IP Lookup");?></a></td>
</tr>

<!-- Mail Server threat source links -->
<tr>
Expand Down Expand Up @@ -175,14 +186,9 @@
<!-- Domain threat source links -->
<tr>
<td>Domain Lookups<i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://www.alexa.com/siteinfo/<?=$domain;?>">
<td><a target="_blank" href="https://www.alexa.com/siteinfo/<?=$domain;?>">
<?=gettext("Alexa");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://www.c-sirt.org/en/incidents-on-domain/<?=$domain;?>">
<?=gettext("C-SIRT");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://safeweb.norton.com/report/show_mobile?name=<?=$domain;?>">
Expand All @@ -200,7 +206,7 @@
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://www.tcpiputils.com/browse/domain/<?=$domain;?>">
<td><a target="_blank" href="https://www.tcpiputils.com/browse/domain/<?=$domain;?>">
<?=gettext("TCPUtils");?></a></td>
</tr>
<tr>
Expand All @@ -210,7 +216,7 @@
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://toolbar.netcraft.com/site_report?url=<?=$domain;?>">
<td><a target="_blank" href="https://toolbar.netcraft.com/site_report?url=<?=$domain;?>">
<?=gettext("Netcraft Site Report");?></a></td>
</tr>
<tr>
Expand All @@ -220,7 +226,7 @@
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://hosts-file.net/?s=<?=$domain;?>">
<td><a target="_blank" href="https://hosts-file.net/?s=<?=$domain;?>">
<?=gettext("hpHosts");?></a></td>
</tr>
<tr>
Expand All @@ -243,6 +249,31 @@
<td><a target="_blank" href="https://passivedns.mnemonic.no/search/?query=<?=$domain;?>&method=exact">
<?=gettext("mnemonic passiveDNS");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://urlscan.io/">
<?=gettext("URL Scan");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://www.virustotal.com/en/domain/<?=$domain;?>/information/">
<?=gettext("Virus Total");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="https://otx.alienvault.com/browse/pulses/?q=<?=$domain;?>&sort=-modified">
<?=gettext("OTX Alienvault");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://viewdns.info/reverseip/?host=<?=$domain;?>&t=1">
<?=gettext("ViewDNS.info Reverse Domain Lookup");?></a></td>
</tr>
<tr>
<td><i class="fa fa-globe pull-right"></i></td>
<td><a target="_blank" href="http://viewdns.info/iphistory/?domain=<?=$domain;?>">
<?=gettext("ViewDNS.info Domain IP History Lookup");?></a></td>
</tr>
<?php endif; ?>
</tbody>
</table>
Expand Down

0 comments on commit 38e9e3c

Please sign in to comment.