Server IP : 15.235.198.142 / Your IP : 216.73.216.155 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/yme/wp-content/plugins/wordfence/vendor/wordfence/mmdb-reader/src/ |
Upload File : |
<?php namespace Wordfence\MmdbReader; use Wordfence\MmdbReader\Exception\FormatException; class DatabaseMetadata { const MAX_LENGTH = 131072; //128 * 1024; const FIELD_MAJOR_VERSION = 'binary_format_major_version'; const FIELD_NODE_COUNT = 'node_count'; const FIELD_RECORD_SIZE = 'record_size'; const FIELD_IP_VERSION = 'ip_version'; const FIELD_BUILD_EPOCH = 'build_epoch'; private $data; public function __construct($data) { $this->data = $data; } private function getField($key, $default = null, &$exists = null) { if (!array_key_exists($key, $this->data)) { $exists = false; return $default; } $exists = true; return $this->data[$key]; } private function requireField($key) { $value = $this->getField($key, null, $exists); if (!$exists) throw new FormatException("Metadata field {$key} is missing"); return $value; } public function requireInteger($key) { $value = $this->requireField($key); if (!is_int($value)) throw new FormatException("Field {$key} should be an integer, received: " . print_r($value, true)); return $value; } public function getMajorVersion() { return $this->requireInteger(self::FIELD_MAJOR_VERSION); } public function getNodeCount() { return $this->requireInteger(self::FIELD_NODE_COUNT); } public function getRecordSize() { return $this->requireInteger(self::FIELD_RECORD_SIZE); } public function getIpVersion() { return $this->requireInteger(self::FIELD_IP_VERSION); } public function getBuildEpoch() { return $this->requireInteger(self::FIELD_BUILD_EPOCH); } public static function parse($handle) { $offset = $handle->getPosition(); $parser = new DataFieldParser($handle, $offset); $value = $parser->parseField(); if (!is_array($value)) throw new FormatException('Unexpected field type found when metadata map was expected: ' . print_r($value, true)); return new self($value); } }