forked from phpvirtualbox/phpvirtualbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recovery.php-disabled
70 lines (54 loc) · 1.86 KB
/
recovery.php-disabled
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/*
phpVirtualBox admin password recovery.
Rename recovery.php-disabled to recovery.php, navigate to it in your web
browser and follow the instructions presented.
*/
# Turn off PHP errors
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
//Set no caching
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
require_once(dirname(__FILE__).'/endpoints/lib/config.php');
require_once(dirname(__FILE__).'/endpoints/lib/utils.php');
require_once(dirname(__FILE__).'/endpoints/lib/vboxconnector.php');
/*
* Clean request
*/
$vboxRequest = clean_request();
/* Check for recovery */
if($vboxRequest['recover']) {
try {
// Use main / auth server
$vbox = new vboxconnector(true);
$vbox->skipSessionCheck = true;
$vbox->connect();
$vbox->vbox->setExtraData('phpvb/users/admin/pass', hash('sha512', 'admin'));
$vbox->vbox->setExtraData('phpvb/users/admin/admin', '1');
echo("Admin account updated. Please rename this file to <b>recovery.php-disabled</b>. phpVirtualBox will refuse to run if this has not been done.");
} catch (Exception $e) {
echo("<pre>");
print_r($e);
echo("</pre>");
}
return;
}
?>
<html>
<head>
<title>Admin Account Recovery</title>
</head>
<body>
<h3>Admin Account Recovery</h3>
<p>This form will add the default user <b>admin</b> with a default password of <b>admin</b>. If the user <b>admin</b> already exists, its password will be changed to <b>admin</b>.</p>
<p>Click the Recover button to add / update this user.</p>
<form method='POST'>
<p>
<input type='hidden' name='recover' value='1' />
<input type='submit' value='Recover' />
</p>
</form>
</body>
</html>