├── README.md
├── manual
├── ModuleLand PRVE WHMCS Module Installation guide.pdf
└── ModuleLand PRVE WHMCS Module usage guide.pdf
└── modules
├── addons
└── prve
│ ├── Ipv4
│ ├── Address.php
│ ├── Subnet.php
│ └── SubnetIterator.php
│ ├── db.sql
│ ├── hooks.php
│ ├── img
│ ├── kvm.png
│ └── openvz.png
│ ├── proxmox.php
│ └── prve.php
└── servers
└── prve
├── VncViewer.jar
├── clientarea.tpl
├── img
├── lxc.png
├── novnc.png
├── online.png
├── os
│ ├── centos.png
│ ├── debian.png
│ ├── ubuntu.png
│ ├── w2k.png
│ ├── w2k3.png
│ ├── w2k8.png
│ ├── win7.png
│ ├── wvista.png
│ └── wxp.png
├── qemu.png
├── running.png
├── stopped.png
├── suspended.png
└── tigervnc.png
├── js
└── CircularLoader.js
├── novnc
├── images
│ ├── alt.png
│ ├── clipboard.png
│ ├── connect.png
│ ├── ctrl.png
│ ├── ctrlaltdel.png
│ ├── disconnect.png
│ ├── drag.png
│ ├── esc.png
│ ├── favicon.ico
│ ├── favicon.png
│ ├── fullscreen.png
│ ├── keyboard.png
│ ├── mouse_left.png
│ ├── mouse_middle.png
│ ├── mouse_none.png
│ ├── mouse_right.png
│ ├── power.png
│ ├── screen_320x460.png
│ ├── screen_57x57.png
│ ├── screen_700x700.png
│ ├── settings.png
│ ├── showextrakeys.png
│ └── tab.png
├── include
│ ├── Orbitron700.ttf
│ ├── Orbitron700.woff
│ ├── base.css
│ ├── base64.js
│ ├── black.css
│ ├── blue.css
│ ├── chrome-app
│ │ └── tcp-client.js
│ ├── des.js
│ ├── display.js
│ ├── inflator.js
│ ├── input.js
│ ├── jsunzip.js
│ ├── keyboard.js
│ ├── keysym.js
│ ├── keysymdef.js
│ ├── logo.js
│ ├── playback.js
│ ├── rfb.js
│ ├── ui.js
│ ├── util.js
│ ├── web-socket-js
│ │ ├── README.txt
│ │ ├── WebSocketMain.swf
│ │ ├── swfobject.js
│ │ └── web_socket.js
│ ├── websock.js
│ └── webutil.js
└── novnc_pve.php
├── prve.php
└── tigervnc.php
/README.md:
--------------------------------------------------------------------------------
1 | # PRVE
2 |
3 | I wrote this module for WHMCS at Feb 2016 and I tried to sell it via moduleland.com, But didn't sell at least one copy!
4 |
5 | So i decided to publish it (which i worked on it about 2 months) open-source.
6 |
7 | This is a PROXMOX VE module for WHMCS 6.x
8 |
9 | You can see guides to install in manual folder. I did disable the license section and there's no need to obtain any license. So you can ignore license part in the manual.
10 |
--------------------------------------------------------------------------------
/manual/ModuleLand PRVE WHMCS Module Installation guide.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/manual/ModuleLand PRVE WHMCS Module Installation guide.pdf
--------------------------------------------------------------------------------
/manual/ModuleLand PRVE WHMCS Module usage guide.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/manual/ModuleLand PRVE WHMCS Module usage guide.pdf
--------------------------------------------------------------------------------
/modules/addons/prve/Ipv4/Address.php:
--------------------------------------------------------------------------------
1 | ip_long);
57 | }
58 |
59 | /**
60 | * toLong
61 | * Returns value as decimal (long) address
62 | *
63 | * @access public
64 | * @return real
65 | */
66 | public function toLong() {
67 | return $this->ip_long;
68 | }
69 |
70 | /**
71 | * toBinary
72 | * Returns binary representation of address
73 | *
74 | * @access public
75 | * @return string
76 | */
77 | public function toBinary() {
78 | return str_pad(decbin($this->ip_long),32,0,STR_PAD_LEFT);
79 | }
80 |
81 | /**
82 | * __toString
83 | * Magic method returns dotted quad IP address
84 | *
85 | * @access public
86 | * @return string
87 | */
88 | public function __toString() {
89 | return $this->toString();
90 | }
91 |
92 | /**
93 | * __construct
94 | * Private constructor
95 | *
96 | * @param real $long
97 | * @access private
98 | * @return void
99 | */
100 | private function __construct($long) {
101 | $this->ip_long = $long;
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/modules/addons/prve/Ipv4/Subnet.php:
--------------------------------------------------------------------------------
1 | toString();
52 | if ($s instanceof Ipv4_Address) $s = $s->toString();
53 | if (is_string($n) and !$s) $this->setFromString($n);
54 | elseif ($n and $s) $this->setNetwork($n)->setNetmask($s);
55 | }
56 |
57 | /**
58 | * fromString
59 | * Primarily for chaining and consistency
60 | *
61 | * @param mixed $data
62 | * @static
63 | * @access public
64 | * @return Ipv4_Subnet
65 | */
66 | static function fromString($data) {
67 | return new Ipv4_Subnet($data);
68 | }
69 |
70 | /**
71 | * CIDRtoIP
72 | * Static method converts CIDR to dotted-quad IP notation
73 | *
74 | * @param int $cidr
75 | * @static
76 | * @access public
77 | * @return string
78 | */
79 | static function CIDRtoIP($cidr) {
80 | if (!($cidr >= 0 and $cidr <= 32))
81 | throw new Exception(self::ERROR_CIDR_FORMAT);
82 |
83 | return long2ip(bindec(str_pad(str_pad('', $cidr, '1'), 32, '0')));
84 | }
85 |
86 | /**
87 | * ContainsAddress
88 | * Static method to determine if an IP is on a subnet
89 | *
90 | * @param mixed $sn
91 | * @param mixed $ip
92 | * @static
93 | * @access public
94 | * @return bool
95 | */
96 | static function ContainsAddress($sn,$ip) {
97 | if (is_string($sn)) $sn = Ipv4_Subnet::fromString($sn);
98 | if (is_string($ip)) $ip = Ipv4_Address::fromString($ip);
99 | if (!$sn instanceof Ipv4_Subnet) throw new Exception(self::ERROR_SUBNET_FORMAT);
100 | if (!$ip instanceof Ipv4_Address) throw new Exception(Ipv4_Address::ERROR_ADDR_FORMAT);
101 | $sn_dec = ip2long($sn->getNetmask());
102 |
103 | return (($ip->toLong() & $sn_dec) == (ip2long($sn->getNetwork()) & $sn_dec));
104 | }
105 |
106 | /**
107 | * setFromString
108 | * Parse subnet string
109 | *
110 | * @param string $data
111 | * @access public
112 | * @return self
113 | */
114 | public function setFromString($data) {
115 | // Validate that the input matches an expected pattern
116 | if (!preg_match('!^([0-9]{1,3}\.){3}[0-9]{1,3}(( ([0-9]{1,3}\.){3}[0-9]{1,3})|(/[0-9]{1,2}))$!',$data))
117 | throw new Exception(self::ERROR_NETWORK_FORMAT);
118 |
119 | // Parse one of two formats possible, first is /CIDR format
120 | if (strpos($data,'/')) {
121 | list($network,$cidr) = explode('/',$data,2);
122 |
123 | $this->setNetwork($network);
124 | $this->sn = ip2long(self::CIDRtoIP($cidr));
125 | }
126 | // Second format is network space subnet
127 | else {
128 | list($network,$subnet) = explode(' ',$data,2);
129 | $this->setNetwork($network);
130 | $this->setNetmask($subnet);
131 | }
132 |
133 | return $this;
134 | }
135 |
136 | /**
137 | * contains
138 | * Method to check if an IP is on this network
139 | *
140 | * @param mixed $ip
141 | * @access public
142 | * @return bool
143 | */
144 | public function contains($ip) {
145 | return self::ContainsAddress($this,$ip);
146 | }
147 |
148 | /**
149 | * setNetwork
150 | * Sets the network on the object, from dotted-quad notation
151 | *
152 | * @param string $data
153 | * @access public
154 | * @return self
155 | */
156 | public function setNetwork($data) {
157 | $this->nw = Ipv4_Address::fromString($data)->toLong();
158 | return $this;
159 | }
160 |
161 | /**
162 | * setNetmask
163 | * Sets the netmask on the object, from dotted-quad notation
164 | *
165 | * @param string $data
166 | * @access public
167 | * @return self
168 | */
169 | public function setNetmask($data) {
170 | $data = Ipv4_Address::fromString($data);
171 |
172 | if (!preg_match('/^1*0*$/',$data->toBinary()))
173 | throw new Exception(self::ERROR_SUBNET_FORMAT);
174 |
175 | $this->sn = $data->toLong();
176 | return $this;
177 | }
178 |
179 | /**
180 | * getNetmask
181 | * Returns the netmask as dotted-quad string
182 | *
183 | * @access public
184 | * @return string
185 | */
186 | public function getNetmask() {
187 | return long2ip($this->sn);
188 | }
189 |
190 | /**
191 | * getNetmaskCidr
192 | * Returns the CIDR value representing the netmask
193 | *
194 | * @access public
195 | * @return int
196 | */
197 | public function getNetmaskCidr() {
198 | return strlen(rtrim(decbin($this->sn),'0'));
199 | }
200 |
201 | /**
202 | * getNetwork
203 | * Returns the network address in dotted-quad notation
204 | *
205 | * @access public
206 | * @return string
207 | */
208 | public function getNetwork() {
209 | $nw_bin = Ipv4_Address::fromLong($this->nw)->toBinary();
210 | $nw_bin = (str_pad(substr($nw_bin,0,$this->getNetmaskCidr()),32,0));
211 | return Ipv4_Address::fromBinary($nw_bin)->toString();
212 | }
213 |
214 | /**
215 | * getFirstHostAddr
216 | * Returns the first address of this network
217 | *
218 | * @access public
219 | * @return string
220 | */
221 | public function getFirstHostAddr() {
222 | $bin_net = Ipv4_Address::fromString($this->getNetwork())->toBinary();
223 | $bin_first = (str_pad(substr($bin_net,0,31),32,1));
224 | return Ipv4_Address::fromBinary($bin_first)->toString();
225 | }
226 |
227 | /**
228 | * getLastHostAddr
229 | * Returns last host of this network
230 | *
231 | * @access public
232 | * @return string
233 | */
234 | public function getLastHostAddr() {
235 | $bin_bcast = Ipv4_Address::fromString($this->getBroadcastAddr())->toBinary();
236 | $bin_last = (str_pad(substr($bin_bcast,0,31),32,0));
237 | return Ipv4_Address::fromBinary($bin_last)->toString();
238 | }
239 |
240 | /**
241 | * getBroadcastAddr
242 | * Returns the broadcast address for this network
243 | *
244 | * @access public
245 | * @return string
246 | */
247 | public function getBroadcastAddr() {
248 | $bin_host = Ipv4_Address::fromLong($this->nw)->toBinary();
249 | $bin_bcast = str_pad(substr($bin_host,0,$this->getNetmaskCidr()),32,1);
250 | return Ipv4_Address::fromBinary($bin_bcast)->toString();
251 | }
252 |
253 | /**
254 | * getTotalHosts
255 | * Returns a count of the total number of hosts on this network
256 | *
257 | * @access public
258 | * @return int
259 | */
260 | public function getTotalHosts() {
261 | return (bindec(str_pad('',(32-$this->getNetmaskCidr()),1)) - 1);
262 | }
263 |
264 | /**
265 | * getIterator
266 | * Returns an iterator for addresses in this subnet
267 | *
268 | * @access public
269 | * @return Ipv4_SubnetIterator
270 | */
271 | public function getIterator() {
272 |
273 | if (!class_exists('Ipv4_SubnetIterator'))
274 | require_once(dirname(__FILE__).'/SubnetIterator.php');
275 |
276 | return new Ipv4_SubnetIterator($this);
277 | }
278 |
279 | /**
280 | * __toString
281 | * Magic method prints subnet in IP/cidr format
282 | *
283 | * @access public
284 | * @return string
285 | */
286 | public function __toString() {
287 | return sprintf(
288 | '%s/%s',
289 | $this->getNetwork(),
290 | $this->getNetmaskCidr()
291 | );
292 | }
293 |
294 | /**
295 | * count
296 | * Implements Countable interface
297 | *
298 | * @access public
299 | * @return void
300 | */
301 | public function count() {
302 | return $this->getTotalHosts();
303 | }
304 | }
305 |
--------------------------------------------------------------------------------
/modules/addons/prve/Ipv4/SubnetIterator.php:
--------------------------------------------------------------------------------
1 | low_dec = ip2long($subnet->getFirstHostAddr());
22 | $this->hi_dec = ip2long($subnet->getLastHostAddr());
23 | }
24 |
25 | function rewind() {
26 | $this->position = 0;
27 | }
28 |
29 | function current() {
30 | return long2ip($this->low_dec + $this->position);
31 | }
32 |
33 | function key() {
34 | return $this->position;
35 | }
36 |
37 | function next() {
38 | ++$this->position;
39 | }
40 |
41 | function valid() {
42 | return (($this->low_dec + $this->position) <= $this->hi_dec);
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/modules/addons/prve/db.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `mod_prve` (
2 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | `license` text NOT NULL,
4 | `localkey` text,
5 | PRIMARY KEY (`id`)
6 | );
7 | INSERT INTO `mod_prve` (`id`, `license`, `localkey`) VALUES (1, 'null', NULL);
8 | CREATE TABLE IF NOT EXISTS `mod_prve_ip_addresses` (
9 | `id` int(11) NOT NULL AUTO_INCREMENT,
10 | `pool_id` int(11) NOT NULL DEFAULT '0',
11 | `ipaddress` varchar(255) NOT NULL DEFAULT '0',
12 | `mask` varchar(255) NOT NULL DEFAULT '0',
13 | PRIMARY KEY (`id`),
14 | UNIQUE KEY `ipaddress` (`ipaddress`)
15 | );
16 | CREATE TABLE IF NOT EXISTS `mod_prve_ip_pools` (
17 | `id` int(11) NOT NULL AUTO_INCREMENT,
18 | `title` varchar(255) NOT NULL,
19 | `gateway` varchar(100) DEFAULT NULL,
20 | PRIMARY KEY (`id`)
21 | );
22 | CREATE TABLE IF NOT EXISTS `mod_prve_plans` (
23 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
24 | `title` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT 'Plan name',
25 | `vmtype` varchar(8) NOT NULL COMMENT 'Type of Guest e.g KVM or Openvz or others in feuture',
26 | `ostype` varchar(8) DEFAULT NULL COMMENT 'Operating System Type',
27 | `cpus` tinyint(2) unsigned DEFAULT NULL,
28 | `cpuemu` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT 'Emulated CPU Type e.g: 486 | athlon | pentium | pentium2 | pentium3 | coreduo | core2duo | kvm32 | kvm64 | qemu32 | qemu64 | phenom | Conroe | Penryn | Nehalem | Westmere | SandyBridge | IvyBridge | Haswell | Broadwell | Opteron_G1 | Opteron_G2 | Opteron_G3 | Opteron_G4 | Opteron_G5 | host',
29 | `cores` tinyint(2) unsigned DEFAULT NULL COMMENT 'The number of cores per socket',
30 | `cpulimit` smallint(5) unsigned DEFAULT NULL COMMENT 'Limit of CPU usage. Note if the computer has 2 CPUs, it has total of ''2'' CPU time. Value ''0'' indicates no CPU limit.',
31 | `cpuunits` smallint(5) unsigned DEFAULT NULL,
32 | `memory` smallint(5) unsigned NOT NULL,
33 | `swap` smallint(5) unsigned DEFAULT NULL,
34 | `disk` smallint(5) unsigned DEFAULT NULL,
35 | `iopriority` varchar(10) DEFAULT '4',
36 | `diskformat` varchar(10) DEFAULT NULL,
37 | `diskcache` varchar(20) DEFAULT NULL,
38 | `disktype` varchar(20) DEFAULT NULL,
39 | `netmode` varchar(10) DEFAULT NULL,
40 | `bridge` varchar(20) NOT NULL DEFAULT 'vmbr',
41 | `vmbr` tinyint(1) unsigned NOT NULL DEFAULT '0',
42 | `netmodel` varchar(10) DEFAULT NULL,
43 | `netrate` varchar(5) DEFAULT NULL,
44 | `firewall` tinyint(1) unsigned NOT NULL DEFAULT '0',
45 | `bw` int(6) unsigned DEFAULT NULL,
46 | `kvm` tinyint(1) unsigned DEFAULT '0',
47 | `onboot` tinyint(1) unsigned DEFAULT '0',
48 | PRIMARY KEY (`id`)
49 | );
50 | CREATE TABLE IF NOT EXISTS `mod_prve_vms` (
51 | `id` int(10) unsigned NOT NULL,
52 | `user_id` int(10) unsigned NOT NULL,
53 | `vtype` varchar(255) NOT NULL,
54 | `ipaddress` varchar(255) NOT NULL,
55 | `subnetmask` varchar(255) NOT NULL,
56 | `gateway` varchar(255) NOT NULL,
57 | `created` datetime DEFAULT NULL,
58 | PRIMARY KEY (`id`)
59 | );
--------------------------------------------------------------------------------
/modules/addons/prve/hooks.php:
--------------------------------------------------------------------------------
1 | constructor_success = false;
18 | return false ;
19 | }
20 | // Check hostname resolves.
21 | if (gethostbyname($hostname) == $hostname && !filter_var($hostname, FILTER_VALIDATE_IP)) {
22 | $this->constructor_success = false;
23 | return false ;
24 | }
25 | // Check port is between 1 and 65535.
26 | if (!is_int($port) || $port < 1 || $port > 65535) {
27 | $this->constructor_success = false;
28 | return false ;
29 | }
30 | // Check that verify_ssl is boolean.
31 | if (!is_bool($verify_ssl)) {
32 | $this->constructor_success = false;
33 | return false ;
34 | }
35 |
36 | $this->hostname = $hostname;
37 | $this->username = $username;
38 | $this->realm = $realm;
39 | $this->password = $password;
40 | $this->port = $port;
41 | $this->verify_ssl = $verify_ssl;
42 | }
43 |
44 | /*
45 | * bool login ()
46 | * Performs login to PVE Server using JSON API, and obtains Access Ticket.
47 | */
48 | public function login () {
49 | // Prepare login variables.
50 | $login_postfields = array();
51 | $login_postfields['username'] = $this->username;
52 | $login_postfields['password'] = $this->password;
53 | $login_postfields['realm'] = $this->realm;
54 |
55 | $login_postfields_string = http_build_query($login_postfields);
56 | unset($login_postfields);
57 |
58 | // Perform login request.
59 | $prox_ch = curl_init();
60 | curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json/access/ticket");
61 | curl_setopt($prox_ch, CURLOPT_POST, true);
62 | curl_setopt($prox_ch, CURLOPT_RETURNTRANSFER, true);
63 | curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $login_postfields_string);
64 | curl_setopt($prox_ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl);
65 |
66 | $login_ticket = curl_exec($prox_ch);
67 | $login_request_info = curl_getinfo($prox_ch);
68 |
69 | curl_close($prox_ch);
70 | unset($prox_ch);
71 | unset($login_postfields_string);
72 |
73 | if (!$login_ticket) {
74 | // SSL negotiation failed or connection timed out
75 | $this->login_ticket_timestamp = null;
76 | return false;
77 | }
78 |
79 | $login_ticket_data = json_decode($login_ticket, true);
80 | if ($login_ticket_data == null || $login_ticket_data['data'] == null) {
81 | // Login failed.
82 | // Just to be safe, set this to null again.
83 | $this->login_ticket_timestamp = null;
84 | if ($login_request_info['ssl_verify_result'] == 1) {
85 | $this->constructor_success = false;
86 | return false ;
87 | }
88 | return false;
89 | } else {
90 | // Login success.
91 | $this->login_ticket = $login_ticket_data['data'];
92 | // We store a UNIX timestamp of when the ticket was generated here,
93 | // so we can identify when we need a new one expiration-wise later
94 | // on...
95 | $this->login_ticket_timestamp = time();
96 | $this->reload_node_list();
97 | return true;
98 | }
99 | }
100 |
101 | # Sets the PVEAuthCookie
102 | # Attetion, after using this the user is logged into the web interface aswell!
103 | # Use with care, and DO NOT use with root, it may harm your system
104 | public function setCookie() {
105 | if (!$this->check_login_ticket()) {
106 | $this->constructor_success = false;
107 | return false ;
108 | }
109 |
110 | setrawcookie("PVEAuthCookie", $this->login_ticket['ticket'], 0, "/");
111 | }
112 |
113 | /*
114 | * bool check_login_ticket ()
115 | * Checks if the login ticket is valid still, returns false if not.
116 | * Method of checking is purely by age of ticket right now...
117 | */
118 | protected function check_login_ticket () {
119 | if ($this->login_ticket == null) {
120 | // Just to be safe, set this to null again.
121 | $this->login_ticket_timestamp = null;
122 | return false;
123 | }
124 | if ($this->login_ticket_timestamp >= (time() + 7200)) {
125 | // Reset login ticket object values.
126 | $this->login_ticket = null;
127 | $this->login_ticket_timestamp = null;
128 | return false;
129 | } else {
130 | return true;
131 | }
132 | }
133 |
134 | /*
135 | * object action (string action_path, string http_method[, array put_post_parameters])
136 | * This method is responsible for the general cURL requests to the JSON API,
137 | * and sits behind the abstraction layer methods get/put/post/delete etc.
138 | */
139 | private function action ($action_path, $http_method, $put_post_parameters = null) {
140 | // Check if we have a prefixed / on the path, if not add one.
141 | if (substr($action_path, 0, 1) != "/") {
142 | $action_path = "/".$action_path;
143 | }
144 |
145 | if (!$this->check_login_ticket()) {
146 | $this->constructor_success = false;
147 | return false ;
148 | }
149 |
150 | // Prepare cURL resource.
151 | $prox_ch = curl_init();
152 | curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json{$action_path}");
153 |
154 | $put_post_http_headers = array();
155 | $put_post_http_headers[] = "CSRFPreventionToken: {$this->login_ticket['CSRFPreventionToken']}";
156 | // Lets decide what type of action we are taking...
157 | switch ($http_method) {
158 | case "GET":
159 | // Nothing extra to do.
160 | curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json{$action_path}?".http_build_query($put_post_parameters));
161 | break;
162 | case "PUT":
163 | curl_setopt($prox_ch, CURLOPT_CUSTOMREQUEST, "PUT");
164 |
165 | // Set "POST" data.
166 | $action_postfields_string = http_build_query($put_post_parameters);
167 | curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $action_postfields_string);
168 | unset($action_postfields_string);
169 |
170 | // Add required HTTP headers.
171 | curl_setopt($prox_ch, CURLOPT_HTTPHEADER, $put_post_http_headers);
172 | break;
173 | case "POST":
174 | curl_setopt($prox_ch, CURLOPT_POST, true);
175 |
176 | // Set POST data.
177 | $action_postfields_string = http_build_query($put_post_parameters);
178 | curl_setopt($prox_ch, CURLOPT_POSTFIELDS, $action_postfields_string);
179 | unset($action_postfields_string);
180 |
181 | // Add required HTTP headers.
182 | curl_setopt($prox_ch, CURLOPT_HTTPHEADER, $put_post_http_headers);
183 | break;
184 | case "DELETE":
185 | curl_setopt($prox_ch, CURLOPT_CUSTOMREQUEST, "DELETE");
186 | // No "POST" data required, the delete destination is specified in the URL.
187 |
188 | // Add required HTTP headers.
189 | curl_setopt($prox_ch, CURLOPT_HTTPHEADER, $put_post_http_headers);
190 | break;
191 | default:
192 | //throw new PVE2_Exception("Error - Invalid HTTP Method specified.", 5);
193 | return false;
194 | }
195 |
196 | curl_setopt($prox_ch, CURLOPT_HEADER, true);
197 | curl_setopt($prox_ch, CURLOPT_RETURNTRANSFER, true);
198 | curl_setopt($prox_ch, CURLOPT_COOKIE, "PVEAuthCookie=".$this->login_ticket['ticket']);
199 | curl_setopt($prox_ch, CURLOPT_SSL_VERIFYPEER, false);
200 |
201 | $action_response = curl_exec($prox_ch);
202 |
203 | curl_close($prox_ch);
204 | unset($prox_ch);
205 |
206 | $split_action_response = explode("\r\n\r\n", $action_response, 2);
207 | $header_response = $split_action_response[0];
208 | $body_response = $split_action_response[1];
209 | $action_response_array = json_decode($body_response, true);
210 |
211 | $action_response_export = var_export($action_response_array, true);
212 | error_log("----------------------------------------------\n" .
213 | "FULL RESPONSE:\n\n{$action_response}\n\nEND FULL RESPONSE\n\n" .
214 | "Headers:\n\n{$header_response}\n\nEnd Headers\n\n" .
215 | "Data:\n\n{$body_response}\n\nEnd Data\n\n" .
216 | "RESPONSE ARRAY:\n\n{$action_response_export}\n\nEND RESPONSE ARRAY\n" .
217 | "----------------------------------------------");
218 |
219 | unset($action_response);
220 | unset($action_response_export);
221 |
222 | // Parse response, confirm HTTP response code etc.
223 | $split_headers = explode("\r\n", $header_response);
224 | if (substr($split_headers[0], 0, 9) == "HTTP/1.1 ") {
225 | $split_http_response_line = explode(" ", $split_headers[0]);
226 | if ($split_http_response_line[1] == "200") {
227 | if ($http_method == "PUT") {
228 | return true;
229 | } else {
230 | return $action_response_array['data'];
231 | }
232 | } else {
233 | error_log("This API Request Failed.\n" .
234 | "HTTP Response - {$split_http_response_line[1]}\n" .
235 | "HTTP Error - {$split_headers[0]}");
236 | return false;
237 | }
238 | } else {
239 | error_log("Error - Invalid HTTP Response.\n" . var_export($split_headers, true));
240 | return false;
241 | }
242 |
243 | if (!empty($action_response_array['data'])) {
244 | return $action_response_array['data'];
245 | } else {
246 | error_log("\$action_response_array['data'] is empty. Returning false.\n" .
247 | var_export($action_response_array['data'], true));
248 | return false;
249 | }
250 | }
251 |
252 | /*
253 | * array reload_node_list ()
254 | * Returns the list of node names as provided by /api2/json/nodes.
255 | * We need this for future get/post/put/delete calls.
256 | * ie. $this->get("nodes/XXX/status"); where XXX is one of the values from this return array.
257 | */
258 | public function reload_node_list () {
259 | $node_list = $this->get("/nodes");
260 | if (count($node_list) > 0) {
261 | $nodes_array = array();
262 | foreach ($node_list as $node) {
263 | $nodes_array[] = $node['node'];
264 | }
265 | $this->cluster_node_list = $nodes_array;
266 | return true;
267 | } else {
268 | error_log(" Empty list of nodes returned in this cluster.");
269 | return false;
270 | }
271 | }
272 |
273 | /*
274 | * array get_node_list ()
275 | *
276 | */
277 | public function get_node_list () {
278 | // We run this if we haven't queried for cluster nodes as yet, and cache it in the object.
279 | if ($this->cluster_node_list == null) {
280 | if ($this->reload_node_list() === false) {
281 | return false;
282 | }
283 | }
284 |
285 | return $this->cluster_node_list;
286 | }
287 |
288 | /*
289 | * bool|int get_next_vmid ()
290 | * Get Last VMID from a Cluster or a Node
291 | * returns a VMID, or false if not found.
292 | */
293 | public function get_next_vmid () {
294 | $vmid = $this->get("/cluster/nextid");
295 | if ($vmid == null) {
296 | return false;
297 | } else {
298 | return $vmid;
299 | }
300 | }
301 |
302 | /*
303 | * bool|string get_version ()
304 | * Return the version and minor revision of Proxmox Server
305 | */
306 | public function get_version () {
307 | $version = $this->get("/version");
308 | if ($version == null) {
309 | return false;
310 | } else {
311 | return $version['version'];
312 | }
313 | }
314 |
315 | /*
316 | * object/array? get (string action_path)
317 | */
318 | public function get ($action_path,$parameters='null') {
319 | return $this->action($action_path, "GET",$parameters);
320 | }
321 |
322 | /*
323 | * bool put (string action_path, array parameters)
324 | */
325 | public function put ($action_path, $parameters) {
326 | return $this->action($action_path, "PUT", $parameters);
327 | }
328 |
329 | /*
330 | * bool post (string action_path, array parameters)
331 | */
332 | public function post ($action_path, $parameters) {
333 | return $this->action($action_path, "POST", $parameters);
334 | }
335 |
336 | /*
337 | * bool delete (string action_path)
338 | */
339 | public function delete ($action_path) {
340 | return $this->action($action_path, "DELETE");
341 | }
342 |
343 | // Logout not required, PVEAuthCookie tokens have a 2 hour lifetime.
344 | }
345 |
346 |
347 | function prve_check_license($licensekey, $localkey='') {
348 |
349 | // -----------------------------------
350 | // -- Configuration Values --
351 | // -----------------------------------
352 |
353 | // Enter the url to your WHMCS installation here
354 | $whmcsurl = 'http://www.moduleland.com/';
355 | // Must match what is specified in the MD5 Hash Verification field
356 | // of the licensing product that will be used with this check.
357 | $licensing_secret_key = 'q8e1BNyxo7HEo7wGDoyX3Bp5wno2s4HC';
358 | // The number of days to wait between performing remote license checks
359 | $localkeydays = 15;
360 | // The number of days to allow failover for after local key expiry
361 | $allowcheckfaildays = 5;
362 |
363 | // -----------------------------------
364 | // -- Do not edit below this line --
365 | // -----------------------------------
366 |
367 | $check_token = time() . md5(mt_rand(1000000000, 9999999999) . $licensekey);
368 | $checkdate = date("Ymd");
369 | $domain = $_SERVER['SERVER_NAME'];
370 | $usersip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
371 | $dirpath = dirname(__FILE__);
372 | $verifyfilepath = 'modules/servers/licensing/verify.php';
373 | $localkeyvalid = false;
374 | if ($localkey) {
375 | $localkey = str_replace("\n", '', $localkey); # Remove the line breaks
376 | $localdata = substr($localkey, 0, strlen($localkey) - 32); # Extract License Data
377 | $md5hash = substr($localkey, strlen($localkey) - 32); # Extract MD5 Hash
378 | if ($md5hash == md5($localdata . $licensing_secret_key)) {
379 | $localdata = strrev($localdata); # Reverse the string
380 | $md5hash = substr($localdata, 0, 32); # Extract MD5 Hash
381 | $localdata = substr($localdata, 32); # Extract License Data
382 | $localdata = base64_decode($localdata);
383 | $localkeyresults = unserialize($localdata);
384 | $originalcheckdate = $localkeyresults['checkdate'];
385 | if ($md5hash == md5($originalcheckdate . $licensing_secret_key)) {
386 | $localexpiry = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - $localkeydays, date("Y")));
387 | if ($originalcheckdate > $localexpiry) {
388 | $localkeyvalid = true;
389 | $results = $localkeyresults;
390 | $validdomains = explode(',', $results['validdomain']);
391 | if (!in_array($_SERVER['SERVER_NAME'], $validdomains)) {
392 | $localkeyvalid = false;
393 | $localkeyresults['status'] = "Invalid";
394 | $results = array();
395 | }
396 | $validips = explode(',', $results['validip']);
397 | if (!in_array($usersip, $validips)) {
398 | $localkeyvalid = false;
399 | $localkeyresults['status'] = "Invalid";
400 | $results = array();
401 | }
402 | $validdirs = explode(',', $results['validdirectory']);
403 | if (!in_array($dirpath, $validdirs)) {
404 | $localkeyvalid = false;
405 | $localkeyresults['status'] = "Invalid";
406 | $results = array();
407 | }
408 | }
409 | }
410 | }
411 | }
412 | if (!$localkeyvalid) {
413 | $responseCode = 0;
414 | $postfields = array(
415 | 'licensekey' => $licensekey,
416 | 'domain' => $domain,
417 | 'ip' => $usersip,
418 | 'dir' => $dirpath,
419 | );
420 | if ($check_token) $postfields['check_token'] = $check_token;
421 | $query_string = '';
422 | foreach ($postfields AS $k=>$v) {
423 | $query_string .= $k.'='.urlencode($v).'&';
424 | }
425 | if (function_exists('curl_exec')) {
426 | $ch = curl_init();
427 | curl_setopt($ch, CURLOPT_URL, $whmcsurl . $verifyfilepath);
428 | curl_setopt($ch, CURLOPT_POST, 1);
429 | curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
430 | curl_setopt($ch, CURLOPT_TIMEOUT, 30);
431 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
432 | $data = curl_exec($ch);
433 | $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
434 | curl_close($ch);
435 | } else {
436 | $responseCodePattern = '/^HTTP\/\d+\.\d+\s+(\d+)/';
437 | $fp = @fsockopen($whmcsurl, 80, $errno, $errstr, 5);
438 | if ($fp) {
439 | $newlinefeed = "\r\n";
440 | $header = "POST ".$whmcsurl . $verifyfilepath . " HTTP/1.0" . $newlinefeed;
441 | $header .= "Host: ".$whmcsurl . $newlinefeed;
442 | $header .= "Content-type: application/x-www-form-urlencoded" . $newlinefeed;
443 | $header .= "Content-length: ".@strlen($query_string) . $newlinefeed;
444 | $header .= "Connection: close" . $newlinefeed . $newlinefeed;
445 | $header .= $query_string;
446 | $data = $line = '';
447 | @stream_set_timeout($fp, 20);
448 | @fputs($fp, $header);
449 | $status = @socket_get_status($fp);
450 | while (!@feof($fp)&&$status) {
451 | $line = @fgets($fp, 1024);
452 | $patternMatches = array();
453 | if (!$responseCode
454 | && preg_match($responseCodePattern, trim($line), $patternMatches)
455 | ) {
456 | $responseCode = (empty($patternMatches[1])) ? 0 : $patternMatches[1];
457 | }
458 | $data .= $line;
459 | $status = @socket_get_status($fp);
460 | }
461 | @fclose ($fp);
462 | }
463 | }
464 | if ($responseCode != 200) {
465 | $localexpiry = date("Ymd", mktime(0, 0, 0, date("m"), date("d") - ($localkeydays + $allowcheckfaildays), date("Y")));
466 | if ($originalcheckdate > $localexpiry) {
467 | $results = $localkeyresults;
468 | } else {
469 | $results = array();
470 | $results['status'] = "Invalid";
471 | $results['description'] = "Remote Check Failed";
472 | return $results;
473 | }
474 | } else {
475 | preg_match_all('/<(.*?)>([^<]+)<\/\\1>/i', $data, $matches);
476 | $results = array();
477 | foreach ($matches[1] AS $k=>$v) {
478 | $results[$v] = $matches[2][$k];
479 | }
480 | }
481 | if (!is_array($results)) {
482 | die("Invalid License Server Response");
483 | }
484 | if ($results['md5hash']) {
485 | if ($results['md5hash'] != md5($licensing_secret_key . $check_token)) {
486 | $results['status'] = "Invalid";
487 | $results['description'] = "MD5 Checksum Verification Failed";
488 | return $results;
489 | }
490 | }
491 | if ($results['status'] == "Active") {
492 | $results['checkdate'] = $checkdate;
493 | $data_encoded = serialize($results);
494 | $data_encoded = base64_encode($data_encoded);
495 | $data_encoded = md5($checkdate . $licensing_secret_key) . $data_encoded;
496 | $data_encoded = strrev($data_encoded);
497 | $data_encoded = $data_encoded . md5($data_encoded . $licensing_secret_key);
498 | $data_encoded = wordwrap($data_encoded, 80, "\n", true);
499 | $results['localkey'] = $data_encoded;
500 | }
501 | $results['remotecheck'] = true;
502 | }
503 | unset($postfields,$data,$matches,$whmcsurl,$licensing_secret_key,$checkdate,$usersip,$localkeydays,$allowcheckfaildays,$md5hash);
504 | return $results;
505 | }
506 |
507 |
508 | ?>
509 |
--------------------------------------------------------------------------------
/modules/servers/prve/VncViewer.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/VncViewer.jar
--------------------------------------------------------------------------------
/modules/servers/prve/clientarea.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |

10 |
11 |
12 |
13 |
14 |

15 |
16 |
17 |
18 |
19 |

20 | {$vm_status['status']}
21 | Up Time: {$vm_status['uptime']}
22 |
23 |
24 |
25 |
26 |
27 |
30 |
33 |
36 |
39 |
40 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | Assigned IPv4 Address | {$vm_config['ipv4']} Subnet Mask: {$vm_config['netmask4']} Gateway: {$vm_config['gateway4']} |
61 |
62 |
63 | OS type |
64 | {$vm_config['ostype']} |
65 |
66 |
67 | CPU |
68 | {$vm_config['sockets']} {$vm_config['cpu']} {$vm_config['cores']} core(s). |
69 |
70 |
71 | Memory (RAM) |
72 | {$vm_config['memory']} MB |
73 |
74 |
75 | Primary Network Interface |
76 | {($vm_config['net0']|replace:',':' ')} |
77 |
78 |
79 | Secondary Network Interface |
80 | {$vm_config['net1']} |
81 |
82 |
83 | Hard Disk |
84 |
85 | {$rootfs=(","|explode:$vm_config['rootfs'])}
86 | {$disk=(","|explode:$vm_config['ide0'])}
87 | {$disk[1]}
88 | {$rootfs[1]}
89 |
90 | {$vm_config['scsci0']} |
91 |
92 |
93 | {if ($smarty.get.a eq 'vmStat')}
94 |
Virtual Machine Statistics
95 |
101 |
102 |
103 |

104 |

105 |

106 |

107 |
108 |
109 |

110 |

111 |

112 |

113 |
114 |
115 |

116 |

117 |

118 |

119 |
120 |
121 |

122 |

123 |

124 |

125 |
126 |
127 | {/if}
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/modules/servers/prve/img/lxc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/lxc.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/novnc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/novnc.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/online.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/online.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/centos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/centos.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/debian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/debian.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/ubuntu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/ubuntu.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/w2k.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/w2k.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/w2k3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/w2k3.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/w2k8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/w2k8.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/win7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/win7.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/wvista.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/wvista.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/os/wxp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/os/wxp.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/qemu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/qemu.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/running.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/running.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/stopped.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/stopped.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/suspended.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/suspended.png
--------------------------------------------------------------------------------
/modules/servers/prve/img/tigervnc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cybercoder/PRVE/83b41e507ca5815560cfa861095cc07838c44a40/modules/servers/prve/img/tigervnc.png
--------------------------------------------------------------------------------
/modules/servers/prve/js/CircularLoader.js:
--------------------------------------------------------------------------------
1 | !function (r) { function e(r) { return r * Math.PI / 180 } function t(t, a, s) { var o = r("#" + s + "canvas")[0], n = r("#" + s + "canvas"), i = o.getContext("2d"), l = o.width / 2, p = o.height / 2; i.beginPath(), i.arc(l, p, r(n).attr("data-radius"), -e(90), -e(90) + e(t / 100 * 360), !1), i.fillStyle = "transparent", i.fill(), i.lineWidth = r(n).attr("data-width"), i.strokeStyle = r(n).attr("data-stroke"), i.stroke(), i.closePath(), "true" == r(n).attr("data-text").toLocaleLowerCase() && r("#" + s + " .clProg").val(a + ("true" == r(n).attr("data-percent").toLocaleLowerCase() ? "%" : "")) } r.fn.circularloader = function (e) { function a() { u.beginPath(), u.arc(f, h, i, 0, 2 * Math.PI, !1), u.fillStyle = n.backgroundColor, u.fill(), u.lineWidth = l, u.strokeStyle = n.progressBarBackground, u.stroke(), u.closePath(), d > 0 && t(d, p, o) } var s = this[0], o = s.id; if (0 == r("#" + o + " canvas").length) { var n = r.extend({ backgroundColor: "#ffffff", fontColor: "#000000", fontSize: "40px", radius: 70, progressBarBackground: "#cdcdcd", progressBarColor: "#aaaaaa", progressBarWidth: 25, progressPercent: 0, progressValue: 0, showText: !0 }, e), i = parseInt(n.radius), l = parseInt(n.progressBarWidth), p = parseInt(parseInt(n.progressValue) > 0 ? n.progressValue : n.progressPercent), d = parseInt(n.progressPercent), c = "color:" + n.fontColor + ";font-size:" + parseInt(n.fontSize) + "px;width:" + 2 * (i + l) + "px;vertical-align:middle;position:relative;background-color:transparent;border:0 none;transform:translateY(-48%);-webkit-transform: translateY(-48%);-ms-transform: translateY(-48%);height:" + 2 * (i + l) + "px;margin-left:-" + 2 * (i + l) + "px;text-align:center;padding:0;" + (n.showText ? "" : "display:none;"); r('