From 6923665f97c4621ff9677a91a2a2c4af185a146c Mon Sep 17 00:00:00 2001 From: Devops Date: Tue, 4 Apr 2017 10:36:18 +0100 Subject: [PATCH] bin/ovh-api --- www/dbq/dbq.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 3cd859b8..fc458c17 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -462,6 +462,20 @@ class DbQ extends nb { exit; } + public function ssha_password($password='') { + if ($password=='') $password = $this->params['table']; + if ($password=='' and !empty($_POST['password'])) $password = $_POST['password']; + echo << + + + +EOF; + $salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4); + $password = '{SSHA}' . base64_encode(sha1( $password.$salt, TRUE ). $salt); + return [ 'SSHA' => $password ]; + } + public function status() { #$this->perm--; $rows = []; @@ -673,6 +687,9 @@ class DbQ extends nb { $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.'/'.$r['id'].'.'.$this->ext.'"'); }); + } elseif ($action == 'ssha_password') { + $this->page($this,'ssha_password'); + } elseif ($action == 'cryptkey') { $this->page($this->db,'cryptkey',['key']); -- 2.47.3