public void Execute() { var proxy = new InfusionProxy(); proxy.Initialize(commandHandler, new NullSoundPlayer(), new LegacyApi.Injection.NullInjectionWindow()); var resolvedServerAddress = Dns.GetHostEntry(options.ServerAddress) .AddressList.First(a => a.AddressFamily == AddressFamily.InterNetwork); proxy.Start(new ProxyStartConfig() { ServerAddress = options.ServerAddress, ServerEndPoint = new IPEndPoint(resolvedServerAddress, options.Port), LocalProxyPort = (ushort)options.LocalPort, ProtocolVersion = options.ProtocolVersion, LoginEncryptionKey = LoginEncryptionKey.FromVersion(options.ProtocolVersion), Encryption = GetEncryptionSetup(options.Encryption), }); UO.CommandHandler.RegisterCommand(new Command("reload", () => Reload(), false, true, "Reloads an initial script file.")); csharpScriptEngine = new CSharpScriptEngine(console); scriptEngine = new ScriptEngine(csharpScriptEngine, new InjectionScriptEngine(UO.Injection, console)); console.Info($"\nConfigure your client to use 'localhost,{options.LocalPort}' as Ultima Online server address."); if (!string.IsNullOrEmpty(options.ScriptFileName)) { Load(options.ScriptFileName); } Console.ReadLine(); }
internal void InitLoginEncryption(uint seed, LoginEncryptionKey key) { if (encryptionSetup != EncryptionSetup.EncryptedClient) { loginStream = new LoginPushStream(seed, key); } }
public LoginEncryptionKey?GetEncryptionKey() { if (IsEncrypted && EncryptionVersion != null) { return(LoginEncryptionKey.FromVersion(EncryptionVersion)); } else { return(null); } }
public Task Launch(IConsole console, InfusionProxy proxy, LauncherOptions options) { var task = proxy.Start(new ProxyStartConfig() { ServerAddress = options.ServerEndpoint, ServerEndPoint = options.ResolveServerEndpoint().Result, LocalProxyPort = options.Generic.Port, ProtocolVersion = options.ProtocolVersion, Encryption = options.Generic.Encryption, LoginEncryptionKey = LoginEncryptionKey.FromVersion(options.Generic.EncryptionVersion) }); return(task); }
public void StartClient() { infusionProxy.Initialize(commandHandler, new NullSoundPlayer(), new LegacyApi.Injection.NullInjectionWindow()); var resolvedServerAddress = Dns.GetHostEntry(serverAddress) .AddressList.First(a => a.AddressFamily == AddressFamily.InterNetwork); infusionProxy.Start(new ProxyStartConfig() { ServerAddress = $"{serverAddress},{serverPort}", ServerEndPoint = new IPEndPoint(resolvedServerAddress, serverPort), LocalProxyPort = (ushort)proxyPort, ProtocolVersion = clientVersion, Encryption = encrypt ? EncryptionSetup.EncryptedServer : EncryptionSetup.Autodetect, LoginEncryptionKey = LoginEncryptionKey.FromVersion(clientVersion), }); var csharpScriptEngine = new CSharpScriptEngine(console); var scriptEngine = new ScriptEngine(csharpScriptEngine, new InjectionScriptEngine(UO.Injection, console)); var headlessClient = new HeadlessClient(infusionProxy.LegacyApi, console, new HeadlessStartConfig() { Encryption = EncryptionSetup.Autodetect, ClientVersion = clientVersion, ServerAddress = $"127.0.0.1,{proxyPort}", ServerEndPoint = new IPEndPoint(new IPAddress(new byte[] { 127, 0, 0, 1 }), proxyPort), ShardName = shardName, AccountName = accountName, Password = accountPassword, CharacterName = characterName }); headlessClient.Connect(); if (!string.IsNullOrEmpty(scriptFileName)) { _ = scriptEngine.ExecuteScript(PathUtilities.GetAbsolutePath(scriptFileName), new CancellationTokenSource()); } }
public LoginPushStream(uint seed, LoginEncryptionKey key) { loginCrypt = new LoginCrypt(seed, key); }
public EncryptionVersion(string name, LoginEncryptionKey key) { Name = name; Key = key; }
public ServerConnection(ServerConnectionStatus status, IDiagnosticPullStream diagnosticPullStream, IDiagnosticPushStream diagnosticPushStream, byte[] newGameKey, uint loginSeed, LoginEncryptionKey loginKey) : this(status, diagnosticPullStream, diagnosticPushStream, PacketDefinitionRegistryFactory.CreateClassicClient(), EncryptionSetup.Autodetect) { InitNewGameEncryption(newGameKey); this.loginStream = new LoginPushStream(loginSeed, loginKey); }
private void ClientConnectionOnLoginEncryptionStarted(uint seed, LoginEncryptionKey key) { serverConnection.InitLoginEncryption(seed, key); }
public LoginEncryptionDetectionResult(byte[] decryptedPacket, LoginCrypt encryption, LoginEncryptionKey key) { DecryptedPacket = decryptedPacket; Encryption = encryption; Key = key; }
public Task Launch(IConsole console, InfusionProxy proxy, LauncherOptions options) { var proxyPort = options.GetDefaultProxyPort(); var proxyTask = proxy.Start(new ProxyStartConfig() { ServerAddress = options.ServerEndpoint, ServerEndPoint = options.ResolveServerEndpoint().Result, LocalProxyPort = proxyPort, ProtocolVersion = options.ProtocolVersion, Encryption = options.Official.Encryption, LoginEncryptionKey = LoginEncryptionKey.FromVersion(options.Official.EncryptionVersion) }); var ultimaExecutableInfo = new FileInfo(options.Official.ClientExePath); if (!ultimaExecutableInfo.Exists) { console.Error($"File {ultimaExecutableInfo.FullName} doesn't exist."); return(proxyTask); } var workingDirectory = ultimaExecutableInfo.DirectoryName; var loginConfiguration = new LoginConfiguration(workingDirectory); console.Info($"Configuring server address: {loginConfiguration.ConfigFile}"); loginConfiguration.SetServerAddress("127.0.0.1", proxyPort); var ultimaConfiguration = new UltimaConfiguration(workingDirectory); console.Info($"Configuring user name and password: {ultimaConfiguration.ConfigFile}"); if (!string.IsNullOrEmpty(options.UserName)) { ultimaConfiguration.SetUserName(options.UserName); } if (!string.IsNullOrEmpty(options.Password)) { ultimaConfiguration.SetPassword(options.EncryptPassword()); } console.Info($"Staring {ultimaExecutableInfo.FullName} from {workingDirectory}"); var info = new ProcessStartInfo(ultimaExecutableInfo.FullName) { WorkingDirectory = workingDirectory }; var ultimaClientProcess = Process.Start(info); if (ultimaClientProcess == null) { console.Error($"Cannot start {ultimaExecutableInfo.FullName}."); return(proxyTask); } ClientProcessWatcher.Watch(ultimaClientProcess); proxy.SetClientWindowHandle(ultimaClientProcess); return(proxyTask); }