Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace App\Command; use Symfony\Component\Console\Input\InputInterface; use Symf..

Decoded Output download

<?php
 namespace App\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use App\Command\Command as BaseCommand; use App\Entity\Manager\SiteManager as SiteEntityManager; use App\Entity\Manager\SshUserManager as SshUserEntityManager; use App\System\CommandExecutor; use App\System\Command\CheckIfFileExistsCommand; use App\System\Command\ChownCommand; use App\System\Command\FindChmodSecureCommand; use App\System\Command\ReadLinkCommand; class SystemPermissionsResetCommand extends BaseCommand { private SiteEntityManager $siteEntityManager; private SshUserEntityManager $sshUserEntityManager; public function __construct(SiteEntityManager $siteEntityManager, SshUserEntityManager $sshUserEntityManager) { goto Aaa37; Eaa07: $this->sshUserEntityManager = $sshUserEntityManager; goto a40a7; Aaa37: $this->siteEntityManager = $siteEntityManager; goto Eaa07; a40a7: parent::__construct(); goto b7e50; b7e50: } protected function configure() : void { goto Cd9a1; ee56d: $this->setDescription("clpctl system:permissions:reset --directories=770 --files=660 --path=."); goto c3d39; c1970: $this->addOption("path", null, InputOption::VALUE_REQUIRED, false); goto f6ca6; Cd9a1: $this->setName("system:permissions:reset"); goto ee56d; c3d39: $this->addOption("directories", null, InputOption::VALUE_REQUIRED, false); goto B2a65; B2a65: $this->addOption("files", null, InputOption::VALUE_REQUIRED, false); goto c1970; f6ca6: } protected function execute(InputInterface $input, OutputInterface $output) : int { try { goto A7d8f; f7e10: $systemUserName = $_SERVER["SUDO_USER"] ?? null; goto Aa90a; b4230: $chmodCommand->setFileChmod($chmodFiles); goto A3bf2; af991: $chownCommand->setUser($user); goto a7283; D647c: $path = realpath($path); goto A283d; C9fc9: fe0be: goto Ff9cd; b6d8c: $chownCommand->setFile($path); goto A6c74; acd9b: $readLinkCommand = new ReadLinkCommand(); goto b4f51; b14d8: $commandExecutor->execute($readLinkCommand); goto b7529; A2c79: $chownCommand = new ChownCommand(); goto af991; cd080: $group = $siteEntity->getUser(); goto d87c5; b7b21: $commandExecutor->execute($chownCommand, 1800); goto c1ca6; Ff9cd: fc45b: goto C1398; ade04: $user = $siteEntity->getUser(); goto b0d0e; Deb0a: a1f17: goto A96e7; b4f51: $readLinkCommand->setFile($path); goto b14d8; A7d8f: $path = (string) $input->getOption("path"); goto a0793; d87c5: $allowedDirectories = [sprintf("/home/%s/", $siteEntity->getUser()), sprintf("/home/%s/", $sshUserEntity->getUserName())]; goto dc5c7; Aff93: F98c5: goto D7003; C1398: return BaseCommand::SUCCESS; goto Ddcf4; c1ca6: $commandExecutor->execute($chmodCommand, 1800); goto df1f8; F12e2: ece6a: goto dc5c3; f43ba: $chmodCommand = new FindChmodSecureCommand(); goto D14fd; f3c09: if (!(false === str_starts_with($path, "/home/"))) { goto ea639; } goto b56bd; Bf716: $user = null; goto b3789; A96e7: $path = sprintf("%s/", rtrim(getcwd(), "/")); goto c1355; D542b: if (!(false === is_null($systemUserName))) { goto fc45b; } goto Ac076; b0a3f: ea639: goto a1e8d; D779b: foreach ($allowedDirectories as $allowedDirectory) { goto e5dee; D4560: goto Ca816; goto f362f; f362f: ad3f6: goto df159; cd6fb: $isValidDirectory = true; goto D4560; df159: C3c2f: goto F332b; e5dee: if (!(true === str_starts_with($path, $allowedDirectory))) { goto ad3f6; } goto cd6fb; F332b: } goto f2959; d88dc: $path = $readLinkPath; goto Cd2cc; eccdf: $chmodFiles = (string) $input->getOption("files"); goto aefd4; A283d: fd49e: goto f7e10; B7d52: $user = $sshUserEntity->getUserName(); goto cd080; a1e8d: goto F770c; goto Deb0a; a17f8: $sshUserEntity = $this->sshUserEntityManager->findOneByUserName($systemUserName); goto aeb0d; a7349: goto Eac88; goto F12e2; aeb0d: if (!(false === is_null($sshUserEntity))) { goto f2378; } goto A5750; A3bf2: $chmodCommand->setFile($path); goto b7b21; Ac076: $commandExecutor = new CommandExecutor(); goto fbd3b; Ad20c: $isValidDirectory = false; goto D779b; c1355: F770c: goto e9b1d; a0793: $chmodDirectories = (string) $input->getOption("directories"); goto eccdf; dc5c3: $allowedDirectories[] = sprintf("/home/%s/", $siteEntity->getUser()); goto ade04; a1906: return BaseCommand::FAILURE; goto Aff93; a7283: $chownCommand->setGroup($group); goto b6d8c; df1f8: $output->writeln("<info>Permissions have been reset.</info>"); goto Dfd32; c9d28: $output->writeln("<error>Not Allowed!</error>"); goto a1906; D7003: if ("." == $path) { goto a1f17; } goto f3c09; Cd2cc: Df727: goto a9e64; f2959: Ca816: goto A3258; A3258: if (!(true === $isValidDirectory)) { goto E0261; } goto D1b0f; dc5c7: f2378: goto a7349; D1b0f: try { goto F7a59; F7a59: $checkIfFileExistsCommand = new CheckIfFileExistsCommand(); goto c71e4; c71e4: $checkIfFileExistsCommand->setFile($path); goto E3590; E3590: $commandExecutor->execute($checkIfFileExistsCommand); goto c2664; c2664: } catch (\Exception $e) { goto c17c0; Eb704: return BaseCommand::FAILURE; goto Ee408; c17c0: $errorMessage = sprintf("Path "%s" does not exist.", $path); goto Fa402; Fa402: $output->writeln(sprintf("<error>%s</error>", $errorMessage)); goto Eb704; Ee408: } goto A2c79; b56bd: $path = sprintf("%s/%s", rtrim(getcwd(), "/"), $path); goto b0a3f; e87db: if (!(false === empty($readLinkPath) && $path != $readLinkPath)) { goto Df727; } goto d88dc; b3789: $group = null; goto D542b; Dfd32: E0261: goto C9fc9; C0d3b: Eac88: goto acd9b; a9e64: if (!(false === empty($allowedDirectories) && false === is_null($user) && false === is_null($group))) { goto fe0be; } goto Ad20c; Fcb5e: if (false === is_null($siteEntity)) { goto ece6a; } goto a17f8; b0d0e: $group = $user; goto C0d3b; fbd3b: $siteEntity = $this->siteEntityManager->findOneByUser($systemUserName); goto Fcb5e; aefd4: if (!(".." == $path)) { goto F98c5; } goto c9d28; Aa90a: $allowedDirectories = []; goto Bf716; A6c74: $chownCommand->setRecursive(true); goto f43ba; A5750: $siteEntity = $sshUserEntity->getSite(); goto B7d52; D14fd: $chmodCommand->setDirectoryChmod($chmodDirectories); goto b4230; e9b1d: if (!(true === str_contains($path, "../"))) { goto fd49e; } goto D647c; b7529: $readLinkPath = $readLinkCommand->getOutput(); goto e87db; Ddcf4: } catch (\Exception $e) { goto d241e; d241e: $logger = $this->getLogger(); goto Bbd28; Bbd28: $logger->exception($e); goto F13c4; dafe5: return BaseCommand::FAILURE; goto f33ac; F596a: $output->writeln(sprintf("<error>%s</error>", $errorMessage)); goto dafe5; F13c4: $errorMessage = $e->getMessage(); goto F596a; f33ac: } } }
 ?>

Did this file decode correctly?

Original Code

<?php
 namespace App\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use App\Command\Command as BaseCommand; use App\Entity\Manager\SiteManager as SiteEntityManager; use App\Entity\Manager\SshUserManager as SshUserEntityManager; use App\System\CommandExecutor; use App\System\Command\CheckIfFileExistsCommand; use App\System\Command\ChownCommand; use App\System\Command\FindChmodSecureCommand; use App\System\Command\ReadLinkCommand; class SystemPermissionsResetCommand extends BaseCommand { private SiteEntityManager $siteEntityManager; private SshUserEntityManager $sshUserEntityManager; public function __construct(SiteEntityManager $siteEntityManager, SshUserEntityManager $sshUserEntityManager) { goto Aaa37; Eaa07: $this->sshUserEntityManager = $sshUserEntityManager; goto a40a7; Aaa37: $this->siteEntityManager = $siteEntityManager; goto Eaa07; a40a7: parent::__construct(); goto b7e50; b7e50: } protected function configure() : void { goto Cd9a1; ee56d: $this->setDescription("\x63\x6c\x70\143\x74\x6c\40\163\x79\163\x74\x65\155\x3a\160\145\x72\x6d\151\x73\x73\151\x6f\x6e\x73\72\162\x65\x73\145\x74\x20\x2d\x2d\x64\151\x72\145\143\164\157\162\x69\145\x73\75\x37\x37\60\40\55\55\x66\x69\x6c\x65\x73\x3d\x36\x36\60\x20\55\x2d\x70\x61\164\x68\x3d\x2e"); goto c3d39; c1970: $this->addOption("\160\141\164\150", null, InputOption::VALUE_REQUIRED, false); goto f6ca6; Cd9a1: $this->setName("\163\171\x73\164\x65\155\x3a\x70\145\162\155\151\163\163\151\157\156\163\x3a\x72\145\x73\145\164"); goto ee56d; c3d39: $this->addOption("\144\x69\162\x65\143\x74\157\x72\x69\x65\x73", null, InputOption::VALUE_REQUIRED, false); goto B2a65; B2a65: $this->addOption("\146\x69\x6c\x65\163", null, InputOption::VALUE_REQUIRED, false); goto c1970; f6ca6: } protected function execute(InputInterface $input, OutputInterface $output) : int { try { goto A7d8f; f7e10: $systemUserName = $_SERVER["\123\x55\104\117\137\125\x53\105\122"] ?? null; goto Aa90a; b4230: $chmodCommand->setFileChmod($chmodFiles); goto A3bf2; af991: $chownCommand->setUser($user); goto a7283; D647c: $path = realpath($path); goto A283d; C9fc9: fe0be: goto Ff9cd; b6d8c: $chownCommand->setFile($path); goto A6c74; acd9b: $readLinkCommand = new ReadLinkCommand(); goto b4f51; b14d8: $commandExecutor->execute($readLinkCommand); goto b7529; A2c79: $chownCommand = new ChownCommand(); goto af991; cd080: $group = $siteEntity->getUser(); goto d87c5; b7b21: $commandExecutor->execute($chownCommand, 1800); goto c1ca6; Ff9cd: fc45b: goto C1398; ade04: $user = $siteEntity->getUser(); goto b0d0e; Deb0a: a1f17: goto A96e7; b4f51: $readLinkCommand->setFile($path); goto b14d8; A7d8f: $path = (string) $input->getOption("\160\141\164\150"); goto a0793; d87c5: $allowedDirectories = [sprintf("\x2f\x68\x6f\155\x65\57\45\x73\57", $siteEntity->getUser()), sprintf("\57\150\157\155\x65\x2f\x25\x73\57", $sshUserEntity->getUserName())]; goto dc5c7; Aff93: F98c5: goto D7003; C1398: return BaseCommand::SUCCESS; goto Ddcf4; c1ca6: $commandExecutor->execute($chmodCommand, 1800); goto df1f8; F12e2: ece6a: goto dc5c3; f43ba: $chmodCommand = new FindChmodSecureCommand(); goto D14fd; f3c09: if (!(false === str_starts_with($path, "\x2f\x68\x6f\x6d\145\57"))) { goto ea639; } goto b56bd; Bf716: $user = null; goto b3789; A96e7: $path = sprintf("\x25\163\x2f", rtrim(getcwd(), "\57")); goto c1355; D542b: if (!(false === is_null($systemUserName))) { goto fc45b; } goto Ac076; b0a3f: ea639: goto a1e8d; D779b: foreach ($allowedDirectories as $allowedDirectory) { goto e5dee; D4560: goto Ca816; goto f362f; f362f: ad3f6: goto df159; cd6fb: $isValidDirectory = true; goto D4560; df159: C3c2f: goto F332b; e5dee: if (!(true === str_starts_with($path, $allowedDirectory))) { goto ad3f6; } goto cd6fb; F332b: } goto f2959; d88dc: $path = $readLinkPath; goto Cd2cc; eccdf: $chmodFiles = (string) $input->getOption("\x66\151\154\145\163"); goto aefd4; A283d: fd49e: goto f7e10; B7d52: $user = $sshUserEntity->getUserName(); goto cd080; a1e8d: goto F770c; goto Deb0a; a17f8: $sshUserEntity = $this->sshUserEntityManager->findOneByUserName($systemUserName); goto aeb0d; a7349: goto Eac88; goto F12e2; aeb0d: if (!(false === is_null($sshUserEntity))) { goto f2378; } goto A5750; A3bf2: $chmodCommand->setFile($path); goto b7b21; Ac076: $commandExecutor = new CommandExecutor(); goto fbd3b; Ad20c: $isValidDirectory = false; goto D779b; c1355: F770c: goto e9b1d; a0793: $chmodDirectories = (string) $input->getOption("\x64\151\162\x65\143\x74\x6f\x72\151\x65\163"); goto eccdf; dc5c3: $allowedDirectories[] = sprintf("\57\x68\157\x6d\x65\57\x25\x73\57", $siteEntity->getUser()); goto ade04; a1906: return BaseCommand::FAILURE; goto Aff93; a7283: $chownCommand->setGroup($group); goto b6d8c; df1f8: $output->writeln("\x3c\151\x6e\x66\157\x3e\120\x65\162\155\x69\x73\x73\151\x6f\156\163\x20\150\x61\166\x65\x20\142\145\x65\156\40\x72\145\x73\145\164\56\x3c\x2f\151\x6e\146\157\x3e"); goto Dfd32; c9d28: $output->writeln("\x3c\x65\162\x72\x6f\162\x3e\116\157\164\40\x41\x6c\x6c\x6f\167\145\144\41\x3c\57\x65\162\162\x6f\x72\x3e"); goto a1906; D7003: if ("\x2e" == $path) { goto a1f17; } goto f3c09; Cd2cc: Df727: goto a9e64; f2959: Ca816: goto A3258; A3258: if (!(true === $isValidDirectory)) { goto E0261; } goto D1b0f; dc5c7: f2378: goto a7349; D1b0f: try { goto F7a59; F7a59: $checkIfFileExistsCommand = new CheckIfFileExistsCommand(); goto c71e4; c71e4: $checkIfFileExistsCommand->setFile($path); goto E3590; E3590: $commandExecutor->execute($checkIfFileExistsCommand); goto c2664; c2664: } catch (\Exception $e) { goto c17c0; Eb704: return BaseCommand::FAILURE; goto Ee408; c17c0: $errorMessage = sprintf("\x50\x61\x74\x68\x20\42\x25\163\x22\x20\144\x6f\x65\x73\40\x6e\x6f\164\40\145\x78\151\163\164\56", $path); goto Fa402; Fa402: $output->writeln(sprintf("\x3c\145\162\x72\x6f\x72\76\45\x73\74\x2f\x65\162\x72\x6f\162\x3e", $errorMessage)); goto Eb704; Ee408: } goto A2c79; b56bd: $path = sprintf("\45\x73\57\x25\163", rtrim(getcwd(), "\x2f"), $path); goto b0a3f; e87db: if (!(false === empty($readLinkPath) && $path != $readLinkPath)) { goto Df727; } goto d88dc; b3789: $group = null; goto D542b; Dfd32: E0261: goto C9fc9; C0d3b: Eac88: goto acd9b; a9e64: if (!(false === empty($allowedDirectories) && false === is_null($user) && false === is_null($group))) { goto fe0be; } goto Ad20c; Fcb5e: if (false === is_null($siteEntity)) { goto ece6a; } goto a17f8; b0d0e: $group = $user; goto C0d3b; fbd3b: $siteEntity = $this->siteEntityManager->findOneByUser($systemUserName); goto Fcb5e; aefd4: if (!("\56\56" == $path)) { goto F98c5; } goto c9d28; Aa90a: $allowedDirectories = []; goto Bf716; A6c74: $chownCommand->setRecursive(true); goto f43ba; A5750: $siteEntity = $sshUserEntity->getSite(); goto B7d52; D14fd: $chmodCommand->setDirectoryChmod($chmodDirectories); goto b4230; e9b1d: if (!(true === str_contains($path, "\x2e\x2e\57"))) { goto fd49e; } goto D647c; b7529: $readLinkPath = $readLinkCommand->getOutput(); goto e87db; Ddcf4: } catch (\Exception $e) { goto d241e; d241e: $logger = $this->getLogger(); goto Bbd28; Bbd28: $logger->exception($e); goto F13c4; dafe5: return BaseCommand::FAILURE; goto f33ac; F596a: $output->writeln(sprintf("\x3c\x65\x72\x72\x6f\x72\x3e\x25\x73\x3c\x2f\x65\x72\162\x6f\x72\76", $errorMessage)); goto dafe5; F13c4: $errorMessage = $e->getMessage(); goto F596a; f33ac: } } }

Function Calls

None

Variables

None

Stats

MD5 cc1d02d17b8a440da0157ca7ed24eb9f
Eval Count 0
Decode Time 79 ms