Change a php command in a script

Hi there

I am stuck on an update, and i need the unhashed version of the “updater.secret”. PHP per se doesn’t work on my shared server, but there is an “official” workaround via “scheduled tasks”, where i can run php scripts, however, i can only see, if the command was successful or not, nothing more.

The official way to get the unhashed version of updater.secert is as follows

`php -r ‘$password = trim(shell_exec(“openssl rand -base64 48”));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . “\n”; echo “Insert as “updater.secret”: “.$hash; echo “The plaintext value is: “.$password.”\n”;}else{echo “Could not execute OpenSSL.\n”;};’ ’

Basically what i need is a rewrite, that the result is written in a file and not seen on the screen. I have no clue of php, so i wonder, if anyone could help

Maybe i didn’t understand your problem either. Can’t you just create new keys with the PHP script you mentioned?

If you only have a a web service not not a php command line:

I think the first problem is the fact that you can not use shell_exec() in your php script. So i searched the internet for a php version. Please first check this script. Does it work?

$password = trim(substr(base64_encode(mt_rand()), 0, 47));
$hash = password_hash($password, PASSWORD_DEFAULT);
echo "hash: " . $hash . "<br>";
echo "password: " . $password . "<br>";

If yes i can post you the part for writing to a file.
hash for updater.secret and password is cleartext password.

Thanks, that really did the trick!

I appreciate your help very much!

1 Like