-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrdp.php
More file actions
51 lines (37 loc) · 1.14 KB
/
Copy pathrdp.php
File metadata and controls
51 lines (37 loc) · 1.14 KB
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
<?php
/*
* Simple RDP connection file generator
*
* $Id$
* Copyright (C) 2011 Ian Moore (imoore76 at yahoo dot com)
*
*/
# Turn off PHP notices
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
require_once(dirname(__FILE__).'/lib/utils.php');
$_GET = clean_request();
foreach(array('port','host','vm') as $g) {
$_GET[$g] = str_replace(array("\n","\r","\0"),'',$_GET[$g]);
}
/*
* Check for port range or list of ports
*/
if(preg_match('/[^\d]/',$_GET['port'])) {
require_once(dirname(__FILE__).'/lib/config.php');
require_once(dirname(__FILE__).'/lib/vboxconnector.php');
global $_SESSION;
session_init();
$vbox = new vboxconnector();
$vbox->connect();
$args = array('vm'=>$_GET['vm']);
$response = array();
$vbox->getVMDetails($args,$response);
$_GET['port'] = $response['data']['consolePort'];
}
header("Content-type: application/x-rdp",true);
header("Content-disposition: attachment; filename=\"". str_replace(array('"','.'),'_',$_GET['vm']) .".rdp\"",true);
echo('
full address:s:'.$_GET['host'].($_GET['port'] ? ':'.$_GET['port'] : '').'
compression:i:1
displayconnectionbar:i:1
');