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 | : 18.222.209.172
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 /
Config /
[ HOME SHELL ]
Name
Size
Permission
Action
Forms
[ DIR ]
drwxr-xr-x
Settings
[ DIR ]
drwxr-xr-x
ConfigFileTest.php
14.23
KB
-rw-r--r--
DescriptionTest.php
3.72
KB
-rw-r--r--
FormDisplayTemplateTest.php
7.73
KB
-rw-r--r--
FormDisplayTest.php
11.16
KB
-rw-r--r--
FormTest.php
6.12
KB
-rw-r--r--
PageSettingsTest.php
3.29
KB
-rw-r--r--
ServerConfigChecksTest.php
6.77
KB
-rw-r--r--
SettingsTest.php
69.85
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ServerConfigChecksTest.php
<?php declare(strict_types=1); namespace PhpMyAdmin\Tests\Config; use PhpMyAdmin\Config; use PhpMyAdmin\Config\ConfigFile; use PhpMyAdmin\Config\ServerConfigChecks; use PhpMyAdmin\Tests\AbstractTestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use ReflectionException; use ReflectionProperty; use function array_keys; use function mb_strlen; use function str_repeat; use const SODIUM_CRYPTO_SECRETBOX_KEYBYTES; #[CoversClass(ServerConfigChecks::class)] class ServerConfigChecksTest extends AbstractTestCase { private string $sessionID; /** @throws ReflectionException */ protected function setUp(): void { parent::setUp(); $this->setGlobalConfig(); $config = Config::getInstance(); $config->settings['AvailableCharsets'] = []; $config->settings['ServerDefault'] = 0; $cf = new ConfigFile(); $GLOBALS['ConfigFile'] = $cf; $reflection = new ReflectionProperty(ConfigFile::class, 'id'); $this->sessionID = $reflection->getValue($cf); unset($_SESSION['messages']); unset($_SESSION[$this->sessionID]); } public function testManyErrors(): void { $_SESSION[$this->sessionID]['Servers'] = [ '1' => [ 'host' => 'localhost', 'ssl' => false, 'auth_type' => 'config', 'user' => 'username', 'password' => 'password', 'AllowRoot' => true, 'AllowNoPassword' => true, ], ]; $_SESSION[$this->sessionID]['AllowArbitraryServer'] = true; $_SESSION[$this->sessionID]['LoginCookieValidity'] = 5000; $_SESSION[$this->sessionID]['LoginCookieStore'] = 4000; $_SESSION[$this->sessionID]['SaveDir'] = true; $_SESSION[$this->sessionID]['TempDir'] = true; $_SESSION[$this->sessionID]['GZipDump'] = true; $_SESSION[$this->sessionID]['BZipDump'] = true; $_SESSION[$this->sessionID]['ZipDump'] = true; $configChecker = $this->getMockBuilder(ServerConfigChecks::class) ->onlyMethods(['functionExists']) ->setConstructorArgs([$GLOBALS['ConfigFile']]) ->getMock(); // Configure the stub. $configChecker->method('functionExists')->willReturn(false); $configChecker->performConfigChecks(); self::assertSame( [ 'Servers/1/ssl', 'Servers/1/auth_type', 'Servers/1/AllowNoPassword', 'AllowArbitraryServer', 'LoginCookieValidity', 'SaveDir', 'TempDir', ], array_keys($_SESSION['messages']['notice']), ); self::assertSame( ['LoginCookieValidity', 'GZipDump', 'BZipDump', 'ZipDump_import', 'ZipDump_export'], array_keys($_SESSION['messages']['error']), ); } public function testBlowfish(): void { $_SESSION[$this->sessionID] = []; $_SESSION[$this->sessionID]['blowfish_secret'] = null; $_SESSION[$this->sessionID]['Servers'] = [ '1' => ['host' => 'localhost', 'ssl' => true, 'auth_type' => 'cookie', 'AllowRoot' => false], ]; $_SESSION[$this->sessionID]['AllowArbitraryServer'] = false; $_SESSION[$this->sessionID]['LoginCookieValidity'] = -1; $_SESSION[$this->sessionID]['LoginCookieStore'] = 0; $_SESSION[$this->sessionID]['SaveDir'] = ''; $_SESSION[$this->sessionID]['TempDir'] = ''; $_SESSION[$this->sessionID]['GZipDump'] = false; $_SESSION[$this->sessionID]['BZipDump'] = false; $_SESSION[$this->sessionID]['ZipDump'] = false; $configChecker = new ServerConfigChecks($GLOBALS['ConfigFile']); $configChecker->performConfigChecks(); /** * @var mixed $secret * @psalm-suppress TypeDoesNotContainType */ $secret = $_SESSION[$this->sessionID]['blowfish_secret'] ?? ''; self::assertIsString($secret); self::assertSame(SODIUM_CRYPTO_SECRETBOX_KEYBYTES, mb_strlen($secret, '8bit')); $messages = $_SESSION['messages'] ?? null; self::assertIsArray($messages); self::assertArrayHasKey('notice', $messages); self::assertIsArray($messages['notice']); self::assertArrayHasKey('blowfish_secret_created', $messages['notice']); self::assertArrayNotHasKey('error', $messages); } #[RequiresPhpExtension('bz2')] #[RequiresPhpExtension('zip')] public function testBlowfishWithInvalidSecret(): void { $_SESSION[$this->sessionID] = []; $_SESSION[$this->sessionID]['blowfish_secret'] = str_repeat('a', SODIUM_CRYPTO_SECRETBOX_KEYBYTES + 1); $_SESSION[$this->sessionID]['Servers'] = [ '1' => ['host' => 'localhost', 'ssl' => true, 'auth_type' => 'cookie', 'AllowRoot' => false], ]; $configChecker = new ServerConfigChecks($GLOBALS['ConfigFile']); $configChecker->performConfigChecks(); /** * @var mixed $secret * @psalm-suppress TypeDoesNotContainType */ $secret = $_SESSION[$this->sessionID]['blowfish_secret'] ?? ''; self::assertIsString($secret); self::assertSame(SODIUM_CRYPTO_SECRETBOX_KEYBYTES, mb_strlen($secret, '8bit')); $messages = $_SESSION['messages'] ?? null; self::assertIsArray($messages); self::assertArrayHasKey('notice', $messages); self::assertIsArray($messages['notice']); self::assertArrayHasKey('blowfish_secret_created', $messages['notice']); self::assertArrayNotHasKey('error', $messages); } #[RequiresPhpExtension('bz2')] #[RequiresPhpExtension('zip')] public function testBlowfishWithValidSecret(): void { $_SESSION[$this->sessionID] = []; $_SESSION[$this->sessionID]['blowfish_secret'] = str_repeat('a', SODIUM_CRYPTO_SECRETBOX_KEYBYTES); $_SESSION[$this->sessionID]['Servers'] = ['1' => ['host' => 'localhost', 'auth_type' => 'cookie']]; $configChecker = new ServerConfigChecks($GLOBALS['ConfigFile']); $configChecker->performConfigChecks(); /** * @var mixed $secret * @psalm-suppress TypeDoesNotContainType */ $secret = $_SESSION[$this->sessionID]['blowfish_secret'] ?? ''; self::assertIsString($secret); self::assertSame(SODIUM_CRYPTO_SECRETBOX_KEYBYTES, mb_strlen($secret, '8bit')); $messages = $_SESSION['messages'] ?? null; self::assertIsArray($messages); self::assertArrayHasKey('notice', $messages); self::assertIsArray($messages['notice']); self::assertArrayNotHasKey('blowfish_secret_created', $messages['notice']); self::assertArrayNotHasKey('error', $messages); } }
Close