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.188.192.62
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 /
restaurants /
var /
phpmyadmin /
src /
[ HOME SHELL ]
Name
Size
Permission
Action
Advisory
[ DIR ]
drwxr-xr-x
Bookmarks
[ DIR ]
drwxr-xr-x
Charsets
[ DIR ]
drwxr-xr-x
Command
[ DIR ]
drwxr-xr-x
Config
[ DIR ]
drwxr-xr-x
ConfigStorage
[ DIR ]
drwxr-xr-x
Container
[ DIR ]
drwxr-xr-x
Controllers
[ DIR ]
drwxr-xr-x
Crypto
[ DIR ]
drwxr-xr-x
Database
[ DIR ]
drwxr-xr-x
Dbal
[ DIR ]
drwxr-xr-x
Display
[ DIR ]
drwxr-xr-x
Engines
[ DIR ]
drwxr-xr-x
Error
[ DIR ]
drwxr-xr-x
Exceptions
[ DIR ]
drwxr-xr-x
Export
[ DIR ]
drwxr-xr-x
Favorites
[ DIR ]
drwxr-xr-x
Gis
[ DIR ]
drwxr-xr-x
Html
[ DIR ]
drwxr-xr-x
Http
[ DIR ]
drwxr-xr-x
Identifiers
[ DIR ]
drwxr-xr-x
Image
[ DIR ]
drwxr-xr-x
Import
[ DIR ]
drwxr-xr-x
Navigation
[ DIR ]
drwxr-xr-x
Partitioning
[ DIR ]
drwxr-xr-x
Plugins
[ DIR ]
drwxr-xr-x
Properties
[ DIR ]
drwxr-xr-x
Providers
[ DIR ]
drwxr-xr-x
Query
[ DIR ]
drwxr-xr-x
Replication
[ DIR ]
drwxr-xr-x
Routing
[ DIR ]
drwxr-xr-x
Server
[ DIR ]
drwxr-xr-x
Setup
[ DIR ]
drwxr-xr-x
Table
[ DIR ]
drwxr-xr-x
Theme
[ DIR ]
drwxr-xr-x
Tracking
[ DIR ]
drwxr-xr-x
Triggers
[ DIR ]
drwxr-xr-x
Twig
[ DIR ]
drwxr-xr-x
Utils
[ DIR ]
drwxr-xr-x
WebAuthn
[ DIR ]
drwxr-xr-x
Application.php
6.31
KB
-rw-r--r--
BrowseForeigners.php
10.24
KB
-rw-r--r--
Cache.php
1.44
KB
-rw-r--r--
Charsets.php
7.08
KB
-rw-r--r--
Column.php
363
B
-rw-r--r--
ColumnFull.php
500
B
-rw-r--r--
Config.php
38.1
KB
-rw-r--r--
Console.php
3.14
KB
-rw-r--r--
Core.php
22.22
KB
-rw-r--r--
CreateAddField.php
14.6
KB
-rw-r--r--
Current.php
228
B
-rw-r--r--
DatabaseInterface.php
66.01
KB
-rw-r--r--
DbTableExists.php
1.4
KB
-rw-r--r--
EditField.php
495
B
-rw-r--r--
Encoding.php
7.97
KB
-rw-r--r--
FieldMetadata.php
10.64
KB
-rw-r--r--
File.php
19.72
KB
-rw-r--r--
FileListing.php
3.04
KB
-rw-r--r--
FlashMessages.php
1.23
KB
-rw-r--r--
Font.php
4.26
KB
-rw-r--r--
Footer.php
6.82
KB
-rw-r--r--
Git.php
18.5
KB
-rw-r--r--
Header.php
19.81
KB
-rw-r--r--
Index.php
14.45
KB
-rw-r--r--
IndexColumn.php
4.7
KB
-rw-r--r--
InsertEdit.php
73.25
KB
-rw-r--r--
InsertEditColumn.php
1.96
KB
-rw-r--r--
InternalRelations.php
17
KB
-rw-r--r--
IpAllowDeny.php
9
KB
-rw-r--r--
Language.php
4.12
KB
-rw-r--r--
LanguageManager.php
22.27
KB
-rw-r--r--
Linter.php
4.89
KB
-rw-r--r--
ListDatabase.php
4.93
KB
-rw-r--r--
Logging.php
2.79
KB
-rw-r--r--
Menu.php
19.9
KB
-rw-r--r--
Message.php
14.58
KB
-rw-r--r--
Mime.php
893
B
-rw-r--r--
Normalization.php
39.54
KB
-rw-r--r--
OpenDocument.php
8.78
KB
-rw-r--r--
Operations.php
34.63
KB
-rw-r--r--
ParseAnalyze.php
2.23
KB
-rw-r--r--
Pdf.php
3.89
KB
-rw-r--r--
Plugins.php
22.28
KB
-rw-r--r--
Profiling.php
2.17
KB
-rw-r--r--
Release.php
298
B
-rw-r--r--
ResponseRenderer.php
13.03
KB
-rw-r--r--
Sanitize.php
8.62
KB
-rw-r--r--
Scripts.php
3.7
KB
-rw-r--r--
Session.php
7.88
KB
-rw-r--r--
ShowGrants.php
2.06
KB
-rw-r--r--
Sql.php
60.06
KB
-rw-r--r--
SqlQueryForm.php
6.93
KB
-rw-r--r--
StorageEngine.php
15.08
KB
-rw-r--r--
SystemColumn.php
267
B
-rw-r--r--
SystemDatabase.php
4.62
KB
-rw-r--r--
Template.php
3.98
KB
-rw-r--r--
Transformations.php
17.2
KB
-rw-r--r--
TwoFactor.php
7.61
KB
-rw-r--r--
Types.php
23.88
KB
-rw-r--r--
UniqueCondition.php
8.26
KB
-rw-r--r--
Url.php
10.54
KB
-rw-r--r--
UrlRedirector.php
1.43
KB
-rw-r--r--
UserPassword.php
8.25
KB
-rw-r--r--
UserPreferences.php
10.22
KB
-rw-r--r--
UserPrivileges.php
520
B
-rw-r--r--
UserPrivilegesFactory.php
8.61
KB
-rw-r--r--
Util.php
68.74
KB
-rw-r--r--
Version.php
554
B
-rw-r--r--
VersionInformation.php
7.18
KB
-rw-r--r--
ZipExtension.php
10.01
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : File.php
<?php declare(strict_types=1); namespace PhpMyAdmin; use ZipArchive; use function __; use function basename; use function bin2hex; use function bzopen; use function bzread; use function extension_loaded; use function fclose; use function feof; use function file_get_contents; use function fopen; use function fread; use function function_exists; use function gzopen; use function gzread; use function is_link; use function is_readable; use function is_string; use function is_uploaded_file; use function mb_strcut; use function move_uploaded_file; use function ob_end_clean; use function ob_start; use function sprintf; use function strlen; use function tempnam; use function trim; use function unlink; use const UPLOAD_ERR_CANT_WRITE; use const UPLOAD_ERR_EXTENSION; use const UPLOAD_ERR_FORM_SIZE; use const UPLOAD_ERR_INI_SIZE; use const UPLOAD_ERR_NO_FILE; use const UPLOAD_ERR_NO_TMP_DIR; use const UPLOAD_ERR_OK; use const UPLOAD_ERR_PARTIAL; /** * File wrapper class * * @todo when uploading a file into a blob field, should we also consider using * chunks like in import? UPDATE `table` SET `field` = `field` + [chunk] */ class File { /** @var string|null the temporary file name */ protected string|null $name = null; protected string|null $content = null; /** @var Message|null the error message */ protected Message|null $errorMessage = null; /** @var bool whether the file is temporary or not */ protected bool $isTemp = false; protected string|null $compression = null; protected int $offset = 0; /** @var int size of chunk to read with every step */ protected int $chunkSize = 32768; /** @var resource|null file handle */ protected $handle; /** @var bool whether to decompress content before returning */ protected bool $decompress = false; /** @var string charset of file */ protected string $charset = ''; private ZipExtension $zipExtension; private readonly Config $config; /** @param bool|string $name file name or false */ public function __construct(bool|string $name = false) { $this->config = Config::getInstance(); if ($name && is_string($name)) { $this->setName($name); } if (! extension_loaded('zip')) { return; } $this->zipExtension = new ZipExtension(new ZipArchive()); } /** * destructor * * @see File::cleanUp() */ public function __destruct() { $this->cleanUp(); } /** * deletes file if it is temporary, usually from a moved upload file */ public function cleanUp(): bool { if ($this->isTemp()) { return $this->delete(); } return true; } /** * deletes the file */ public function delete(): bool { return unlink((string) $this->getName()); } /** * checks or sets the temp flag for this file * file objects with temp flags are deleted with object destruction * * @param bool $isTemp sets the temp flag */ public function isTemp(bool|null $isTemp = null): bool { if ($isTemp !== null) { $this->isTemp = $isTemp; } return $this->isTemp; } /** * accessor * * @param string|null $name file name */ public function setName(string|null $name): void { $this->name = trim((string) $name); } /** * Gets file content * * @return string|false the binary file content, or false if no content */ public function getRawContent(): string|false { if ($this->content !== null) { return $this->content; } if ($this->isUploaded() && ! $this->checkUploadedFile()) { return false; } if (! $this->isReadable()) { return false; } $this->content = file_get_contents((string) $this->getName()); return $this->content; } /** * Gets file content * * @return string|false the binary file content as a string, * or false if no content */ public function getContent(): string|false { $result = $this->getRawContent(); if ($result === false) { return false; } return '0x' . bin2hex($result); } /** * Whether file is uploaded. */ public function isUploaded(): bool { if ($this->getName() === null) { return false; } return is_uploaded_file($this->getName()); } /** * accessor * * @return string|null File::$_name */ public function getName(): string|null { return $this->name; } /** * Initializes object from uploaded file. * * @param string $name name of file uploaded */ public function setUploadedFile(string $name): bool { $this->setName($name); if (! $this->isUploaded()) { $this->setName(null); $this->errorMessage = Message::error(__('File was not an uploaded file.')); return false; } return true; } /** * Loads uploaded file from table change request. * * @param string $key the md5 hash of the column name * @param string $rownumber number of row to process */ public function setUploadedFromTblChangeRequest( string $key, string $rownumber, ): bool { if ( ! isset($_FILES['fields_upload']) || empty($_FILES['fields_upload']['name']['multi_edit'][$rownumber][$key]) ) { return false; } $file = $this->fetchUploadedFromTblChangeRequestMultiple($_FILES['fields_upload'], $rownumber, $key); switch ($file['error']) { case UPLOAD_ERR_OK: return $this->setUploadedFile($file['tmp_name']); case UPLOAD_ERR_NO_FILE: break; case UPLOAD_ERR_INI_SIZE: $this->errorMessage = Message::error(__( 'The uploaded file exceeds the upload_max_filesize directive in php.ini.', )); break; case UPLOAD_ERR_FORM_SIZE: $this->errorMessage = Message::error(__( 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', )); break; case UPLOAD_ERR_PARTIAL: $this->errorMessage = Message::error(__( 'The uploaded file was only partially uploaded.', )); break; case UPLOAD_ERR_NO_TMP_DIR: $this->errorMessage = Message::error(__('Missing a temporary folder.')); break; case UPLOAD_ERR_CANT_WRITE: $this->errorMessage = Message::error(__('Failed to write file to disk.')); break; case UPLOAD_ERR_EXTENSION: $this->errorMessage = Message::error(__('File upload stopped by extension.')); break; default: $this->errorMessage = Message::error(__('Unknown error in file upload.')); } return false; } /** * strips some dimension from the multi-dimensional array from $_FILES * * <code> * $file['name']['multi_edit'][$rownumber][$key] = [value] * $file['type']['multi_edit'][$rownumber][$key] = [value] * $file['size']['multi_edit'][$rownumber][$key] = [value] * $file['tmp_name']['multi_edit'][$rownumber][$key] = [value] * $file['error']['multi_edit'][$rownumber][$key] = [value] * * // becomes: * * $file['name'] = [value] * $file['type'] = [value] * $file['size'] = [value] * $file['tmp_name'] = [value] * $file['error'] = [value] * </code> * * @param mixed[] $file the array * @param string $rownumber number of row to process * @param string $key key to process * * @return mixed[] */ public function fetchUploadedFromTblChangeRequestMultiple( array $file, string $rownumber, string $key, ): array { return [ 'name' => $file['name']['multi_edit'][$rownumber][$key], 'type' => $file['type']['multi_edit'][$rownumber][$key], 'size' => $file['size']['multi_edit'][$rownumber][$key], 'tmp_name' => $file['tmp_name']['multi_edit'][$rownumber][$key], 'error' => $file['error']['multi_edit'][$rownumber][$key], ]; } /** * sets the name if the file to the one selected in the tbl_change form * * @param string $key the md5 hash of the column name * @param string|null $rownumber number of row to process */ public function setSelectedFromTblChangeRequest( string $key, string|null $rownumber = null, ): bool { if ( ! empty($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]) && is_string($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]) ) { // ... whether with multiple rows ... return $this->setLocalSelectedFile($_REQUEST['fields_uploadlocal']['multi_edit'][$rownumber][$key]); } return false; } /** * Returns possible error message. * * @return Message|null error message */ public function getError(): Message|null { return $this->errorMessage; } /** * Checks whether there was any error. */ public function isError(): bool { return $this->errorMessage !== null; } /** * checks the superglobals provided if the tbl_change form is submitted * and uses the submitted/selected file * * @param string $key the md5 hash of the column name * @param string $rownumber number of row to process */ public function checkTblChangeForm(string $key, string $rownumber): bool { if ($this->setUploadedFromTblChangeRequest($key, $rownumber)) { // well done ... $this->errorMessage = null; return true; } if ($this->setSelectedFromTblChangeRequest($key, $rownumber)) { // well done ... $this->errorMessage = null; return true; } // all failed, whether just no file uploaded/selected or an error return false; } /** * Sets named file to be read from UploadDir. * * @param string $name file name */ public function setLocalSelectedFile(string $name): bool { if ($this->config->settings['UploadDir'] === '') { return false; } $this->setName( Util::userDir($this->config->settings['UploadDir']) . Core::securePath($name), ); if (@is_link((string) $this->getName())) { $this->errorMessage = Message::error(__('File is a symbolic link')); $this->setName(null); return false; } if (! $this->isReadable()) { $this->errorMessage = Message::error(__('File could not be read!')); $this->setName(null); return false; } return true; } /** * Checks whether file can be read. */ public function isReadable(): bool { // suppress warnings from being displayed, but not from being logged // any file access outside of open_basedir will issue a warning return @is_readable((string) $this->getName()); } /** * If we are on a server with open_basedir, we must move the file * before opening it. The FAQ 1.11 explains how to create the "./tmp" * directory - if needed * * @todo move check of $cfg['TempDir'] into Config? */ public function checkUploadedFile(): bool { if ($this->isReadable()) { return true; } $tmpSubdir = $this->config->getUploadTempDir(); if ($tmpSubdir === null) { // cannot create directory or access, point user to FAQ 1.11 $this->errorMessage = Message::error(__( 'Error moving the uploaded file, see [doc@faq1-11]FAQ 1.11[/doc].', )); return false; } $newFileToUpload = (string) tempnam( $tmpSubdir, basename((string) $this->getName()), ); // suppress warnings from being displayed, but not from being logged // any file access outside of open_basedir will issue a warning ob_start(); $moveUploadedFileResult = move_uploaded_file( (string) $this->getName(), $newFileToUpload, ); ob_end_clean(); if (! $moveUploadedFileResult) { $this->errorMessage = Message::error(__('Error while moving uploaded file.')); return false; } $this->setName($newFileToUpload); $this->isTemp(true); if (! $this->isReadable()) { $this->errorMessage = Message::error(__('Cannot read uploaded file.')); return false; } return true; } /** * Detects what compression the file uses * * @return string|false false on error, otherwise string MIME type of * compression, none for none * * @todo move file read part into readChunk() or getChunk() * @todo add support for compression plugins */ protected function detectCompression(): string|false { // suppress warnings from being displayed, but not from being logged // f.e. any file access outside of open_basedir will issue a warning ob_start(); $file = fopen((string) $this->getName(), 'rb'); ob_end_clean(); if (! $file) { $this->errorMessage = Message::error(__('File could not be read!')); return false; } $this->compression = Util::getCompressionMimeType($file); return $this->compression; } /** * Sets whether the content should be decompressed before returned * * @param bool $decompress whether to decompress */ public function setDecompressContent(bool $decompress): void { $this->decompress = $decompress; } /** * Returns the file handle * * @return resource|null file handle */ public function getHandle() { if ($this->handle === null) { $this->open(); } return $this->handle; } /** * Sets the file handle * * @param resource $handle file handle */ public function setHandle($handle): void { $this->handle = $handle; } /** * Sets error message for unsupported compression. */ public function errorUnsupported(): void { $this->errorMessage = Message::error(sprintf( __( 'You attempted to load file with unsupported compression (%s). ' . 'Either support for it is not implemented or disabled by your ' . 'configuration.', ), $this->getCompression(), )); } /** * Attempts to open the file. */ public function open(): bool { if (! $this->decompress) { $this->handle = @fopen((string) $this->getName(), 'r'); } switch ($this->getCompression()) { case false: return false; case 'application/bzip2': if (! $this->config->settings['BZipDump'] || ! function_exists('bzopen')) { $this->errorUnsupported(); return false; } $this->handle = @bzopen($this->getName(), 'r'); break; case 'application/gzip': if (! $this->config->settings['GZipDump'] || ! function_exists('gzopen')) { $this->errorUnsupported(); return false; } $this->handle = @gzopen((string) $this->getName(), 'r'); break; case 'application/zip': if ($this->config->settings['ZipDump'] && function_exists('zip_open')) { return $this->openZip(); } $this->errorUnsupported(); return false; case 'none': $this->handle = @fopen((string) $this->getName(), 'r'); break; default: $this->errorUnsupported(); return false; } return $this->handle !== false; } /** * Opens file from zip * * @param string|null $specificEntry Entry to open */ public function openZip(string|null $specificEntry = null): bool { $result = $this->zipExtension->getContents($this->getName(), $specificEntry); if ($result['error'] !== '') { $this->errorMessage = Message::rawError($result['error']); return false; } $this->content = $result['data']; $this->offset = 0; return true; } /** * Checks whether we've reached end of file */ public function eof(): bool { if ($this->handle !== null) { return feof($this->handle); } return $this->offset == strlen($this->content ?? ''); } /** * Closes the file */ public function close(): void { if ($this->handle !== null) { fclose($this->handle); $this->handle = null; } else { $this->content = ''; $this->offset = 0; } $this->cleanUp(); } /** * Reads data from file * * @param int $size Number of bytes to read */ public function read(int $size): string { if ($this->compression === 'application/zip') { $result = mb_strcut($this->content ?? '', $this->offset, $size); $this->offset += strlen($result); return $result; } if ($this->handle === null) { return ''; } if ($this->compression === 'application/bzip2') { return (string) bzread($this->handle, $size); } if ($this->compression === 'application/gzip') { return (string) gzread($this->handle, $size); } return (string) fread($this->handle, $size); } /** * Returns the character set of the file * * @return string character set of the file */ public function getCharset(): string { return $this->charset; } /** * Sets the character set of the file * * @param string $charset character set of the file */ public function setCharset(string $charset): void { $this->charset = $charset; } /** * Returns compression used by file. * * @return string MIME type of compression, none for none */ public function getCompression(): string { return $this->compression ?? $this->detectCompression(); } /** * Returns the offset * * @return int the offset */ public function getOffset(): int { return $this->offset; } /** * Returns the chunk size * * @return int the chunk size */ public function getChunkSize(): int { return $this->chunkSize; } /** * Sets the chunk size * * @param int $chunkSize the chunk size */ public function setChunkSize(int $chunkSize): void { $this->chunkSize = $chunkSize; } /** * Returns the length of the content in the file * * @return int the length of the file content */ public function getContentLength(): int { return strlen($this->content ?? ''); } }
Close