Moved the Agents into their own repo. Kept the agent.pl just for reference

This commit is contained in:
Frank Harris 2025-09-11 13:27:32 -04:00
parent 22381be29a
commit 8680a02b13
18132 changed files with 0 additions and 2569420 deletions

View file

@ -1,146 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require 'includes/lib_remote.php';
function exec_ogp_module()
{
global $db;
include 'modules/util/functions.php';
include 'modules/util/util_config.php';
$servers = getUserServers($db->getIpPortsForUser($_SESSION['user_id']), $subuserAdminManagement, $supportedGames);
// If it's a post request and the user is signed in - process it.
// Otherwise, remove some sensitive info (such as encryption_key) from $servers - only keeping what the user needs to see and json_encode it for JS to process.
if($_SERVER['REQUEST_METHOD'] === 'POST'){
$serverInfo = array();
$flags = '';
$sourcemodFlags = range('a', 't');
$immunityRange = range(1, 99);
// Don't use isset here because they're always going to be set if the form is submitted - we only want to process the data if the following isn't empty.
if(!empty($_POST['gameserver_id']) && !empty($_POST['remote_server_id']) && !empty($_POST['gameserver_name'])
&& !empty($_POST['gameserver_ip']) && !empty($_POST['gameserver_port']) && !empty($_POST['addSteamid']) && !empty($_POST['sourcemod_perms'])){
foreach($servers as $server){
// Try to check if hidden form values have been manually edited. If not, process.
if($server['remote_server_id'] == $_POST['remote_server_id'] && $server['home_id'] == $_POST['gameserver_id']
&& $server['game_name'] == $_POST['gameserver_name'] && $server['ip'] == $_POST['gameserver_ip'] && $server['port'] == $_POST['gameserver_port']){
$serverInfo = $server;
}
}
if(!empty($serverInfo)){
$remote = new OGPRemoteLibrary($serverInfo['agent_ip'], $serverInfo['agent_port'], $serverInfo['encryption_key'], $serverInfo['timeout']);
if($remote->status_chk() === 1){
if(preg_match('/^STEAM_[01]:[01]:\d+$/', $_POST['addSteamid'])){
$immunity = (!empty($_POST['immunity']) && in_array($_POST['immunity'], $immunityRange)) ? $_POST['immunity'] : '';
if($_POST['sourcemod_perms'] == 'root'){
$flags = 'z';
}elseif($_POST['sourcemod_perms'] == 'custom'){
if(!empty($_POST['flags']) && is_array($_POST['flags'])){
$x = array_intersect(array_values($_POST['flags']), $sourcemodFlags);
$flags = implode('', ($x));
}
}
if(!empty($flags)){
$adminFile = $serverInfo['home_path'].'/'.$serverInfo['mod_key'].'/'.$adminFiles['sourcemod'];
// Build up what the new line will be.
$newLine = "\"{$_POST['addSteamid']}\"\t\"".(!empty($immunity) ? $immunity.':' : '').$flags."\"";
// Only process if the $adminFile exists;
if($remote->rfile_exists($adminFile) === 1){
$remote->remote_readfile($adminFile, $file_content);
// Decide if it's replacing an existing line or is a new line.
if(preg_match('/'.$_POST['addSteamid'].'/i', $file_content)){
$file_content = preg_replace('/.*'.$_POST['addSteamid'].'.*/i', $newLine, $file_content);
}else{
$file_content .= $newLine."\r\n";
}
if($remote->remote_writefile($adminFile, $file_content) === 1){
if(!empty($serverInfo['control_password'])){
$reloadAdmins = $remote->remote_send_rcon_command($serverInfo['home_id'], $serverInfo['ip'], $serverInfo['port'], 'rcon2', $serverInfo['control_password'], '', 'sm_reloadadmins', $return);
if($reloadAdmins === -1){
echo get_lang('rcon_reload_admins_failed');
}elseif($reloadAdmins === 1){
if(preg_match('/Admin cache has been refreshed/i', $return)){
echo get_lang_f('reload_admins_success', $_POST['addSteamid']);
}else{
echo get_lang('reload_admins_failed');
}
}
}else{
// No rcon password stored - can't reload admins
echo get_lang_f('add_success_no_rcon', $_POST['addSteamid']);
}
}else{
// There was a problem writing to the admin file.
echo get_lang_f('writefile_error', $adminFile);
}
}else{
// The remote admin file doesn't exist.
echo get_lang_f('remotefile_nonexistent', $adminFiles['sourcemod']);
}
}else{
// There wasn't any flags specified.
echo get_lang('empty_flag_list');
}
}else{
// invalid steam_id format given.
echo get_lang('invalid_steam_format');
}
}else{
// Agent is offline. We can't add any admins here.
echo get_lang('selected_server_offline');
}
}else{
// the hidden input values don't exist in our servers array. however, they should exist.
// if we're here: 1) the hidden variables have either been manually changed, or 2) the user was removed from accessing the selected server while still on the page.
echo get_lang('malformed_form');
}
}else{
// An empty form was submitted.
echo get_lang('empty_form_data');
}
}else{
$return = array();
for($x = 0; $x < count($servers); ++$x){
$return[] = array(
'remote_server_id' => $servers[$x]['remote_server_id'],
'ip' => $servers[$x]['ip'],
'port' => $servers[$x]['port'],
'home_id' => $servers[$x]['home_id'],
'home_name' => $servers[$x]['home_name'],
'game_name' => $servers[$x]['game_name'],
);
}
echo json_encode($return);
}
}
?>

View file

@ -1,45 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
include 'includes/lib_remote.php';
function exec_ogp_module()
{
global $db;
$remoteServers = $db->getRemoteServers();
$servers = array();
if(is_array($remoteServers)){
foreach($remoteServers as $server){
$remote = new OGPRemoteLibrary($server['agent_ip'], $server['agent_port'], $server['encryption_key'], 1);
$status = (int)$remote->status_chk();
$servers[] = array(
'id' => $server['remote_server_id'],
'name' => $server['remote_server_name'] .' '. (($status) === 0 ? '('.get_lang('offline').')' : '('.get_lang('online').')'),
'status' => $status,
);
}
}
echo json_encode($servers);
}
?>

View file

@ -1,163 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require 'includes/lib_remote.php';
function exec_ogp_module()
{
global $db;
include 'modules/util/functions.php';
include 'modules/util/util_config.php';
$servers = getUserServers($db->getIpPortsForUser($_SESSION['user_id']), $subuserAdminManagement, $amx_supportedGames);
// If it's a post request and the user is signed in - process it.
// Otherwise, remove some sensitive info (such as encryption_key) from $servers - only keeping what the user needs to see and json_encode it for JS to process.
if($_SERVER['REQUEST_METHOD'] === 'POST'){
$serverInfo = array();
$flags = '';
$amx_modFlags = range('a', 'u');
// Don't use isset here because they're always going to be set if the form is submitted - we only want to process the data if the following isn't empty.
if(!empty($_POST['amx_gameserver_id']) && !empty($_POST['remote_server_id']) && !empty($_POST['gameserver_name'])
&& !empty($_POST['gameserver_ip']) && !empty($_POST['gameserver_port']) && !empty($_POST['amx_mod_perms'])
&& !empty($_POST['amx_login_type']) && (!empty($_POST['amx_Steamid']) || !empty($_POST['amx_Nickname']) && !empty($_POST['amx_Password']))){
foreach($servers as $server){
// Try to check if hidden form values have been manually edited. If not, process.
if($server['remote_server_id'] == $_POST['remote_server_id'] && $server['home_id'] == $_POST['amx_gameserver_id']
&& $server['game_name'] == $_POST['gameserver_name'] && $server['ip'] == $_POST['gameserver_ip'] && $server['port'] == $_POST['gameserver_port']){
$serverInfo = $server;
break;
}
}
if(!empty($serverInfo)){
$remote = new OGPRemoteLibrary($serverInfo['agent_ip'], $serverInfo['agent_port'], $serverInfo['encryption_key'], $serverInfo['timeout']);
if($remote->status_chk() === 1){
if(($_POST['amx_login_type'] == 'amx_login_steamid' && preg_match('/^STEAM_[01]:[01]:\d+$/', $_POST['amx_Steamid']))
|| ($_POST['amx_login_type'] == 'amx_login_nick_pass'
&& preg_match('/^[^\s][A-zÀ-ÿ0-9 !@)(,}\/|\.:?;{#$%&*+=-]{1,28}[^\s]$/', $_POST['amx_Nickname'])
&& preg_match('/^[^\s][A-zÀ-ÿ0-9 !@)(,}\/|\.:?;{#$%&*+=-]{1,28}[^\s]$/', $_POST['amx_Password']))){
if($_POST['amx_mod_perms'] == 'root'){
$flags = 'abcdefghijklmnopqrstu';
}elseif($_POST['amx_mod_perms'] == 'custom'){
if(!empty($_POST['amx_flags']) && is_array($_POST['amx_flags'])){
$x = array_intersect(array_values($_POST['amx_flags']), $amx_modFlags);
$flags = implode('', ($x));
}
}
if(!empty($flags)){
$adminFile = $serverInfo['home_path'].'/'.$serverInfo['mod_key'].'/'.$adminFiles['amx_mod'];
// Build up what the new line will be.
if($_POST['amx_login_type'] == 'amx_login_steamid')
{
$newLine = "\"{$_POST['amx_Steamid']}\" \"\" \"${flags}\" \"ce\"";
}
elseif($_POST['amx_login_type'] == 'amx_login_nick_pass')
{
$newLine = "\"{$_POST['amx_Nickname']}\" \"{$_POST['amx_Password']}\" \"${flags}\" \"a\"";
}
// Only process if the $adminFile exists;
if($remote->rfile_exists($adminFile) === 1){
$remote->remote_readfile($adminFile, $file_content);
// Decide if it's replacing an existing line or is a new line.
if($_POST['amx_login_type'] == 'amx_login_steamid')
{
if(preg_match('/'.preg_quote($_POST['amx_Steamid']).'/i', $file_content)){
$file_content = preg_replace('/.*'.preg_quote($_POST['amx_Steamid']).'.*/i', $newLine, $file_content);
}else{
$file_content .= $newLine."\r\n";
}
}
elseif($_POST['amx_login_type'] == 'amx_login_nick_pass')
{
if(preg_match('/'.preg_quote($_POST['amx_Nickname']).'/i', $file_content)){
$file_content = preg_replace('/.*'.preg_quote($_POST['amx_Nickname']).'.*/i', $newLine, $file_content);
}else{
$file_content .= $newLine."\r\n";
}
}
if($remote->remote_writefile($adminFile, $file_content) === 1){
if(!empty($serverInfo['control_password'])){
$reloadAdmins = $remote->remote_send_rcon_command($serverInfo['home_id'], $serverInfo['ip'], $serverInfo['port'], 'rcon', $serverInfo['control_password'], '', 'amx_reloadadmins', $return);
if($reloadAdmins === -1){
echo get_lang('rcon_reload_admins_failed');
}elseif($reloadAdmins === 1){
echo $return;
}
}else{
// No rcon password stored - can't reload admins
echo get_lang_f('add_success_no_rcon', $_POST['amx_Steamid']);
}
}else{
// There was a problem writing to the admin file.
echo get_lang_f('writefile_error', $adminFile);
}
}else{
// The remote admin file doesn't exist.
echo get_lang_f('remotefile_nonexistent', $adminFiles['amx_mod']);
}
}else{
// There wasn't any flags specified.
echo get_lang('empty_flag_list');
}
}else{
// invalid steam_id format given.
echo get_lang('invalid_steam_format');
}
}else{
// Agent is offline. We can't add any admins here.
echo get_lang('selected_server_offline');
}
}else{
// the hidden input values don't exist in our servers array. however, they should exist.
// if we're here: 1) the hidden variables have either been manually changed, or 2) the user was removed from accessing the selected server while still on the page.
echo get_lang('malformed_form');
}
}else{
// An empty form was submitted.
echo get_lang('empty_form_data');
}
}else{
$return = array();
for($x = 0; $x < count($servers); ++$x){
$return[] = array(
'remote_server_id' => $servers[$x]['remote_server_id'],
'ip' => $servers[$x]['ip'],
'port' => $servers[$x]['port'],
'home_id' => $servers[$x]['home_id'],
'home_name' => $servers[$x]['home_name'],
'game_name' => $servers[$x]['game_name'],
);
}
echo json_encode($return);
}
}
?>

View file

@ -1,119 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function toCommunityID($id){
if(preg_match('/^STEAM_/', $id)){
$parts = explode(':', $id);
return bcadd(bcadd(bcmul($parts[2], '2'), '76561197960265728'), $parts[1]);
}elseif(is_numeric($id) && strlen($id) < 16){
return bcadd($id, '76561197960265728');
}else{
return $id;
}
}
function toSteamID($id){
if(is_numeric($id) && strlen($id) >= 16){
$z = bcdiv(bcsub($id, '76561197960265728'), '2');
}elseif(is_numeric($id)){
$z = bcdiv($id, '2');
}else{
return $id;
}
$y = bcmod($id, '2');
return 'STEAM_0:'.$y.':'.floor($z);
}
function toUserID($id){
if(preg_match('/^STEAM_/', $id)){
$split = explode(':', $id);
return $split[2] * 2 + $split[1];
}elseif(preg_match('/^765/', $id) && strlen($id) > 15){
return bcsub($id, '76561197960265728');
}else{
return $id;
}
}
function getSteamId($input){
$xml = simplexml_load_file('http://steamcommunity.com/id/'.$input.'?xml=1');
$steamId64 = $xml->steamID64;
if(preg_match('/^765/', $steamId64) === 0){
return false;
}else{
return (string)$steamId64; // Cast it to a string, otherwise an SimpleXMLElement Object will be returned.
}
}
function convert($id){
if(preg_match('/^\[U:1:[0-9]+\]/', $id)){
$id = substr($id, 5, -1);
}
// Check if the input is in legacyId, communityId, or SteamId3 format.
// If it's not, assume it's a custom Id and attempt to get the communityId from what the user entered.
if(preg_match('/^STEAM_[01]:[01]:\d+$/', $id) === 0 && preg_match('/^[0-9]/', $id) === 0 && preg_match('/^765/', $id) === 0){
if(($steamId = getSteamId($id)) === false){
return json_encode(array());
}
$id = $steamId;
}
echo json_encode(array(
'communityId' => toCommunityID($id),
'steamId' => toSteamID($id),
'steamId3' => '[U:1:'.toUserID($id).']',
'steamProfile' => '<a href="http://steamcommunity.com/profiles/'.toCommunityID($id).'">Steam Profile</a>',
));
}
// Get gameservers belonging to each user with matching permissions if they're not an admin.
function getUserServers($servers, $flags, $supportedGames){
global $db;
$info = array();
$userInfo = $db->getUserById($_SESSION['user_id']);
$userRole = $userInfo['users_role'];
if(!empty($servers)){
foreach($servers as $server){
$gamehome = $db->getUserGameHome($_SESSION['user_id'], $server['home_id']);
if(in_array($gamehome['game_name'], $supportedGames) === true){
if($userRole !== 'admin'){
if(strpbrk($gamehome['access_rights'], $flags) !== false){
$info[] = $server;
}
}else{
$info[] = $server;
}
}
}
}
return $info;
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 B

View file

@ -1,35 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
// Module general information
$module_title = "Utilities";
$module_version = "2.0";
$db_version = 0;
$module_required = TRUE;
$module_menus = array( array( 'subpage' => '', 'name'=>'Utilities', 'group'=>'user' ) );
$module_prereqs = array(
array( "name" => "PHP BCMath Extension", "type" => "f", "value" => "bcadd" ),
);
?>

View file

@ -1,8 +0,0 @@
<navigation>
<page key="default" file="util.php" access="user,admin,subuser" />
<page key="agents" file="agents.php" access="user,admin,subuser" />
<page key="addadmin_helper" file="addadmin_helper.php" access="user,admin,subuser" />
<page key="amx_addadmin_helper" file="amx_addadmin_helper.php" access="user,admin,subuser" />
<page key="steamid_converter" file="steamid_converter.php" access="user,admin,subuser" />
<page key="network_tools" file="network_tools.php" access="user,admin,subuser" />
</navigation>

View file

@ -1,96 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require 'includes/lib_remote.php';
function exec_ogp_module()
{
global $db;
include 'modules/util/util_config.php';
$userInfo = $db->getUserById($_SESSION['user_id']);
$userRole = $userInfo['users_role'];
$command = trim($_POST['command']);
$target = trim($_POST['remote_target']);
// Check if the specified agent exists. If it does, assign it to $servers. Otherwise, return that it's an invalid agent.
if(($server = $db->getRemoteServerById($_POST['agent'])) === false){
die(get_lang('agent_invalid'));
}
$remote = new OGPRemoteLibrary($server['agent_ip'], $server['agent_port'], $server['encryption_key'], 60);
if($remote->status_chk() === 0){
echo get_lang('networktools_agent_offline');
}elseif(empty($target)){
echo get_lang('target_empty');
}elseif(empty($command)){
echo get_lang('command_empty');
}else{
$os = preg_match("/CYGWIN/", $remote->what_os()) ? 'windows' : 'linux';
// Loop over $availableCommands from util_config.php
// Assign a variable, $allowAccess based on the current user's role and if the config file states the user's role is allowed access to this command.
for($x = 0; $x < count($availableCommands); ++$x){
if($availableCommands[$x]['title'] == $command){
$command = $availableCommands[$x][$os];
$allowAccess = $availableCommands[$x][$userRole];
}
}
if(isset($allowAccess) && $allowAccess === true){
// Check the command is available to us. If it's not, echo command_unavilable
$which = $remote->exec('which '.$command);
if(empty($which)){
echo get_lang('command_unavilable');
}else{
// Not completely necessary - gethostbyaddr(gethostbyname()) will return false if it's anything that's not valid.
// This is mostly for logging attempted arbitrary commands.
if(strpbrk($target, $blockedCharacters)){
if($logMaliciousUsage){
$db->logger(get_lang_f('command_bad_characters', $command, htmlentities($target)));
}
echo get_lang('command_hacking_attempt');
}else{
$target = gethostbyaddr(gethostbyname($target));
if(!$target){
echo get_lang('target_invalid');
}else{
$exec = $remote->exec($command.' '.$target);
echo ($exec === null) ? get_lang('exec_failed') : htmlentities(trim($exec));
if($logAllUsage){
$db->logger(get_lang_f('command_executed', $command, htmlentities($target)));
}
}
}
}
}else{
// If the user isn't allowed access but they've somehow got this far then they've changed the value="" attr.
// return with command_no_permissions and log the event.
echo get_lang('command_no_access');
if($logMaliciousUsage){
$db->logger(get_lang_f('command_no_permissions', $command, htmlentities($target)));
}
} //else allowAccess
}
}
?>

View file

@ -1,30 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require 'modules/util/functions.php';
function exec_ogp_module()
{
require 'modules/util/util_config.php';
convert($_POST['steam_input']);
}
?>

View file

@ -1,101 +0,0 @@
input[type=text], input[type=number], select {
width:100%;
padding:6px 10px;
margin:8px 0;
display:inline-block;
border:1px solid #ccc;
border-radius:4px;
box-sizing:border-box;
}
.main-content{
text-align:left;
}
.show{display:block;}
.hide{display:none;}
#tabs {
background:transparent;
border:none;
}
#tabs .ui-widget-header{
background:transparent;
border:none;
border-bottom:1px solid #c0c0c0;
-moz-border-radius:0px;
-webkit-border-radius:0px;
border-radius:0px;
}
#tabs .ui-tabs-nav .ui-state-default{
background:transparent;
border:none;
}
#tabs .ui-tabs-nav .ui-state-active{
background:transparent url('img/uiTabsArrow.png') no-repeat bottom center;
border:none;
}
#tabs .ui-tabs-nav .ui-state-default a{
color:#c0c0c0;
}
#tabs .ui-tabs-nav .ui-state-active a{
color:#459e00;
}
#your-address{
cursor:pointer;
color:#2780e3;
font-weight:bold;
}
#select_agent{
margin-top:10px;
margin-bottom:10px;
}
#loading{
border:16px solid #f3f3f3;
border-radius:50%;
border-top:16px solid #3498db;
width:64px;
height:64px;
-webkit-animation:spin 2s linear infinite;
animation:spin 2s linear infinite;
margin:auto;
}
@-webkit-keyframes spin{
0%{-webkit-transform: rotate(0deg);}
100%{-webkit-transform: rotate(360deg);}
}
@keyframes spin{
0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}
}
/* IDs for messages. Customize their style output here. */
#loading_agents{}
#loading_failed{}
#no_commands{}
#agents_offline{}
#no_servers{}
#invalid_server{}
#invalid_steamid_admin{}
#invalid_response_admin{}
#invalid_immunity{}
#all_servers_offline{}
#addadmin_response{}
#invalid_steamid{}
#invalid_response{}
/* IDs for the command output and network tools tab here. Customize their style here. */
#options{}
#output{}

View file

@ -1,246 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
echo '<script src="js/modules/util.js"></script>';
function exec_ogp_module()
{
global $db;
include 'util_config.php';
$userInfo = $db->getUserById($_SESSION['user_id']);
$userRole = $userInfo['users_role'];
$commands = array();
foreach($availableCommands as $command){
if($userRole == 'admin' && $command['admin'] === true){
$commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
}
if($userRole == 'user' && $command['user'] === true){
$commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
}
if($userRole == 'subuser' && $command['subuser'] === true){
$commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
}
}
?>
<h2><?php echo get_lang('module_name'); ?></h2>
<div id="tabs">
<ul>
<li><a href="#tabs-1"><?php echo get_lang('network_tools'); ?></a></li>
<li><a href="#tabs-2"><?php echo get_lang('sourcemod_admins'); ?></a></li>
<li><a href="#tabs-3"><?php echo get_lang('amx_mod_admins'); ?></a></li>
<li><a href="#tabs-4"><?php echo get_lang('steam_converter'); ?></a></li>
</ul>
<div id="tabs-1">
<div>
<span id="loading_agents" class="show"><?php echo get_lang('loading_agents'); ?></span>
<span id="loading_failed" class="hide"><?php echo get_lang('loading_failed'); ?></span>
<span id="no_commands" class="hide"><?php echo get_lang('no_commands'); ?></span>
<span id="agents_offline" class="hide"><?php echo get_lang('agents_offline'); ?></span>
</div>
<div id="options" class="hide">
<div><?php echo get_lang('your_ip'); ?> <span id="your-address"><?php echo getClientIPAddress(); ?></span></div>
<form action="" method="POST" id="network_tools">
<div id="select_agent"></div>
<label for="command"><?php echo get_lang('command'); ?></label>
<select id="command" name="command"><?php echo implode('', $commands); ?></select>
<label for="remote_target"><?php echo get_lang('remote_target'); ?></label>
<input type="text" id="remote_target" name="remote_target" required>
<button type="submit"><?php echo get_lang('submit'); ?></button>
</form>
</div>
<div id="loading" class="hide"></div>
<div id="output" class="hide"></div>
</div><!--/#tabs-1-->
<div id="tabs-2">
<div>
<div>
<span id="no_servers" class="hide"><?php echo get_lang('no_servers'); ?></span>
</div>
<div id="add_admin" class="hide">
<form action="" method="POST" id="addadmin_form">
<div id="games"></div>
<label for="addSteamid"><?php echo get_lang('steamid'); ?></label>
<input type="text" id="addSteamid" name="addSteamid" pattern="^STEAM_[01]:[01]:\d+$" required>
<label for="immunity"><?php echo get_lang('immunity'); ?></label>
<input type="number" id="immunity" name="immunity" min="1" max="99">
<label for="sourcemod_perms"><?php echo get_lang('sourcemod_perms'); ?></label>
<select id="sourcemod_perms" name="sourcemod_perms">
<option value="root"><?php echo get_lang('sourcemod_perm_root'); ?></option>
<option value="custom"><?php echo get_lang('sourcemod_perm_custom'); ?></option>
</select>
<div id="sourcemod_flagList" class="hide">
<fieldset>
<?php
foreach(range('a', 't') as $flag){
?>
<div class="item">
<input type="checkbox" id="flag_<?php echo $flag; ?>" name="flags[]" value="<?php echo $flag; ?>">
<label for="flag_<?php echo $flag; ?>"><?php echo get_lang('sourcemod_flag_'.$flag); ?></label>
</div>
<?php
}
?>
</fieldset>
</div>
<input type="hidden" name="remote_server_id" id="remote_server_id" value="">
<input type="hidden" name="gameserver_name" id="gameserver_name" value="">
<input type="hidden" name="gameserver_ip" id="gameserver_ip" value="">
<input type="hidden" name="gameserver_port" id="gameserver_port" value="">
<button type="submit"><?php echo get_lang('submit'); ?></button>
</form>
</div>
<div id="invalid_server" class="hide"><?php echo get_lang('server_not_selected'); ?></div>
<div id="invalid_steamid_admin" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
<div id="invalid_response_admin" class="hide"><?php echo get_lang('post_failed'); ?></div>
<div id="invalid_immunity" class="hide"><?php echo get_lang('invalid_immunity'); ?></div>
<div id="all_servers_offline" class="hide"><?php echo get_lang('agents_offline'); ?></div>
<div id="addadmin_response" class="hide"></div>
</div>
</div><!--/#tabs-2-->
<div id="tabs-3">
<div>
<div>
<span id="amx_no_servers" class="hide"><?php echo get_lang('no_servers'); ?></span>
</div>
<div id="amx_add_admin" class="hide">
<form action="" method="POST" id="amx_addadmin_form">
<div id="amx_games"></div>
<label for="amx_login_type"><?php echo get_lang('amx_login_type'); ?></label>
<select id="amx_login_type" name="amx_login_type">
<option value="amx_login_steamid"><?php echo get_lang('amx_login_steamid'); ?></option>
<option value="amx_login_nick_pass"><?php echo get_lang('amx_login_nick_pass'); ?></option>
</select>
<div id="amx_login_steamid">
<label for="amx_Steamid"><?php echo get_lang('steamid'); ?></label>
<input type="text" id="amx_Steamid" name="amx_Steamid" pattern="^STEAM_[01]:[01]:\d+$" required>
</div>
<div id="amx_login_nick_pass" class="hide">
<label for="amx_Nickname"><?php echo get_lang('nickname'); ?></label>
<input type="text" id="amx_Nickname" name="amx_Nickname" pattern="^[^\s][A-zÀ-ÿ0-9 !@)(,}/|\.:?;{#$%&*+=-]{1,28}[^\s]$">
<label for="amx_Password"><?php echo get_lang('password'); ?></label>
<input type="text" id="amx_Password" name="amx_Password" pattern="^[^\s][A-zÀ-ÿ0-9 !@)(,}/|\.:?;{#$%&*+=-]{1,28}[^\s]$">
</div>
<label for="amx_mod_perms"><?php echo get_lang('amx_mod_perms'); ?></label>
<select id="amx_mod_perms" name="amx_mod_perms">
<option value="root"><?php echo get_lang('amx_mod_perm_root'); ?></option>
<option value="custom"><?php echo get_lang('amx_mod_perm_custom'); ?></option>
</select>
<div id="amx_mod_flagList" class="hide">
<fieldset>
<?php
foreach(range('a', 'u') as $flag){
?>
<div class="amx_item">
<input type="checkbox" id="amx_flag_<?php echo $flag; ?>" name="amx_flags[]" value="<?php echo $flag; ?>">
<label for="amx_flag_<?php echo $flag; ?>"><?php echo get_lang('amx_mod_flag_'.$flag); ?></label>
</div>
<?php
}
?>
</fieldset>
</div>
<input type="hidden" name="remote_server_id" id="amx_remote_server_id" value="">
<input type="hidden" name="gameserver_name" id="amx_gameserver_name" value="">
<input type="hidden" name="gameserver_ip" id="amx_gameserver_ip" value="">
<input type="hidden" name="gameserver_port" id="amx_gameserver_port" value="">
<button type="submit"><?php echo get_lang('submit'); ?></button>
</form>
</div>
<div id="amx_invalid_server" class="hide"><?php echo get_lang('server_not_selected'); ?></div>
<div id="amx_invalid_steamid_admin" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
<div id="amx_invalid_nickname_admin" class="hide"><?php echo get_lang('invalid_nickname'); ?></div>
<div id="amx_invalid_password_admin" class="hide"><?php echo get_lang('invalid_password'); ?></div>
<div id="amx_invalid_response_admin" class="hide"><?php echo get_lang('post_failed'); ?></div>
<div id="amx_all_servers_offline" class="hide"><?php echo get_lang('agents_offline'); ?></div>
<div id="amx_addadmin_response" class="hide"></div>
</div>
</div><!--/#tabs-3-->
<div id="tabs-4">
<div>
<form action="" method="POST" id="steam_converter">
<label for="steam_input">SteamID / SteamID3 / SteamID64 / CustomID:</label>
<input type="text" name="steam_input" id="steam_input" required>
<button type="submit"><?php echo get_lang('submit'); ?></button>
</form>
</div>
<div id="invalid_steamid" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
<div id="invalid_response" class="hide"><?php echo get_lang('post_failed'); ?></div>
<div id="steam_info">
<div id="steamLink"></div>
<div id="steamId"></div>
<div id="steamId3"></div>
<div id="steamId64"></div>
</div>
</div><!--/#tabs-4-->
</div> <!--/#tabs-->
<div id="translation"
data-target_empty="<?=get_lang('target_empty')?>"
data-command_empty="<?=get_lang('command_empty')?>"
data-agent_invalid="<?=get_lang('agent_invalid')?>"
data-post_failed="<?=get_lang('post_failed')?>"
data-select_server="<?=get_lang('select_server')?>"
data-select_server_option="<?=get_lang('select_server_option')?>"
data-select_agent="<?=get_lang('select_agent')?>" ></div>
<?php
}
?>

View file

@ -1,99 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
// Define commands, user permissions (via *role* => true/false), and what they're referred to on each OS.
// Include arguements here. They cannot be passed in the text input field.
$availableCommands = array(
// 'title' also needs to be specified in the translation files with the same values - as this is what shows on the select list. ex:
array(
'title' => 'ping',
'linux' => 'ping -c 4', // By default, ping runs indefinitely on Linux - so set the count to 4; same as Windows default.
'windows' => 'ping',
// Default: Ping is available to all user roles.
'subuser' => true,
'user' => true,
'admin' => true,
),
array(
'title' => 'traceroute',
'linux' => 'traceroute',
'windows' => 'tracert',
// Default: Traceroute is only available to admins.
'subuser' => false,
'user' => false,
'admin' => true,
),
);
// An array of characters which should never be passed to exec()
$blockedCharacters = '"#$%^&*()+=[]\';,\\/{}|:<>?~';
// Should we log attempted form manipulation (ie, editing the form to execute a command the user doesn't have access to) ...
// ... and attempted multi-command input? (ie, ;cd /;ls)
$logMaliciousUsage = true;
// Should we log successfully executed commands...?
// Could spam the logs - so probably set this to false.
$logAllUsage = false;
// Games which Sourcemod supports.
// Needs to be exactly what OGP reports as the game_name.
$supportedGames = array(
'Counter Strike Global Offensive',
'Counter Strike Source',
'Day of Defeat Source',
'Dystopia',
'Garrys Mod',
'Half-Life 2: Deathmatch',
'Hidden: Source',
'Pirates, Vikings and Knights II',
'Team Fortress 2',
'Team Fortress 2 Beta',
'Left 4 Dead',
'Left 4 Dead 2'
);
// Games which amx mod supports.
// Needs to be exactly what OGP reports as the game_name.
$amx_supportedGames = array(
'Counter-Strike',
'Counter-Strike Condition Zero',
'Day of Defeat',
'Death Match Classic',
'Team Fortress Classic'
);
// Simple array of where admins are stored depending on the admin mod.
// mod.name => file.location
$adminFiles = array(
'sourcemod' => 'addons/sourcemod/configs/admins_simple.ini',
'amx_mod' => 'addons/amxmodx/configs/users.ini',
);
// Flags that sub-users need to add admins to owned parent game-servers.
// This should just be the same as allow_file_management and allow_ftp - as they'll be able to add admins anyway with those flags.
$subuserAdminManagement = 'ft';