Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ Server/.idea/workspace.xml
Discord-Bot/.idea/workspace.xml

Client/.idea/workspace.xml
LeagueUI/
2 changes: 2 additions & 0 deletions Client/Install installer Dependency.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ npm install electron --save-dev

npm install electron-builder --save-dev

npm install electron-packager --save-dev

npm install electron-squirrel-startup --save-dev

PAUSE
7 changes: 5 additions & 2 deletions Client/Javascript/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Login(appLogic) {
CreateElement({type: 'div', text: 'Nickname', class: 'Login_Label'}),
this.nicknameInput = CreateElement({type: 'input', class: 'Login_NameInput input-text'}),
CreateElement({type: 'div', text: 'Host', class: 'Login_Label'}),
this.hostInput = CreateElement({type: 'input', class: 'Login_HostInput input-text', text: '104.168.222.21'}),
this.hostInput = CreateElement({type: 'input', class: 'Login_HostInput input-text', text: '24.27.15.238'}),
CreateElement({type: 'div', text: 'Port', class: 'Login_Label'}),
this.portInput = CreateElement({type: 'input', class: 'Login_PortInput input-text', text: '7777'}),
this.loginButton = CreateElement({type: 'button', text: 'Login', class: 'Login_Button waves-effect waves-light btn-large'
Expand All @@ -19,7 +19,7 @@ function Login(appLogic) {
var isWindows = process.platform === 'win32';
var isMac = process.platform === 'darwin';
if (isWindows) {
this.leaguePathInput.placeholder = 'C:\/League-of-Legends-4-20\/';
this.leaguePathInput.placeholder = 'C:\/LeagueSandbox\/League_Sandbox_Client';
}
if (isMac) {
this.leaguePathInput.placeholder = '\/League of Legends.app';
Expand All @@ -37,6 +37,9 @@ function Login(appLogic) {
if (localStorage.getItem("name") != undefined && localStorage.getItem("name") != "") {
this.nicknameInput.value = localStorage.getItem("name");
}
if (this.leaguePathInput.value === '') {
this.leaguePathInput.value = 'C:\/LeagueSandbox\/League_Sandbox_Client';
}
}
Login.prototype.loginButtonClicked = function() {

Expand Down
2 changes: 1 addition & 1 deletion Client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dependencies": {},
"devDependencies": {
"devtron": "^1.1.0",
"electron": "^1.4.13",
"electron": "^1.4.15",
"electron-builder": "^10.12.0",
"electron-squirrel-startup": "^1.0.0",
"xo": "^0.16.0"
Expand Down
Binary file modified Game-Server-Repositories/MSBuild.exe
Binary file not shown.
89 changes: 59 additions & 30 deletions Server/ServerLogic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var NetworkManager = require('./NetworkManager');
var LobbyManager = require('./LobbyManager');
var rmdir = require('rimraf');
var Utility = require('./Utility/Utility');
var CreateFunction = Utility.CreateFunction;

Expand Down Expand Up @@ -83,7 +84,7 @@ ServerLogic.prototype.updateGameServer = function (repository, branch, gameJSON,
const exec = require('child_process').spawn;

this.totalLaunchedGameServers++;
89-0

//Create tempororary folder name
var d = new Date();
var fileName = d.getFullYear() + '' + d.getMonth() + '' + d.getDate() + '' + d.getHours() + '' +
Expand Down Expand Up @@ -119,40 +120,68 @@ ServerLogic.prototype.startGameServer = function (repository, branch, gameJSON,
console.log("Opening game: " + '../Game-Server-Repositories/' + serverName + '/GameServerApp.exe');
messageCallback("Opening game: " + '../Game-Server-Repositories/' + serverName + '/GameServerApp.exe');

const game = exec('GameServerApp.exe', ['--port', port, '--config-json', JSON.stringify(gameJSON)],
{cwd: '../Game-Server-Repositories/' + serverName});
try {
const game = exec('GameServerApp.exe', ['--port', port, '--config-json', JSON.stringify(gameJSON)],
{cwd: '../Game-Server-Repositories/' + serverName});

var waitingForBoot = true;
game.stdout.on('data', (data) => {
messageCallback(`stdout: ${data}`);
var waitingForBoot = true;
game.stdout.on('data', (data) => {
messageCallback(`stdout: ${data}`);

console.log(`stdout: ${data}`);
if (waitingForBoot) {
if (data.indexOf("Game is ready.") !== -1) {
console.log("Game is ready, doing callback");
waitingForBoot = false;
callback();
console.log(`stdout: ${data}`);
if (waitingForBoot) {
if (data.indexOf("Game is ready.") !== -1) {
console.log("Game is ready, doing callback");
waitingForBoot = false;
callback();
}
}
}

});

game.stderr.on('data', (data) => {
messageCallback(`stdout: ${data}`);
console.log(`stdout: ${data}`);
});

game.on('close', (code) => {
messageCallback(`child process exited with code ${code}`);
console.log(`child process exited with code ${code}`);
});

game.stderr.on('data', (data) => {
messageCallback(`stdout: ${data}`);
console.log(`stdout: ${data}`);
});

game.on('close', (code) => {
messageCallback(`child process exited with code ${code}`);
console.log(`child process exited with code ${code}`);

try {
rmdir('../Game-Server-Repositories/'+serverName, function(error){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be directory traversal exploitable if serverName contains user input from anywhere. For example, if I call my server ../../../../ it could end up deleting a lot more than what you'd expect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var fileName = d.getFullYear() + '' + d.getMonth() + '' + d.getDate() + '' + d.getHours() + '' +

Server name is generated server side.

if (error == null) {
console.log('Successfully deleted ' + '../Game-Server-Repositories/'+serverName);
} else {
console.log('Error deleting '+'../Game-Server-Repositories/'+serverName + ', ' + error);
}
});
} catch (e) {
console.log('Could not delete folder: ' + serverName + ', ' + e);
}
});

//var rmdir = require('rimraf');
//rmdir('../Game-Server-Repositories/'+serverName, function(error){
// console.log('Error deleting '+'../Game-Server-Repositories/'+serverName);
//});
//Delete old server
//rmdir example /s
});
setTimeout(() => {
try {
game.kill();
} catch (e) {
console.log('Could not kill process: ' + e);
}
}, 1000 * 60 * 60 * 2);
} catch (e) {
messageCallback(`Could not start server: ` + e);
try {
rmdir('../Game-Server-Repositories/'+serverName, function(error){
if (error == null) {
console.log('Successfully deleted ' + '../Game-Server-Repositories/'+serverName);
} else {
console.log('Error deleting '+'../Game-Server-Repositories/'+serverName + ', ' + error);
}
});
} catch (e) {
console.log('Could not delete folder: ' + serverName + ', ' + e);
}
}
}));
};

Expand Down
1 change: 1 addition & 0 deletions Server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "ServerLogic.js",
"dependencies": {
"get-port": "^2.1.0",
"rimraf": "^2.6.2",
"ws": "^1.1.1"
},
"devDependencies": {
Expand Down
15 changes: 15 additions & 0 deletions Webpage/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html>
<a href="LeagueUI-win32-x64.zip">Download Testbox for Windows</a>
</br>
League Path will probably look like: C:\league-of-legends-420\League-of-Legends-4-20\RADS\solutions\lol_game_client_sln\releases\0.0.1.68\deploy
</br>
Host: 24.27.15.238 (leaguesandbox.matthewfrench.io doesn't resolve properly on the League Client)
</br>
Port: 7777
</br>
Download the League 420 client from the League Sandbox wiki.
</p>
This project is for development and testing the different League Sandbox branches with friends.
</br>
Designed and created by Gan. If it's janky, it's cause I made it quickly.
</html>