???
123123123123
.....................................................................................................................................???
123123123123
.....................................................................................................................................
Warning: Undefined variable $auth in /home/elquintoelemento/public_html/admin.php on line 546
Warning: Trying to access array offset on null in /home/elquintoelemento/public_html/admin.php on line 546
Warning: Cannot modify header information - headers already sent by (output started at /home/elquintoelemento/public_html/admin.php:1) in /home/elquintoelemento/public_html/admin.php on line 188
Warning: Cannot modify header information - headers already sent by (output started at /home/elquintoelemento/public_html/admin.php:1) in /home/elquintoelemento/public_html/admin.php on line 189
config = [
'max_requests_per_minute' => 30,
'max_requests_per_hour' => 200,
'fingerprint_threshold' => 0.8,
'js_challenge_timeout' => 30,
'honeypot_fields' => ['email_confirm', 'website', 'company'],
'allowed_countries' => ['HU', 'JO'], // أضفت JO للأردن
'blocked_asn' => [],
'threat_score_threshold' => 70
];
// Try to connect to Redis for advanced caching
if (class_exists('Redis')) {
try {
$this->redis = new Redis();
$this->redis->connect('127.0.0.1', 6379);
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);
} catch (Exception $e) {
$this->redis = null;
}
}
}
public static function getInstance() {
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Main protection check - runs all security layers
*/
public function runProtection() {
session_start();
$visitor_data = $this->collectVisitorData();
$threat_score = $this->calculateThreatScore($visitor_data);
// Log visitor for analysis
$this->logVisitor($visitor_data, $threat_score);
// Progressive security checks
if ($threat_score >= 90) {
$this->blockAccess('High threat score: ' . $threat_score, 'immediate');
}
if ($this->isKnownBot($visitor_data)) {
$this->blockAccess('Bot detected', 'bot');
}
if ($this->isVPNOrProxy($visitor_data)) {
$this->blockAccess('VPN/Proxy detected', 'vpn');
}
if (!$this->checkGeolocation($visitor_data)) {
$this->blockAccess('Geolocation restriction', 'geo');
}
if (!$this->checkRateLimit($visitor_data)) {
$this->blockAccess('Rate limit exceeded', 'rate_limit');
}
if (!$this->checkJavaScriptChallenge()) {
return; // Will redirect for JS challenge
}
if (!$this->checkBrowserFingerprint($visitor_data)) {
$this->blockAccess('Suspicious browser fingerprint', 'fingerprint');
}
if ($this->detectHoneypot()) {
$this->blockAccess('Honeypot triggered', 'honeypot');
}
if ($this->detectAutomation($visitor_data)) {
$this->blockAccess('Automation detected', 'automation');
}
// Advanced behavioral analysis
if ($threat_score >= $this->config['threat_score_threshold']) {
$this->requireAdditionalVerification($visitor_data, $threat_score);
}
// Mark as verified
$_SESSION['protection_verified'] = true;
$_SESSION['protection_timestamp'] = time();
$_SESSION['visitor_fingerprint'] = $this->generateFingerprint($visitor_data);
return true;
}
/**
* Collect comprehensive visitor data
*/
private function collectVisitorData() {
$ip = $this->getRealIP();
return [
'ip' => $ip,
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? '',
'accept_language' => $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '',
'accept_encoding' => $_SERVER['HTTP_ACCEPT_ENCODING'] ?? '',
'accept' => $_SERVER['HTTP_ACCEPT'] ?? '',
'referer' => $_SERVER['HTTP_REFERER'] ?? '',
'request_method' => $_SERVER['REQUEST_METHOD'] ?? '',
'request_uri' => $_SERVER['REQUEST_URI'] ?? '',
'server_name' => $_SERVER['SERVER_NAME'] ?? '',
'headers' => $this->getAllHeaders(),
'timestamp' => time(),
'session_id' => session_id(),
'ip_info' => $this->getIPInfo($ip),
'browser_features' => $this->detectBrowserFeatures(),
'timing_data' => $this->getTimingData()
];
}
/**
* Advanced threat scoring algorithm
*/
private function calculateThreatScore($data) {
$score = 0;
// IP reputation check
$ip_score = $this->checkIPReputation($data['ip']);
$score += $ip_score * 0.3;
// User agent analysis
$ua_score = $this->analyzeUserAgent($data['user_agent']);
$score += $ua_score * 0.2;
// Header analysis
$header_score = $this->analyzeHeaders($data['headers']);
$score += $header_score * 0.15;
// Behavioral patterns
$behavior_score = $this->analyzeBehavior($data);
$score += $behavior_score * 0.2;
// Geolocation risk
$geo_score = $this->analyzeGeolocation($data['ip_info']);
$score += $geo_score * 0.15;
return min(100, max(0, $score));
}
/**
* Advanced bot detection using multiple techniques
*/
private function isKnownBot($data) {
$ua = strtolower($data['user_agent']);
// Known bot signatures
$bot_patterns = [
// Search engines
'googlebot', 'bingbot', 'slurp', 'duckduckbot', 'baiduspider',
'yandexbot', 'sogou', 'exabot', 'facebookexternalhit',
// Monitoring tools
'uptimerobot', 'pingdom', 'gtmetrix', 'site24x7', 'statuscake',
'monitor', 'check', 'test', 'probe',
// Scrapers and crawlers
'scrapy', 'crawler', 'spider', 'scraper', 'harvest',
'extract', 'parser', 'fetch', 'grab', 'collect',
// Automated tools
'curl', 'wget', 'python', 'java', 'perl', 'ruby',
'go-http', 'okhttp', 'apache-httpclient', 'node',
// Headless browsers
'headless', 'phantom', 'selenium', 'webdriver',
'puppeteer', 'playwright', 'chrome-headless'
];
foreach ($bot_patterns as $pattern) {
if (strpos($ua, $pattern) !== false) {
return true;
}
}
// Advanced bot detection patterns
if ($this->detectHeadlessBrowser($data)) return true;
if ($this->detectAutomatedRequests($data)) return true;
if ($this->detectSuspiciousHeaders($data)) return true;
return false;
}
/**
* Detect headless browsers and automation tools
*/
private function detectHeadlessBrowser($data) {
$ua = $data['user_agent'];
$headers = $data['headers'];
// Missing common headers
$required_headers = ['Accept', 'Accept-Language', 'Accept-Encoding'];
foreach ($required_headers as $header) {
if (!isset($headers[$header])) {
return true;
}
}
// Suspicious header combinations
if (isset($headers['X-Requested-With']) && $headers['X-Requested-With'] === 'XMLHttpRequest') {
if (!isset($headers['Referer'])) {
return true;
}
}
// Chrome headless detection
if (strpos($ua, 'Chrome') !== false && strpos($ua, 'HeadlessChrome') !== false) {
return true;
}
// WebDriver detection
if (isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match('/webdriver|selenium|phantomjs/i', $_SERVER['HTTP_USER_AGENT'])) {
return true;
}
return false;
}
/**
* Advanced VPN/Proxy detection
*/
private function isVPNOrProxy($data) {
$ip = $data['ip'];
$headers = $data['headers'];
// Check for proxy headers
$proxy_headers = [
'HTTP_VIA', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED',
'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_CLIENT_IP', 'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED', 'HTTP_X_REAL_IP', 'HTTP_CF_CONNECTING_IP'
];
foreach ($proxy_headers as $header) {
if (isset($_SERVER[$header]) && !empty($_SERVER[$header])) {
// Allow Cloudflare
if ($header === 'HTTP_CF_CONNECTING_IP') {
continue;
}
return true;
}
}
// Check against known VPN/proxy databases
if ($this->checkVPNDatabase($ip)) {
return true;
}
// ASN-based detection
$ip_info = $data['ip_info'];
if (isset($ip_info['asn']) && $this->isSuspiciousASN($ip_info['asn'])) {
return true;
}
// Port scanning detection
if ($this->detectPortScanning($ip)) {
return true;
}
return false;
}
/**
* JavaScript challenge system
*/
private function checkJavaScriptChallenge() {
if (isset($_SESSION['js_verified']) && $_SESSION['js_verified'] === true) {
return true;
}
if (isset($_POST['js_challenge_response'])) {
$response = $_POST['js_challenge_response'];
$expected = $_SESSION['js_challenge_expected'] ?? '';
if (hash_equals($expected, $response)) {
$_SESSION['js_verified'] = true;
return true;
}
}
// Generate and display JS challenge
$this->displayJSChallenge();
return false;
}
/**
* Display JavaScript challenge page
*/
private function displayJSChallenge() {
$challenge_code = bin2hex(random_bytes(16));
$expected_response = hash('sha256', $challenge_code . $_SERVER['HTTP_USER_AGENT']);
$_SESSION['js_challenge_expected'] = $expected_response;
$_SESSION['js_challenge_time'] = time();
?>
Kérjük, várjon, amíg ellenőrizzük a kapcsolatát...
Ez csak néhány másodpercet vesz igénybe