mirror of
				https://github.com/optim-enterprises-bv/control-pane.git
				synced 2025-10-31 01:47:52 +00:00 
			
		
		
		
	wip
This commit is contained in:
		| @@ -42,7 +42,8 @@ class Forms | |||||||
|  |  | ||||||
| 	private function fetch_from_db($link) | 	private function fetch_from_db($link) | ||||||
| 	{ | 	{ | ||||||
| 		return $this->db->select("select * from ? order by order_id asc", array([$link])); | //		return $this->db->select("select * from ? order by order_id asc", array([$link])); | ||||||
|  | 		return $this->db->select("select * from {$link} order by order_id asc", array()); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	function generate(){ | 	function generate(){ | ||||||
| @@ -184,6 +185,9 @@ class Forms | |||||||
| 				$tpl.='<option>'.$opt['text'].'</option>'; | 				$tpl.='<option>'.$opt['text'].'</option>'; | ||||||
| 			} | 			} | ||||||
| 			$tpl.='</datalist>'; | 			$tpl.='</datalist>'; | ||||||
|  |  | ||||||
|  | 			Utils::clonos_syslog("forms.php template: " . $tpl); | ||||||
|  |  | ||||||
| 			return array('list'=>$id,'datalist'=>$tpl); | 			return array('list'=>$id,'datalist'=>$tpl); | ||||||
| 		}else { | 		}else { | ||||||
| 			return false; | 			return false; | ||||||
|   | |||||||
| @@ -2,7 +2,6 @@ | |||||||
|  |  | ||||||
| class Utils | class Utils | ||||||
| { | { | ||||||
|  |  | ||||||
| 	public static function clonos_syslog($msg) | 	public static function clonos_syslog($msg) | ||||||
| 	{ | 	{ | ||||||
| 		file_put_contents('/tmp/clonos.log', date("j.n.Y").":".$msg . "\n", FILE_APPEND); | 		file_put_contents('/tmp/clonos.log', date("j.n.Y").":".$msg . "\n", FILE_APPEND); | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								public/novnc/node_modules/.package-lock.json
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								public/novnc/node_modules/.package-lock.json
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "name": "@novnc/novnc", |   "name": "@novnc/novnc", | ||||||
|   "version": "1.3.0", |   "version": "1.3.0", | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 3, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "node_modules/@ampproject/remapping": { |     "node_modules/@ampproject/remapping": { | ||||||
| @@ -3314,9 +3314,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/engine.io": { |     "node_modules/engine.io": { | ||||||
|       "version": "6.2.0", |       "version": "6.2.1", | ||||||
|       "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz", |       "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.1.tgz", | ||||||
|       "integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==", |       "integrity": "sha512-ECceEFcAaNRybd3lsGQKas3ZlMVjN3cyWwMP25D2i0zWfyiytVbTpRPa34qrr+FHddtpBVOmq4H/DCv1O0lZRA==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@types/cookie": "^0.4.1", |         "@types/cookie": "^0.4.1", | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								public/novnc/node_modules/engine.io/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								public/novnc/node_modules/engine.io/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -87,7 +87,6 @@ For more information on the client refer to the | |||||||
| - **Future proof** | - **Future proof** | ||||||
| - **100% Node.JS core style** | - **100% Node.JS core style** | ||||||
|   - No API sugar (left for higher level projects) |   - No API sugar (left for higher level projects) | ||||||
|   - Written in readable vanilla JavaScript |  | ||||||
|  |  | ||||||
| ## API | ## API | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								public/novnc/node_modules/engine.io/build/parser-v3/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								public/novnc/node_modules/engine.io/build/parser-v3/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -119,7 +119,7 @@ function decodePacket(data, binaryType, utf8decode) { | |||||||
|     if (typeof data === 'string') { |     if (typeof data === 'string') { | ||||||
|         type = data.charAt(0); |         type = data.charAt(0); | ||||||
|         if (type === 'b') { |         if (type === 'b') { | ||||||
|             return decodeBase64Packet(data.substr(1), binaryType); |             return decodeBase64Packet(data.slice(1), binaryType); | ||||||
|         } |         } | ||||||
|         if (utf8decode) { |         if (utf8decode) { | ||||||
|             data = tryDecode(data); |             data = tryDecode(data); | ||||||
| @@ -131,7 +131,7 @@ function decodePacket(data, binaryType, utf8decode) { | |||||||
|             return err; |             return err; | ||||||
|         } |         } | ||||||
|         if (data.length > 1) { |         if (data.length > 1) { | ||||||
|             return { type: packetslist[type], data: data.substring(1) }; |             return { type: packetslist[type], data: data.slice(1) }; | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             return { type: packetslist[type] }; |             return { type: packetslist[type] }; | ||||||
| @@ -169,7 +169,7 @@ function tryDecode(data) { | |||||||
|  */ |  */ | ||||||
| function decodeBase64Packet(msg, binaryType) { | function decodeBase64Packet(msg, binaryType) { | ||||||
|     var type = packetslist[msg.charAt(0)]; |     var type = packetslist[msg.charAt(0)]; | ||||||
|     var data = Buffer.from(msg.substr(1), 'base64'); |     var data = Buffer.from(msg.slice(1), 'base64'); | ||||||
|     if (binaryType === 'arraybuffer') { |     if (binaryType === 'arraybuffer') { | ||||||
|         var abv = new Uint8Array(data.length); |         var abv = new Uint8Array(data.length); | ||||||
|         for (var i = 0; i < abv.length; i++) { |         for (var i = 0; i < abv.length; i++) { | ||||||
| @@ -268,7 +268,7 @@ function decodePayload(data, binaryType, callback) { | |||||||
|             // parser error - ignoring payload |             // parser error - ignoring payload | ||||||
|             return callback(err, 0, 1); |             return callback(err, 0, 1); | ||||||
|         } |         } | ||||||
|         msg = data.substr(i + 1, n); |         msg = data.slice(i + 1, i + 1 + n); | ||||||
|         if (length != msg.length) { |         if (length != msg.length) { | ||||||
|             // parser error - ignoring payload |             // parser error - ignoring payload | ||||||
|             return callback(err, 0, 1); |             return callback(err, 0, 1); | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								public/novnc/node_modules/engine.io/build/server.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								public/novnc/node_modules/engine.io/build/server.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -391,7 +391,7 @@ class Server extends BaseServer { | |||||||
|                 abortUpgrade(socket, errorCode, errorContext); |                 abortUpgrade(socket, errorCode, errorContext); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             const head = Buffer.from(upgradeHead); // eslint-disable-line node/no-deprecated-api |             const head = Buffer.from(upgradeHead); | ||||||
|             upgradeHead = null; |             upgradeHead = null; | ||||||
|             // delegate to ws |             // delegate to ws | ||||||
|             this.ws.handleUpgrade(req, socket, head, websocket => { |             this.ws.handleUpgrade(req, socket, head, websocket => { | ||||||
| @@ -468,7 +468,7 @@ class Server extends BaseServer { | |||||||
|         // normalize path |         // normalize path | ||||||
|         path += "/"; |         path += "/"; | ||||||
|         function check(req) { |         function check(req) { | ||||||
|             return path === req.url.substr(0, path.length); |             return path === req.url.slice(0, path.length); | ||||||
|         } |         } | ||||||
|         // cache and clean up listeners |         // cache and clean up listeners | ||||||
|         const listeners = server.listeners("request").slice(0); |         const listeners = server.listeners("request").slice(0); | ||||||
| @@ -502,6 +502,9 @@ class Server extends BaseServer { | |||||||
|                     setTimeout(function () { |                     setTimeout(function () { | ||||||
|                         // @ts-ignore |                         // @ts-ignore | ||||||
|                         if (socket.writable && socket.bytesWritten <= 0) { |                         if (socket.writable && socket.bytesWritten <= 0) { | ||||||
|  |                             socket.on("error", e => { | ||||||
|  |                                 debug("error while destroying upgrade: %s", e.message); | ||||||
|  |                             }); | ||||||
|                             return socket.end(); |                             return socket.end(); | ||||||
|                         } |                         } | ||||||
|                     }, destroyUpgradeTimeout); |                     }, destroyUpgradeTimeout); | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								public/novnc/node_modules/engine.io/package.json
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								public/novnc/node_modules/engine.io/package.json
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "engine.io", |   "name": "engine.io", | ||||||
|   "version": "6.2.0", |   "version": "6.2.1", | ||||||
|   "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", |   "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", | ||||||
|   "type": "commonjs", |   "type": "commonjs", | ||||||
|   "main": "./build/engine.io.js", |   "main": "./build/engine.io.js", | ||||||
| @@ -44,7 +44,7 @@ | |||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "babel-eslint": "^8.0.2", |     "babel-eslint": "^8.0.2", | ||||||
|     "eiows": "^3.8.0", |     "eiows": "^4.1.2", | ||||||
|     "engine.io-client": "6.2.0", |     "engine.io-client": "6.2.0", | ||||||
|     "engine.io-client-v3": "npm:engine.io-client@3.5.2", |     "engine.io-client-v3": "npm:engine.io-client@3.5.2", | ||||||
|     "expect.js": "^0.3.1", |     "expect.js": "^0.3.1", | ||||||
| @@ -53,17 +53,17 @@ | |||||||
|     "rimraf": "^3.0.2", |     "rimraf": "^3.0.2", | ||||||
|     "superagent": "^3.8.1", |     "superagent": "^3.8.1", | ||||||
|     "typescript": "^4.4.3", |     "typescript": "^4.4.3", | ||||||
|     "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.0.0" |     "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.15.0" | ||||||
|   }, |   }, | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "compile": "rimraf ./build && tsc", |     "compile": "rimraf ./build && tsc", | ||||||
|     "test": "npm run compile && npm run format:check && npm run test:default && npm run test:compat-v3 && npm run test:eiows && npm run test:uws", |     "test": "npm run compile && npm run format:check && npm run test:default && npm run test:compat-v3", | ||||||
|     "test:default": "mocha --bail --exit", |     "test:default": "mocha --bail --exit", | ||||||
|     "test:compat-v3": "EIO_CLIENT=3 mocha --exit", |     "test:compat-v3": "EIO_CLIENT=3 mocha --exit", | ||||||
|     "test:eiows": "EIO_WS_ENGINE=eiows mocha --exit", |     "test:eiows": "EIO_WS_ENGINE=eiows mocha --exit", | ||||||
|     "test:uws": "EIO_WS_ENGINE=uws mocha --exit", |     "test:uws": "EIO_WS_ENGINE=uws mocha --exit", | ||||||
|     "format:check": "prettier --check 'lib/**/*.ts' 'test/**/*.js'", |     "format:check": "prettier --check \"lib/**/*.ts\" \"test/**/*.js\"", | ||||||
|     "format:fix": "prettier --write 'lib/**/*.ts' 'test/**/*.js'", |     "format:fix": "prettier --write \"lib/**/*.ts\" \"test/**/*.js\"", | ||||||
|     "prepack": "npm run compile" |     "prepack": "npm run compile" | ||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|   | |||||||
| @@ -1,17 +1,27 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
| if(!isset($_GET['jname'])){ | if(!isset($_GET['jname'])){ | ||||||
| 	echo 'You forgot to specify a name of jail!'; | 	echo 'You forgot to specify a name of jail!'; | ||||||
| 	exit; | 	exit; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function clonos_syslog($msg) | ||||||
|  | { | ||||||
|  | 	file_put_contents('/tmp/clonos.log', date("j.n.Y").":".$msg . "\n", FILE_APPEND); | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
| function runVNC($jname) | function runVNC($jname) | ||||||
| { | { | ||||||
| 	$res = (new Db('base','local'))->selectOne("SELECT vnc_password FROM bhyve WHERE jname=?", array([$jname])); | 	$res = (new Db('base','local'))->selectOne("SELECT vnc_password FROM bhyve WHERE jname=?", array([$jname])); | ||||||
|  |  | ||||||
| 	$pass = ($res !== false) ? $res['vnc_password'] : 'cbsd'; | 	$pass = ($res !== false) ? $res['vnc_password'] : 'cbsd'; | ||||||
|  |  | ||||||
| 	CBSD::run("vm_vncwss jname=%s permit=%s", array($jname, $_SERVER['REMOTE_ADDR'])); | 	$permit=$_SERVER['REMOTE_ADDR']; | ||||||
|  |  | ||||||
|  | //	clonos_syslog("vnc.php run: vm_vncwss jname={$jname} permit={$permit}"); | ||||||
|  |  | ||||||
|  | 	$res=CBSD::run("vm_vncwss jname={$jname} permit={$permit}",array()); | ||||||
|  | //	, array($jname, $_SERVER['REMOTE_ADDR'])); | ||||||
|  |  | ||||||
| 	// HTTP_HOST is preferred for href | 	// HTTP_HOST is preferred for href | ||||||
| 	if (isset($_SERVER['HTTP_HOST']) && !empty(trim($_SERVER['HTTP_HOST']))){ | 	if (isset($_SERVER['HTTP_HOST']) && !empty(trim($_SERVER['HTTP_HOST']))){ | ||||||
| @@ -51,4 +61,5 @@ if ($jname != escapeshellcmd($jname)){ | |||||||
| 	die("Shell escape attempt"); | 	die("Shell escape attempt"); | ||||||
| } | } | ||||||
|  |  | ||||||
| runVNC(Validate::long_string($jname)); | //runVNC(Validate::long_string($jname)); | ||||||
|  | runVNC($jname); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 olevole
					olevole