Skip to content

Commit

Permalink
3.1.7
Browse files Browse the repository at this point in the history
In AbuseIPDB White List or confidence = 0 : do it after country check
  • Loading branch information
conseilgouz committed Dec 14, 2024
1 parent 7402740 commit bc0cb44
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 26 deletions.
4 changes: 2 additions & 2 deletions cgsecureinstaller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="4.0" type="plugin" group="system" method="upgrade">
<name>plgcgsecureinstaller</name>
<author>ConseilGouz</author>
<creationDate>2024-12-06</creationDate>
<creationDate>2024-12-14</creationDate>
<copyright>(C)2024 ConseilGouz. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<version>3.1.6</version>
<version>3.1.7</version>
<description>CG Secure</description>
<scriptfile>script.install.php</scriptfile>
<files>
Expand Down
13 changes: 12 additions & 1 deletion com_cgsecure_changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
<changelog>
<element>com_cgsecure</element>
<type>package</type>
<version>3.1.6</version>
<version>3.1.7</version>
<note>
<item>Update : 14/12/2024</item>
</note>
<fix>
<item>In AbuseIPDB White List or confidence = 0 : do it after country check</item>
</fix>
</changelog>
<changelog>
<element>com_cgsecure</element>
<type>package</type>
<version>3.1.7</version>
<note>
<item>Update : 06/12/2024</item>
</note>
Expand Down
4 changes: 2 additions & 2 deletions packages/com_cgsecure/cgsecure.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4.0" method="upgrade">
<name>COM_CGSECURE</name>
<creationDate>2024-12-06</creationDate>
<creationDate>2024-12-14</creationDate>
<author>ConseilGouz</author>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<copyright>Copyright (C) 2024 ConseilGouz.com. All Rights Reserved</copyright>
<license>GNU/GPL Version 3 or later - https://www.gnu.org/licenses/gpl-3.0.html</license>
<version>3.1.6</version>
<version>3.1.7</version>
<scriptfile>script.php</scriptfile>
<namespace path="src">ConseilGouz\Component\CGSecure</namespace>
<description>COM_CGSECURE_XML_DESCRIPTION</description>
Expand Down
22 changes: 9 additions & 13 deletions packages/library_cgsecure/Helper/Cgipcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

defined('_JEXEC') or die();

use Joomla\CMS\Application\CMSWebApplicationInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
Expand Down Expand Up @@ -112,7 +111,7 @@ public static function check_ip($plugin, $context)
self::$latest_rejected = self::get_rejected();
$ip = IpHelper::getIp();
// $ip = $_SERVER['REMOTE_ADDR'];
// $ip = '218.92.1.234'; // test hackeur chinois
// $ip = '218.92.1.234'; // test hackeur chinois/confidence = 0
// $ip = '92.184.96.127'; // in abuseip confidence = 0
// $ip = '54.36.148.179'; // in abuseip whitelist
if (self::whiteList($ip)) {
Expand Down Expand Up @@ -168,10 +167,6 @@ public static function check_ip($plugin, $context)
}
return;
}
if ($resp->data->isWhitelisted || $resp->data->abuseConfidenceScore == 0) { // in AbuseIPDB whitelist
// self::redir_out();
return true;
}
// Verifie si l'IP du visiteur est dans la liste des pays que j'ai autorise
if ($resp->data->countryCode == "") { // AbuseIPDB : no country
if (self::$logging) {
Expand Down Expand Up @@ -222,9 +217,11 @@ public static function check_ip($plugin, $context)
}
self::set_rejected(self::$caller, self::$errtype, $ip, $resp->data->countryCode, self::$params->keep);
self::redir_out();
} elseif (isset($resp->data->reports) && (count($resp->data->reports) > 0)) { // country OK : check if already reported
} elseif (isset($resp->data->reports) && (count($resp->data->reports) > 0)
&& !$resp->data->isWhitelisted && ($resp->data->abuseConfidenceScore > 0)
) { // country OK : check if already reported or whitelisted in abuseIPDB or not active anymore
if (self::$logging) {
Log::add(self::$context.' : SPAM, ip: '.$ip.', reported = '.count($resp->data->reports), Log::DEBUG, self::$caller);
Log::add(self::$context.' : SPAM, ip: '.$ip.', reported = '.count($resp->data->reports).',confidence = '.$resp->data->abuseConfidenceScore, Log::DEBUG, self::$caller);
}
if (self::$report) {
self::report(self::$context, $ip);
Expand Down Expand Up @@ -273,18 +270,17 @@ public static function check_spammer($plugin, $context)
}
return false; // suppose OK
}
if ($resp->data->isWhitelisted || $resp->data->abuseConfidenceScore == 0) { // in AbuseIPDB whitelist
return false;
} // in AbuseIPDB whitelist
// Verifie si l'IP du visiteur est dans la liste des pays que j'ai autorise
if (isset($resp->data->countryCode) && ($resp->data->countryCode == "")) { // AbuseIPDB perdu
if (self::$logging) {
Log::add(self::$context.' : '.'Country not found in AbuseIPDB, ip '.$ip.','.$resp->data->countryCode, Log::DEBUG, self::$caller);
}
return true; // spammeur
} elseif (isset($resp->data->reports) && (count($resp->data->reports) > 0)) { // country OK : check if already reported
} elseif (isset($resp->data->reports) && (count($resp->data->reports) > 0)
&& !$resp->data->isWhitelisted && ($resp->data->abuseConfidenceScore > 0)
) { // country OK : check if already reported or whitelisted in abuseIPDB or not active anymore
if (self::$logging) {
Log::add(self::$context.' : SPAM, ip: '.$ip.', reported = '.count($resp->data->reports), Log::DEBUG, self::$caller);
Log::add(self::$context.' : SPAM, ip: '.$ip.', reported = '.count($resp->data->reports).',confidence = '.$resp->data->abuseConfidenceScore, Log::DEBUG, self::$caller);
}
return true; // spammeur
}
Expand Down
4 changes: 2 additions & 2 deletions packages/library_cgsecure/cgsecure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<name>CGSecure Library</name>
<libraryname>cgsecure</libraryname>
<author>ConseilGouz</author>
<version>3.1.6</version>
<creationDate>2024-12-06</creationDate>
<version>3.1.7</version>
<creationDate>2024-12-14</creationDate>
<copyright>(C)2024 ConseilGouz. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
Expand Down
4 changes: 2 additions & 2 deletions packages/plg_authentication_cgsecure/cgsecure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="4.0" type="plugin" group="authentication" method="upgrade">
<name>PLG_AUTH_COUNTRY</name>
<author>ConseilGouz</author>
<creationDate>2024-12-06</creationDate>
<creationDate>2024-12-14</creationDate>
<copyright>(C)2024 ConseilGouz. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<version>3.1.6</version>
<version>3.1.7</version>
<description>PLG_AUTH_COUNTRY_XML_DESCRIPTION</description>
<files>
<filename plugin="cgsecure">cgsecure.php</filename>
Expand Down
4 changes: 2 additions & 2 deletions packages/plg_system_cgsecure/cgsecure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension type="plugin" group="system" method="upgrade" version="4.0">
<name>System - CG Secure</name>
<author>conseilgouz</author>
<creationDate>2024-12-06</creationDate>
<creationDate>2024-12-14</creationDate>
<copyright>(C)2024 ConseilGouz. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<version>3.1.6</version>
<version>3.1.7</version>
<description>CG_SECURE_DESC</description>
<files>
<filename plugin="cgsecure">cgsecure.php</filename>
Expand Down
4 changes: 2 additions & 2 deletions packages/plg_user_cgsecure/cgsecure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="4.0" type="plugin" group="user" method="upgrade">
<name>CG_COUNTRY</name>
<author>ConseilGouz</author>
<creationDate>2024-12-06</creationDate>
<creationDate>2024-12-14</creationDate>
<copyright>(C)2024 ConseilGouz. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<version>3.1.6</version>
<version>3.1.7</version>
<description>CG_COUNTRY_XML_DESCRIPTION</description>
<files>
<filename plugin="cgsecure">cgsecure.php</filename>
Expand Down

0 comments on commit bc0cb44

Please sign in to comment.