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\System\Command; use App\System\Command; class CreateUserComma..
Decoded Output download
<?php
namespace App\System\Command;
use App\System\Command;
class CreateUserCommand extends Command
{
private ?string $userName = null;
private ?string $password = null;
private bool $createHomeDirectory = true;
private ?string $homeDirectory = null;
private ?string $skeletonDirectory = null;
private ?string $shell = null;
private ?string $group = null;
private array $groups = [];
private ?string $tmpFile = null;
public function getCommand(): string
{
goto a71f2;
F35d5:
$shell = $this->getShell();
goto B0638;
Aedad:
$createHomeDirectory = $this->getCreateHomeDirectory();
goto d9829;
c2b48:
return $this->command;
goto E0ae8;
Cec1b:
$userName = $this->getUserName();
goto C17ef;
C17ef:
$password = $this->getPassword();
goto F35d5;
E6ba9:
$group = $this->getGroup();
goto E1f4d;
a4fb7:
file_put_contents($tmpFile, $password);
goto f9961;
E1f4d:
$groups = $this->getGroups();
goto a3961;
f9961:
chmod($tmpFile, 0400);
goto B1b61;
B1b61:
$this->command = sprintf("/usr/bin/sudo /usr/sbin/useradd -p %s -%s %s %s -s %s -d %s %s %s", sprintf("$(/usr/bin/sudo /usr/bin/cat %s | /usr/bin/openssl passwd -6 -stdin)", $tmpFile), true === $createHomeDirectory ? "m" : "M", escapeshellarg($userName), false === empty($skeletonDirectory) ? sprintf("-k %s", escapeshellarg($skeletonDirectory)) : '', escapeshellarg($shell), escapeshellarg($homeDirectory), false === empty($group) ? sprintf("-g %s", escapeshellarg($group)) : '', $groups ? sprintf("-G %s", escapeshellarg(implode(",", $groups))) : '');
goto a46f7;
B0638:
$homeDirectory = $this->getHomeDirectory();
goto Aedad;
a71f2:
if ($this->command) {
goto A7f84;
}
goto Cec1b;
a46f7: A7f84:
goto c2b48;
a3961:
$tmpFile = $this->getTmpFile();
goto a4fb7;
d9829:
$skeletonDirectory = $this->getSkeletonDirectory();
goto E6ba9;
E0ae8:
}
public function isSuccessful(): bool
{
goto af0e6;
Ab010:
$isSuccessful = empty($output);
goto cba47;
cba47:
return $isSuccessful;
goto B6685;
af0e6:
$output = $this->getOutput();
goto Ab010;
B6685:
}
public function setUserName(string $userName): void
{
$this->userName = $userName;
}
public function getUserName(): ?string
{
return $this->userName;
}
public function setPassword(string $password): void
{
$this->password = $password;
}
public function getPassword(): ?string
{
return $this->password;
}
public function setHomeDirectory(string $homeDirectory): void
{
$this->homeDirectory = $homeDirectory;
}
public function getHomeDirectory(): ?string
{
return $this->homeDirectory;
}
public function setSkeletonDirectory(string $skeletonDirectory): void
{
$this->skeletonDirectory = $skeletonDirectory;
}
public function getSkeletonDirectory(): ?string
{
return $this->skeletonDirectory;
}
public function setShell(string $shell): void
{
$this->shell = $shell;
}
public function getShell(): ?string
{
return $this->shell;
}
public function setGroups(array $groups): void
{
$this->groups = $groups;
}
public function getGroups(): array
{
return $this->groups;
}
public function setGroup(string $group): void
{
$this->group = $group;
}
public function getGroup(): ?string
{
return $this->group;
}
public function createHomeDirectory($flag): void
{
$this->createHomeDirectory = (bool)$flag;
}
public function getCreateHomeDirectory(): bool
{
return $this->createHomeDirectory;
}
private function getTmpFile(): ?string
{
goto Cf717;
B56a4:
$this->tmpFile = sprintf("/tmp/.clp_tmp_%s", sha1(uniqid(mt_rand(), true)));
goto bd4ec;
bd4ec: Da7bb:
goto Ee304;
Ee304:
return $this->tmpFile;
goto F2ede;
Cf717:
if (!(true === is_null($this->tmpFile))) {
goto Da7bb;
}
goto B56a4;
F2ede:
}
public function __destruct()
{
$tmpFile = $this->getTmpFile();
@unlink($tmpFile);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\System\Command;
use App\System\Command;
class CreateUserCommand extends Command
{
private ?string $userName = null;
private ?string $password = null;
private bool $createHomeDirectory = true;
private ?string $homeDirectory = null;
private ?string $skeletonDirectory = null;
private ?string $shell = null;
private ?string $group = null;
private array $groups = [];
private ?string $tmpFile = null;
public function getCommand(): string
{
goto a71f2;
F35d5:
$shell = $this->getShell();
goto B0638;
Aedad:
$createHomeDirectory = $this->getCreateHomeDirectory();
goto d9829;
c2b48:
return $this->command;
goto E0ae8;
Cec1b:
$userName = $this->getUserName();
goto C17ef;
C17ef:
$password = $this->getPassword();
goto F35d5;
E6ba9:
$group = $this->getGroup();
goto E1f4d;
a4fb7:
file_put_contents($tmpFile, $password);
goto f9961;
E1f4d:
$groups = $this->getGroups();
goto a3961;
f9961:
chmod($tmpFile, 0400);
goto B1b61;
B1b61:
$this->command = sprintf("\x2f\x75\x73\x72\57\x62\x69\x6e\57\163\165\x64\157\40\x2f\x75\x73\162\x2f\x73\x62\x69\156\57\x75\x73\145\162\141\x64\144\x20\55\x70\40\x25\x73\x20\55\45\x73\40\45\x73\x20\45\x73\40\x2d\x73\40\45\163\40\x2d\x64\x20\x25\163\x20\45\x73\x20\x25\x73", sprintf("\44\50\57\165\163\162\x2f\142\x69\x6e\x2f\x73\x75\x64\x6f\x20\57\x75\163\162\x2f\142\x69\156\57\x63\141\164\40\x25\x73\40\174\40\x2f\165\163\x72\57\142\x69\156\x2f\157\x70\145\x6e\163\x73\x6c\40\x70\x61\x73\x73\167\144\40\x2d\66\40\55\163\x74\144\151\156\51", $tmpFile), true === $createHomeDirectory ? "\x6d" : "\115", escapeshellarg($userName), false === empty($skeletonDirectory) ? sprintf("\x2d\153\40\x25\163", escapeshellarg($skeletonDirectory)) : '', escapeshellarg($shell), escapeshellarg($homeDirectory), false === empty($group) ? sprintf("\55\147\x20\45\163", escapeshellarg($group)) : '', $groups ? sprintf("\x2d\107\x20\45\x73", escapeshellarg(implode("\54", $groups))) : '');
goto a46f7;
B0638:
$homeDirectory = $this->getHomeDirectory();
goto Aedad;
a71f2:
if ($this->command) {
goto A7f84;
}
goto Cec1b;
a46f7: A7f84:
goto c2b48;
a3961:
$tmpFile = $this->getTmpFile();
goto a4fb7;
d9829:
$skeletonDirectory = $this->getSkeletonDirectory();
goto E6ba9;
E0ae8:
}
public function isSuccessful(): bool
{
goto af0e6;
Ab010:
$isSuccessful = empty($output);
goto cba47;
cba47:
return $isSuccessful;
goto B6685;
af0e6:
$output = $this->getOutput();
goto Ab010;
B6685:
}
public function setUserName(string $userName): void
{
$this->userName = $userName;
}
public function getUserName(): ?string
{
return $this->userName;
}
public function setPassword(string $password): void
{
$this->password = $password;
}
public function getPassword(): ?string
{
return $this->password;
}
public function setHomeDirectory(string $homeDirectory): void
{
$this->homeDirectory = $homeDirectory;
}
public function getHomeDirectory(): ?string
{
return $this->homeDirectory;
}
public function setSkeletonDirectory(string $skeletonDirectory): void
{
$this->skeletonDirectory = $skeletonDirectory;
}
public function getSkeletonDirectory(): ?string
{
return $this->skeletonDirectory;
}
public function setShell(string $shell): void
{
$this->shell = $shell;
}
public function getShell(): ?string
{
return $this->shell;
}
public function setGroups(array $groups): void
{
$this->groups = $groups;
}
public function getGroups(): array
{
return $this->groups;
}
public function setGroup(string $group): void
{
$this->group = $group;
}
public function getGroup(): ?string
{
return $this->group;
}
public function createHomeDirectory($flag): void
{
$this->createHomeDirectory = (bool)$flag;
}
public function getCreateHomeDirectory(): bool
{
return $this->createHomeDirectory;
}
private function getTmpFile(): ?string
{
goto Cf717;
B56a4:
$this->tmpFile = sprintf("\x2f\164\155\x70\x2f\x2e\x63\154\160\137\164\x6d\160\x5f\45\163", sha1(uniqid(mt_rand(), true)));
goto bd4ec;
bd4ec: Da7bb:
goto Ee304;
Ee304:
return $this->tmpFile;
goto F2ede;
Cf717:
if (!(true === is_null($this->tmpFile))) {
goto Da7bb;
}
goto B56a4;
F2ede:
}
public function __destruct()
{
$tmpFile = $this->getTmpFile();
@unlink($tmpFile);
}
}
Function Calls
None |
Stats
MD5 | 2193ec0831748691e5e234082ba0c92c |
Eval Count | 0 |
Decode Time | 56 ms |