// Debugging should be disabled by default
// $GLOBALS['ctracker_debug'] = true;
+// Mail headers
+$GLOBALS['ctracker_header'] = 'From: ctracker@domain.invalid';
+
+// Email recipient for all emails
+$GLOBALS['ctracker_email'] = 'you@domain.invalid';
+
// [EOF]
?>
`script_name` varchar(255) NOT NULL COMMENT 'Full script name',
`referer` varchar(255) NOT NULL COMMENT 'Referer',
`first_attempt` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'First attempt',
- `last_attempt` timestamp NOT NULL COMMENT 'Last attempt',
+ `last_attempt` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Last attempt',
`count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'Counter',
PRIMARY KEY (`id`),
KEY `remote_addr` (`remote_addr`)
runCrackerTrackerSql($SQL, __FUNCTION__, __LINE__);
}
-// Checks if an entry with IP/check_worm combination is there
+// Checks if an entry with IP/check_worm/domain combination is there
function isCrackerTrackerEntryFound ($rowData) {
// Construct the SELECT query
- $SQL = 'SELECT `id` FROM `ctracker_data` WHERE `remote_addr`="' . crackerTrackerEscapeString($rowData['remote_addr']) . '" AND `check_worm` = "' . crackerTrackerEscapeString($rowData['check_worm']) . '" LIMIT 1';
+ $SQL = 'SELECT `id` FROM `ctracker_data` WHERE `remote_addr`="' . crackerTrackerEscapeString($rowData['remote_addr']) . '" AND `check_worm` = "' . crackerTrackerEscapeString($rowData['check_worm']) . '" AND `server_name`="' . crackerTrackerEscapeString($rowData['server_name']) . '" LIMIT 1';
// Run the SQL and check if we have one line
return (mysql_num_rows(runCrackerTrackerSql($SQL, __FUNCTION__, __LINE__)) == 1);
// All fine
return true;
- } else {
+ } elseif (isset($GLOBALS['ctracker_email'])) {
// Send it
- return mail(constant('__CTRACKER_EMAIL'), 'CTracker: Attack detected!', $mail, 'From: ctracker@mxchange.org');
+ return mail($GLOBALS['ctracker_email'], 'CTracker: Attack detected!', $mail, $GLOBALS['ctracker_header']);
+ } else {
+ // Send it the deprecated way with constant
+ return mail(constant('__CTRACKER_EMAIL'), 'CTracker: Attack detected!', $mail, $GLOBALS['ctracker_header']);
}
} // END - if
}