Linux ubuntu22 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 x86_64
nginx/1.18.0
: 128.199.27.159 | : 216.73.216.1
Cant Read [ /etc/named.conf ]
8.1.31
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 /
sifaris /
app /
Traits /
[ HOME SHELL ]
Name
Size
Permission
Action
backup
[ DIR ]
drwxrwxr-x
CommonTrait.php
14.19
KB
-rw-rw-r--
ErrorTrait.php
1.56
KB
-rw-rw-r--
FileUploadTrait.php
4.32
KB
-rw-rw-r--
HelperTrait.php
953
B
-rw-rw-r--
ImageUploadTrait.php
23.37
KB
-rw-rw-r--
RepoTrait.php
692
B
-rw-rw-r--
SecurityTrait.php
827
B
-rw-rw-r--
SeederTrait.php
510
B
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : FileUploadTrait.php
<?php namespace App\Traits; use App\Traits\HelperTrait; use Illuminate\Support\Str; use File; trait FileUploadTrait { use HelperTrait; //uploads any file, validates against provided extension list and size //sangam public function uploadFileByTrait($directory_path, $data, array $valid_extensions = [], $max_size = 2048 * 1024) { // dd($valid_extensions); try { if (empty($data['file_content'])) return $this->makeError('No file was uploaded.'); $file_data = $data['file_content']; $ext = pathinfo($data['file_name'], PATHINFO_EXTENSION); //dd($ext); if (!$ext) return $this->makeError('File type could not be recognized.'); if (!$this->is_valid_extension($ext, $valid_extensions)) { $new_ext = implode(' , ', $valid_extensions); $ext_message = 'Only ' . $new_ext . ' file(s) are allowed'; return $this->makeError($ext_message); } //get size in bytes $size = $this->getBase64FileSize($file_data); if ($size > $max_size) { $size_message = 'File should not be larger than ' . $this->getFileSizeReadableString($max_size); return $this->makeError($size_message); } $ext_full = '.'.$ext; $base_name= basename($data['file_name'],$ext_full); $safeName = Str::slug($base_name).'-'. time() . '.' . $ext; @list($type, $file_data) = explode(';', $file_data); @list(, $file_data) = explode(',', $file_data); //allow to save base64 content without type prefix - not safe as wrong text could be sent as base64 - sangam - 2021-04-07 if(empty($file_data)) $file_data = $data['file_content']; if (!empty($file_data)) { if (!file_exists(public_path($directory_path)) && !is_dir(public_path($directory_path))) { mkdir(public_path($directory_path), 0777, true); } $full_path = $directory_path . '/' . $safeName; $data = [ 'size_bytes' => $size, 'size_readable' => $this->getFileSizeReadableString($size), 'extension' => '.' . $ext, 'file_path' => $full_path, 'file_name' => $safeName ]; file_put_contents(public_path($full_path), base64_decode($file_data)); return $this->makeResponse(null, $data); } else { return $this->makeError('File type could not be recognized.'); } } catch (\Throwable $th) { return $this->makeError($th->getMessage()); } } private function is_valid_extension($ext, array $valid_extensions) { return in_array($ext, $valid_extensions); } private function is_valid_size($size, $max_size) { return $size <= $max_size; } private function getBase64FileSize($base64FileContent) { //return memory size in B, KB, MB try { $size_in_bytes = (int)(strlen(rtrim($base64FileContent, '=')) * 3 / 4); //$size_in_kb = $size_in_bytes / 1024; //$size_in_mb = $size_in_kb / 1024; return $size_in_bytes; }catch (\Throwable $e) { return 0; } } /** * @param string $message * @param array $data * * @return array */ public static function makeError($message, array $data = []) { $res = [ 'success' => false, 'message' => $message, ]; if (!empty($data)) { $res['data'] = $data; } return $res; } public static function makeResponse($message = null, $data = null) { return [ 'success' => true, 'data' => $data, 'message' => $message, 'stage' => 'file upload' ]; } //DELETE UPLOAD FILE public function deleteUploadFiles($path) { try { if(File::exists(public_path($path))) return File::delete(public_path($path)); return false; } catch (\Throwable $t) { return $this->sendError($t->getMessage()); } } }
Close