ajout admin panel
This commit is contained in:
		
							parent
							
								
									1a2edcfee6
								
							
						
					
					
						commit
						b7885d20cf
					
				
							
								
								
									
										56
									
								
								mangosd.conf
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								mangosd.conf
									
									
									
									
									
								
							| @ -1,56 +0,0 @@ | ||||
| 
 | ||||
| ################################################################################################################### | ||||
| # | ||||
| #    GameType | ||||
| #        Server realm style | ||||
| #        0 = NORMAL; 1 = PVP; 4 = NORMAL; 6 = RP; 8 = RPPVP | ||||
| #        also custom type: 16 FFA_PVP (free for all pvp mode like arena PvP in all zones except rest | ||||
| #        activated places and sanctuaries) | ||||
| # | ||||
| #    RealmZone | ||||
| #        Server realm zone (set allowed alphabet in character names/etc). See also Strict*Names options. | ||||
| # | ||||
| #        1 Development    - any language (Default) | ||||
| #        2 United States  - extended-Latin | ||||
| #        3 Oceanic        - extended-Latin | ||||
| #        4 Latin America  - extended-Latin | ||||
| #        5 Tournament     - basic-Latin at create, any at login | ||||
| #        6 Korea          - East-Asian | ||||
| #        7 Tournament     - basic-Latin at create, any at login | ||||
| #        8 English        - extended-Latin | ||||
| #        9 German         - extended-Latin | ||||
| #        10 French        - extended-Latin | ||||
| #        11 Spanish       - extended-Latin | ||||
| #        12 Russian       - Cyrillic | ||||
| #        13 Tournament    - basic-Latin at create, any at login | ||||
| #        14 Taiwan        - East-Asian | ||||
| #        15 Tournament    - basic-Latin at create, any at login | ||||
| #        16 China         - East-Asian | ||||
| #        17 CN1           - basic-Latin at create, any at login | ||||
| #        18 CN2           - basic-Latin at create, any at login | ||||
| #        19 CN3           - basic-Latin at create, any at login | ||||
| #        20 CN4           - basic-Latin at create, any at login | ||||
| #        21 CN5           - basic-Latin at create, any at login | ||||
| #        22 CN6           - basic-Latin at create, any at login | ||||
| #        23 CN7           - basic-Latin at create, any at login | ||||
| #        24 CN8           - basic-Latin at create, any at login | ||||
| #        25 Tournament    - basic-Latin at create, any at login | ||||
| #        26 Test Server   - any language | ||||
| #        27 Tournament    - basic-Latin at create, any at login | ||||
| #        28 QA Server     - any language | ||||
| #        29 CN9           - basic-Latin at create, any at login | ||||
| # | ||||
| #    RabbitDay | ||||
| #        Set to Rabbit Day (date in unix time), only the day and month are considered, the year is not important | ||||
| #        Default: 0 (off) | ||||
| #        Suggested: 954547200 (April 1st, 2000) | ||||
| # | ||||
| #    Motd | ||||
| #        Message of the Day. Displayed at worldlogin for every user ('@' for a newline). | ||||
| # | ||||
| #################################################################################################################### | ||||
| 
 | ||||
| GameType = 0 | ||||
| RealmZone = 8 | ||||
| RabbitDay = 954547200 | ||||
| Motd = "Bienvenue en Azeroth!" | ||||
| @ -1,22 +0,0 @@ | ||||
| FROM php:8.2-apache | ||||
| 
 | ||||
| # Installer les dépendances nécessaires pour compiler les extensions PHP | ||||
| RUN apt-get update && apt-get install -y \ | ||||
|     unzip \ | ||||
|     git \ | ||||
|     libgmp-dev \ | ||||
|     libzip-dev \ | ||||
|     libxml2-dev \ | ||||
|     default-mysql-client \ | ||||
|     && docker-php-ext-install mysqli gmp soap \ | ||||
|     && rm -rf /var/lib/apt/lists/* | ||||
| 
 | ||||
| # Installer composer | ||||
| COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | ||||
| 
 | ||||
| # Copier l'application | ||||
| WORKDIR /var/www/html | ||||
| COPY ./index.php ./srp6.php ./composer.json ./ | ||||
| 
 | ||||
| # Installer les dépendances PHP | ||||
| RUN composer install --no-dev --optimize-autoloader | ||||
| @ -1,15 +0,0 @@ | ||||
| { | ||||
|     "name": "wow/account-web", | ||||
|     "description": "Web panel to create WoW accounts with SRP6 and OIDC authentication", | ||||
|     "require": { | ||||
|         "php": ">=8.0", | ||||
|         "jumbojett/openid-connect-php": "^0.9.6", | ||||
|         "ext-gmp": "*", | ||||
|         "ext-mysqli": "*" | ||||
|     }, | ||||
|     "autoload": { | ||||
|         "files": [ | ||||
|             "srp6.php" | ||||
|         ] | ||||
|     } | ||||
| } | ||||
| @ -1,58 +0,0 @@ | ||||
| <?php | ||||
| require __DIR__ . '/vendor/autoload.php'; | ||||
| 
 | ||||
| use Jumbojett\OpenIDConnectClient; | ||||
| 
 | ||||
| // session_start();
 | ||||
| 
 | ||||
| // // --- OIDC login ---
 | ||||
| // $oidc = new OpenIDConnectClient(
 | ||||
| //     getenv('OIDC_ISSUER'),
 | ||||
| //     getenv('OIDC_CLIENT_ID'),
 | ||||
| //     getenv('OIDC_CLIENT_SECRET')
 | ||||
| // );
 | ||||
| 
 | ||||
| // if (!isset($_SESSION['user'])) {
 | ||||
| //     $oidc->authenticate();
 | ||||
| //     $_SESSION['user'] = $oidc->getVerifiedClaims();
 | ||||
| // }
 | ||||
| 
 | ||||
| // --- Formulaire pour créer un compte ---
 | ||||
| if ($_SERVER['REQUEST_METHOD'] === 'POST') { | ||||
|     $user = $_POST['username']; | ||||
|     $pass = $_POST['password']; | ||||
| 
 | ||||
|     $soapUser = 'SOAPUSER'; | ||||
|     $soapPass = 'SOAPPASS'; | ||||
|     $host = getenv('SOAP_HOST'); | ||||
|     $port = getenv('SOAP_PORT'); | ||||
| 
 | ||||
|     $command = "account create $user $pass"; | ||||
|     $command = "account list"; | ||||
| 
 | ||||
|     $client = new SoapClient(NULL, [ | ||||
|         "location" => "http://mangosd:7878/", | ||||
|         "uri" => "urn:MaNGOS", | ||||
|         "style" => SOAP_RPC, | ||||
|         'login' => $soapUser, | ||||
|         'password' => $soapPass | ||||
|     ]); | ||||
| 
 | ||||
|     try { | ||||
|         // NOTE : ne pas mettre de préfixe ns1:
 | ||||
|         $result = $client->__soapCall('executeCommand', [new SoapParam($command, 'command')]); | ||||
|         echo "✅ Command executed:\n"; | ||||
|         echo $result; | ||||
|         var_dump($result); | ||||
|     } catch (Exception $e) { | ||||
|         echo "❌ Command failed:\n"; | ||||
|         echo $e->getMessage(); | ||||
|     } | ||||
| } | ||||
| ?>
 | ||||
| 
 | ||||
| <form method="post"> | ||||
|     <input type="text" name="username" placeholder="Username" required> | ||||
|     <input type="password" name="password" placeholder="Password" required> | ||||
|     <button type="submit">Create Account</button> | ||||
| </form> | ||||
							
								
								
									
										50
									
								
								php/srp6.php
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								php/srp6.php
									
									
									
									
									
								
							| @ -1,50 +0,0 @@ | ||||
| <?php | ||||
| /** | ||||
|  * SRP6 (WoW/MaNGOS) – génération de v et s corrects. | ||||
|  * Points clés : | ||||
|  * - USERNAME & PASSWORD en MAJUSCULES | ||||
|  * - x = SHA1( salt || SHA1(USER:PASS) ) | ||||
|  * - N = 0x894B...E9BB7 (256-bit), g = 7 | ||||
|  * - Endianness : on évite gmp_import et on passe par hex pour ne pas se tromper | ||||
|  * - Hex MAJUSCULE + padding à la longueur de N | ||||
|  */ | ||||
| final class SRP6 | ||||
| { | ||||
|     // N et g utilisés par WoW (256-bit)
 | ||||
|     private const N_HEX = '894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7'; | ||||
|     private const G_HEX = '07'; | ||||
| 
 | ||||
|     public static function createVerifierAndSalt(string $username, string $password): array | ||||
|     { | ||||
|         $U = strtoupper($username); | ||||
|         $P = strtoupper($password); | ||||
| 
 | ||||
|         // 32 octets de sel (=> 64 hex)
 | ||||
|         $saltBin = random_bytes(32); | ||||
| 
 | ||||
|         // h1 = SHA1(U:P)
 | ||||
|         $h1 = sha1($U . ':' . $P, true); | ||||
| 
 | ||||
|         // h2 = SHA1(salt || h1)
 | ||||
|         $h2 = sha1($saltBin . $h1, true); | ||||
| 
 | ||||
|         // x = int( h2 ) (interprété comme un entier non signé big-endian)
 | ||||
|         // -> on passe par l'hex pour éviter les soucis d'endianness
 | ||||
|         $x = gmp_init(bin2hex($h2), 16); | ||||
| 
 | ||||
|         $N = gmp_init(self::N_HEX, 16); | ||||
|         $g = gmp_init(self::G_HEX, 16); | ||||
| 
 | ||||
|         // v = g^x mod N
 | ||||
|         $v = gmp_powm($g, $x, $N); | ||||
| 
 | ||||
|         // Longueur hex attendue = longueur de N en hex (ici 64 chars)
 | ||||
|         $nLen = strlen(self::N_HEX); | ||||
| 
 | ||||
|         // Hex MAJUSCULE + padding
 | ||||
|         $vHex = strtoupper(str_pad(gmp_strval($v, 16), $nLen, '0', STR_PAD_LEFT)); | ||||
|         $sHex = strtoupper(str_pad(bin2hex($saltBin), 64, '0', STR_PAD_LEFT)); // 32 bytes => 64 hex
 | ||||
| 
 | ||||
|         return ['v' => $vHex, 's' => $sHex]; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										59
									
								
								soap.php
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								soap.php
									
									
									
									
									
								
							| @ -1,59 +0,0 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information | ||||
|  * | ||||
|  * 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 | ||||
|  * (at your option) 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 | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * MaNGOSsoap client example | ||||
|  * | ||||
|  * a simple example how to invoke commands using SOAP | ||||
|  * | ||||
|  * Make sure you enabled SOAP in your mangosd.conf! | ||||
|  *  SOAP.Enabled = 1 | ||||
|  */ | ||||
| 
 | ||||
| /* | ||||
|  * $username and $password MUST be uppercase | ||||
|  * account $username needs at least SEC_ADMINISTRATOR | ||||
|  */ | ||||
| $username = 'ADMINISTRATOR'; | ||||
| $password = 'ADMINISTRATOR'; | ||||
| 
 | ||||
| $host = "localhost"; | ||||
| $soapport = 7878; | ||||
| $command = "server info"; | ||||
| 
 | ||||
| $client = new SoapClient(NULL, | ||||
| array( | ||||
|     "location" => "http://$host:$soapport/", | ||||
|     "uri" => "urn:MaNGOS", | ||||
|     "style" => SOAP_RPC, | ||||
|     'login' => $username, | ||||
|     'password' => $password | ||||
| )); | ||||
| 
 | ||||
| try { | ||||
|     $result = $client->executeCommand(new SoapParam($command, "command")); | ||||
| 
 | ||||
|     echo "Command succeeded! Output:<br />\n"; | ||||
|     echo $result; | ||||
| } | ||||
| catch (Exception $e) | ||||
| { | ||||
|     echo "Command failed! Reason:<br />\n"; | ||||
|     echo $e->getMessage(); | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	