Skip to content

Commit

Permalink
v.1.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
findlabnet committed Jun 21, 2024
1 parent 23604fa commit 21c5bf9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ module (version 1.x-1.0.5 or newer) to automatically block anyone trying to acce
Usually this is a bad crawler looking for known potentially vulnerable paths,
such as "wp-admin.php", "xmlrpc.php" and so on.

Also, since version 1.x-1.0.5, you can block bad robots using their well-known User-Agent strings and spam referrer domains.
Also, since version 1.x-1.0.5, you can block bad robots by using:
- their known User-Agent strings;
- SPAM referrer domains.

**New in version 1.x-1.0.4:** option "Report to AbuseIPDB" can be enabled for automatic reporting to AbuseIPDB about blocked scanner's activity.
You need to install [AbuseIPDB report](https://backdropcms.org/project/abuseipdb_report) module to see and use this option.
**New in version 1.x-1.0.4:** "Report to AbuseIPDB" option can be enabled to automatically report blocked scanner activity to AbuseIPDB.
You need to install the [AbuseIPDB report](https://backdropcms.org/project/abuseipdb_report) module to see and use this option.

Installation
------------
Expand Down
2 changes: 1 addition & 1 deletion antiscan.info
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies[] = ip_blocking (>=1.x-1.0.5)

configure = admin/config/people/antiscan

version = 1.0.11
version = 1.0.12
17 changes: 10 additions & 7 deletions antiscan.module
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ function antiscan_logged_in_ip($ip = '') {
* @param string $type
*/
function antiscan_block_ip($ip, $reason, $type) {
$config = config('antiscan.settings');
$log_enabled = $config->get('log_enabled');
$config = config('antiscan.settings');
$log_enabled = $config->get('log_enabled');

if (mb_strlen($reason,'UTF-8') > 230) {
$reason_dec = urldecode(substr($reason, 0, 230)) . ' ... ';
$reason_dec = substr($reason, 0, 200) . ' ... ';
}
else {
$reason_dec = urldecode($reason);
$reason_dec = $reason;
}

if (db_field_exists('blocked_ips', 'type')) {
Expand All @@ -253,9 +253,12 @@ function antiscan_block_ip($ip, $reason, $type) {
}

// Insert the record to DB.
db_insert('blocked_ips')
->fields($fields)
->execute();
try {
db_insert('blocked_ips')->fields($fields)->execute();
}
catch (PDOException|FieldsOverlapException|NoFieldsException $e) {
watchdog_exception('antiscan', $e);
}

if ($log_enabled) {
watchdog(
Expand Down

0 comments on commit 21c5bf9

Please sign in to comment.