File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console
Upload
[..]
AboutCommand.php (12.59 KB)
Edit
Rename
Del
ApiInstallCommand.php (4.85 KB)
Edit
Rename
Del
BroadcastingInstallCommand.php (16.03 KB)
Edit
Rename
Del
CastMakeCommand.php (1.83 KB)
Edit
Rename
Del
ChannelListCommand.php (4.29 KB)
Edit
Rename
Del
ChannelMakeCommand.php (1.67 KB)
Edit
Rename
Del
ClassMakeCommand.php (1.6 KB)
Edit
Rename
Del
ClearCompiledCommand.php (948 B)
Edit
Rename
Del
CliDumper.php (3.26 KB)
Edit
Rename
Del
ClosureCommand.php (3.02 KB)
Edit
Rename
Del
ComponentMakeCommand.php (4.63 KB)
Edit
Rename
Del
ConfigClearCommand.php (1.14 KB)
Edit
Rename
Del
ConfigMakeCommand.php (1.96 KB)
Edit
Rename
Del
ConfigPublishCommand.php (3.07 KB)
Edit
Rename
Del
ConfigShowCommand.php (2.89 KB)
Edit
Rename
Del
ConsoleMakeCommand.php (2.47 KB)
Edit
Rename
Del
DocsCommand.php (13.4 KB)
Edit
Rename
Del
DownCommand.php (5.56 KB)
Edit
Rename
Del
EnumMakeCommand.php (3.53 KB)
Edit
Rename
Del
EnvironmentCommand.php (726 B)
Edit
Rename
Del
EnvironmentDecryptCommand.php (5.05 KB)
Edit
Rename
Del
EnvironmentEncryptCommand.php (4.76 KB)
Edit
Rename
Del
EventClearCommand.php (1.17 KB)
Edit
Rename
Del
EventGenerateCommand.php (2.07 KB)
Edit
Rename
Del
EventListCommand.php (6.98 KB)
Edit
Rename
Del
EventMakeCommand.php (1.93 KB)
Edit
Rename
Del
ExceptionMakeCommand.php (2.91 KB)
Edit
Rename
Del
InteractsWithComposerPackages.php (1.07 KB)
Edit
Rename
Del
InterfaceMakeCommand.php (1.52 KB)
Edit
Rename
Del
JobMakeCommand.php (2.12 KB)
Edit
Rename
Del
JobMiddlewareMakeCommand.php (1.78 KB)
Edit
Rename
Del
Kernel.php (17.22 KB)
Edit
Rename
Del
KeyGenerateCommand.php (3.49 KB)
Edit
Rename
Del
LangPublishCommand.php (1.82 KB)
Edit
Rename
Del
ListenerMakeCommand.php (4.1 KB)
Edit
Rename
Del
MailMakeCommand.php (6.18 KB)
Edit
Rename
Del
ModelMakeCommand.php (9.83 KB)
Edit
Rename
Del
NotificationMakeCommand.php (4.57 KB)
Edit
Rename
Del
ObserverMakeCommand.php (4.41 KB)
Edit
Rename
Del
OptimizeClearCommand.php (2.06 KB)
Edit
Rename
Del
OptimizeCommand.php (2.04 KB)
Edit
Rename
Del
PackageDiscoverCommand.php (1.05 KB)
Edit
Rename
Del
PolicyMakeCommand.php (5.97 KB)
Edit
Rename
Del
ProviderMakeCommand.php (2.21 KB)
Edit
Rename
Del
QueuedCommand.php (1013 B)
Edit
Rename
Del
ReloadCommand.php (1.82 KB)
Edit
Rename
Del
RequestMakeCommand.php (1.66 KB)
Edit
Rename
Del
ResourceMakeCommand.php (2.57 KB)
Edit
Rename
Del
RouteClearCommand.php (1.12 KB)
Edit
Rename
Del
RouteListCommand.php (16.72 KB)
Edit
Rename
Del
RuleMakeCommand.php (2 KB)
Edit
Rename
Del
ScopeMakeCommand.php (1.7 KB)
Edit
Rename
Del
ServeCommand.php (13.24 KB)
Edit
Rename
Del
StorageLinkCommand.php (2.06 KB)
Edit
Rename
Del
StorageUnlinkCommand.php (1.21 KB)
Edit
Rename
Del
StubPublishCommand.php (5.88 KB)
Edit
Rename
Del
TestMakeCommand.php (3.88 KB)
Edit
Rename
Del
TraitMakeCommand.php (1.81 KB)
Edit
Rename
Del
UpCommand.php (1.44 KB)
Edit
Rename
Del
VendorPublishCommand.php (10.8 KB)
Edit
Rename
Del
ViewClearCommand.php (1.64 KB)
Edit
Rename
Del
ViewMakeCommand.php (6.13 KB)
Edit
Rename
Del
stubs/
Rename
Del
Edit: EnvironmentDecryptCommand.php
<?php namespace Illuminate\Foundation\Console; use Dotenv\Parser\Lines; use Exception; use Illuminate\Console\Command; use Illuminate\Encryption\Encrypter; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Env; use Illuminate\Support\Str; use Symfony\Component\Console\Attribute\AsCommand; use function Laravel\Prompts\password; #[AsCommand(name: 'env:decrypt')] class EnvironmentDecryptCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'env:decrypt {--key= : The encryption key} {--cipher= : The encryption cipher} {--env= : The environment to be decrypted} {--force : Overwrite the existing environment file} {--path= : Path to write the decrypted file} {--filename= : Filename of the decrypted file}'; /** * The console command description. * * @var string */ protected $description = 'Decrypt an environment file'; /** * The filesystem instance. * * @var \Illuminate\Filesystem\Filesystem */ protected $files; /** * Create a new command instance. * * @param \Illuminate\Filesystem\Filesystem $files */ public function __construct(Filesystem $files) { parent::__construct(); $this->files = $files; } /** * Execute the console command. * * @return void */ public function handle() { $key = $this->option('key') ?: Env::get('LARAVEL_ENV_ENCRYPTION_KEY'); if (! $key && $this->input->isInteractive()) { $key = password('What is the decryption key?'); } if (! $key) { $this->fail('A decryption key is required.'); } $cipher = $this->option('cipher') ?: 'AES-256-CBC'; $key = $this->parseKey($key); $encryptedFile = ($this->option('env') ? Str::finish($this->laravel->environmentPath(), DIRECTORY_SEPARATOR).'.env.'.$this->option('env') : $this->laravel->environmentFilePath()).'.encrypted'; $outputFile = $this->outputFilePath(); if (Str::endsWith($outputFile, '.encrypted')) { $this->fail('Invalid filename.'); } if (! $this->files->exists($encryptedFile)) { $this->fail('Encrypted environment file not found.'); } if ($this->files->exists($outputFile) && ! $this->option('force')) { $this->fail('Environment file already exists.'); } try { $encrypter = new Encrypter($key, $cipher); $encryptedContents = $this->files->get($encryptedFile); $decrypted = $this->isReadableFormat($encryptedContents) ? $this->decryptReadableFormat($encryptedContents, $encrypter) : $encrypter->decrypt($encryptedContents); $this->files->put($outputFile, $decrypted); } catch (Exception $e) { $this->fail($e->getMessage()); } $this->components->info('Environment successfully decrypted.'); $this->components->twoColumnDetail('Decrypted file', $outputFile); $this->newLine(); } /** * Determine if the content is in readable format where each variable still has its own plain-text key. * * @param string $contents * @return bool */ protected function isReadableFormat(string $contents): bool { return ! Encrypter::appearsEncrypted($contents); } /** * Decrypt the environment file from readable format. * * @param string $contents * @param \Illuminate\Encryption\Encrypter $encrypter * @return string */ protected function decryptReadableFormat(string $contents, Encrypter $encrypter): string { $result = ''; foreach (Lines::process(preg_split('/\r\n|\r|\n/', $contents)) as $entry) { $pos = strpos($entry, '='); if ($pos === false) { continue; } $name = substr($entry, 0, $pos); $encryptedValue = substr($entry, $pos + 1); $result .= $name.'='.$encrypter->decryptString($encryptedValue)."\n"; } return $result; } /** * Parse the encryption key. * * @param string $key * @return string */ protected function parseKey(string $key) { if (Str::startsWith($key, $prefix = 'base64:')) { $key = base64_decode(Str::after($key, $prefix)); } return $key; } /** * Get the output file path that should be used for the command. * * @return string */ protected function outputFilePath() { $path = Str::finish($this->option('path') ?: $this->laravel->environmentPath(), DIRECTORY_SEPARATOR); $outputFile = $this->option('filename') ?: ('.env'.($this->option('env') ? '.'.$this->option('env') : '')); $outputFile = ltrim($outputFile, DIRECTORY_SEPARATOR); return $path.$outputFile; } }
Simpan