]> git.nbdom.net Git - nb.git/commitdiff
bin/ovh-api
authorDevops <sys@15gifts.com>
Tue, 4 Apr 2017 09:36:18 +0000 (10:36 +0100)
committerDevops <sys@15gifts.com>
Tue, 4 Apr 2017 09:36:18 +0000 (10:36 +0100)
www/dbq/dbq.php

index 3cd859b85bef2818a1f57d47d80c1983c5d1338e..fc458c17de4840c29e1072233f15a2ec76f9dada 100644 (file)
@@ -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
+<form action="$this->uri" method="post">
+<label>Password: </label><input type="text" name="password" value="$password" />
+<input type="submit" />
+</form>
+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']);