public MainFrm() { InitializeComponent(); _connected = Connected; _disconnected = Disconnected; _haltables = new List <IHaltable>(); _receivers = new List <IReceiver>(); GameData = new HGameData(); Connection = new HConnection(); Connection.Connected += Connected; Connection.Disconnected += Disconnected; Connection.DataOutgoing += DataOutgoing; Connection.DataIncoming += DataIncoming; ConnectionPg = new ConnectionPage(this, ConnectionTab); InjectionPg = new InjectionPage(this, InjectionTab); ToolboxPg = new ToolboxPage(this, ToolboxTab); ModulesPg = new ModulesPage(this, ModulesTab); AboutPg = new AboutPage(this, AboutTab); PacketLoggerUI = new PacketLoggerFrm(this); _haltables.Add(ModulesPg); _haltables.Add(PacketLoggerUI); _haltables.Add(InjectionPg.FiltersPg); _haltables.Add(InjectionPg.SchedulerPg); _receivers.Add(ModulesPg); _receivers.Add(InjectionPg.FiltersPg); _receivers.Add(ConnectionPg.HandshakeMngr); _receivers.Add(PacketLoggerUI); }
public void Synchronize(HGameData gameData) { foreach (ISynchronizer synchronizer in _synchronizers) { synchronizer.Synchronize(gameData); } }
public MainFrm() { InitializeComponent(); _connected = Connected; _disconnected = Disconnected; _haltables = new List <IHaltable>(); _receivers = new List <IReceiver>(); _actions = new Dictionary <Keys, Action>(); _avatarCache = new Dictionary <string, Bitmap>(); _profileCache = new Dictionary <HHotel, Dictionary <string, HProfile> >(); GameData = new HGameData(); Connection = new HConnection(); Connection.Connected += Connected; Connection.DataOutgoing += HandleData; Connection.DataIncoming += HandleData; Connection.Disconnected += Disconnected; Hook = new KeyboardHook(); Hook.HotkeyActivated += Hook_HotkeyActivated; InjectionPg = new InjectionPage(this, InjectionTab); ToolboxPg = new ToolboxPage(this, ToolboxTab); ModulesPg = new ModulesPage(this, ModulesTab); AboutPg = new AboutPage(this, AboutTab); PacketLoggerUI = new PacketLoggerFrm(this); LoadHaltables(); LoadReceivers(); AssignMasters(); }
public void Synchronize(HGameData gameData) { foreach (ModuleInfo module in GetInitializedModules()) { module.Instance.Synchronize(gameData); } }
static Program() { GameData = new HGameData(); Connection = new HConnection(); Connection.DataOutgoing += DataOutgoing; Connection.DataIncoming += DataIncoming; }
public Contractor(IHConnection connection, HGameData gameData) { _connection = connection; _extensions = new List <IExtension>(); Extensions = new ReadOnlyCollection <IExtension>(_extensions); _extensionsRunning = new List <IExtension>(); ExtensionsRunning = new ReadOnlyCollection <IExtension>(_extensionsRunning); GameData = gameData; if (connection != null && !string.IsNullOrEmpty(connection.Host)) { Hotel = SKore.ToHotel(connection.Host); } }
public App() { _haltables = new List <IHaltable>(); _synchronizers = new List <ISynchronizer>(); _receivers = new SortedList <int, IReceiver>(); DispatcherUnhandledException += UnhandledException; GameData = new HGameData(); Connection = new HConnection(); Connection.Connected += Connected; Connection.DataOutgoing += HandleData; Connection.DataIncoming += HandleData; Connection.Disconnected += Disconnected; }
public bool ModifyGameData(HGameData gameData) { bool possiblyModified = false; ModuleItem[] moduleItems = Contractor.GetModuleItems(); foreach (ModuleItem moduleItem in moduleItems) { if (moduleItem.IsInitialized && moduleItem.Extension != null) { moduleItem.Extension.ModifyGameData(gameData); possiblyModified = true; } } return(possiblyModified); }
public Program() { Eavesdropper.Terminate(); Eavesdropper.Certifier = new CertificateManager("HabboGallery", "HabboGallery Root Certificate"); DataDirectory = CreateDataDirectory(); ProgramDirectory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); _configPath = Path.Combine(DataDirectory.FullName, "config.json"); Resources = new HGResources(); Configuration = HGConfiguration.Create(_configPath); Api = new ApiClient(new Uri(Constants.BASE_URL)); GameData = new HGameData(); Connection = new HConnection(); }
public MainFrm() { InitializeComponent(); _connected = Connected; _disconnected = Disconnected; _haltables = new List <IHaltable>(); _receivers = new List <IReceiver>(); _actions = new Dictionary <Keys, Action>(); _avatarCache = new Dictionary <string, Bitmap>(); _userCache = new Dictionary <HHotel, Dictionary <string, HUser> >(); In = new Incoming(); Out = new Outgoing(); GameData = new HGameData(); Connection = new HConnection(); Connection.Connected += Connected; Connection.DataOutgoing += HandleData; Connection.DataIncoming += HandleData; Connection.Disconnected += Disconnected; Hook = new KeyboardHook(); Hook.HotkeyActivated += Hook_HotkeyActivated; ConnectionPg = new ConnectionPage(this, ConnectionTab); InjectionPg = new InjectionPage(this, InjectionTab); ToolboxPg = new ToolboxPage(this, ToolboxTab); ModulesPg = new ModulesPage(this, ModulesTab); AboutPg = new AboutPage(this, AboutTab); PacketLoggerUI = new PacketLoggerFrm(this); _haltables.Add(ModulesPg); _haltables.Add(PacketLoggerUI); _haltables.Add(InjectionPg.FiltersPg); _haltables.Add(InjectionPg.SchedulerPg); _receivers.Add(ModulesPg); _receivers.Add(InjectionPg.FiltersPg); _receivers.Add(ConnectionPg); _receivers.Add(PacketLoggerUI); Connection.ListenPort = (int)Program.Settings["ConnectionListenPort"]; }
public bool ModifyGameData(HGameData gameData) { bool possiblyModified = false; ModuleItem[] moduleItems = Contractor.GetModuleItems(); if (Contractor.RemoteModule != null) { Contractor.RemoteModule.SendPacketAsync(2, gameData.Source); } foreach (ModuleItem moduleItem in moduleItems) { if (moduleItem.IsInitialized && moduleItem.Instance != null) { moduleItem.Instance.ModifyGameData(gameData); possiblyModified = true; } } return(possiblyModified); }
public Program() { _haltables = new List <IHaltable>(); _receivers = new SortedList <int, IReceiver>(); _hotkeyActions = new Dictionary <Keys, Action>(); GameData = new HGameData(); Connection = new HConnection(); Connection.Connected += Connected; Connection.DataOutgoing += HandleData; Connection.DataIncoming += HandleData; Connection.Disconnected += Disconnected; Hook = new KeyboardHook(); Hook.HotkeyPressed += HotkeyPressed; Config = new TConfiguration(); Eavesdropper.Terminate(); Eavesdropper.Certifier = new CertificateManager("Tanji", "Tanji Certificate Authority"); Eavesdropper.Overrides.AddRange(Config.ProxyOverrides); }
void IModule.Synchronize(HGameData gameData) { Synchronize(gameData); _service.Synchronize(gameData); }
private void ExtractGameData(object sender, ResponseInterceptedEventArgs e) { if (e.Response.ContentType != "text/html") { return; } if (GameData != null) { return; } string responseBody = Encoding.UTF8.GetString(e.Payload); if (responseBody.Contains("swfobject.embedSWF") && responseBody.Contains("connection.info.host")) { Eavesdropper.ResponseIntercepted -= ExtractGameData; try { GameData = new HGameData(responseBody); Hotel = SKore.ToHotel(GameData.InfoHost); var clientUri = new Uri(GameData["flash.client.url"]); string clientPath = clientUri.Segments[2].TrimEnd('/'); Task <bool> gameClientVerifierTask = VerifyGameClientAsync($"{_modifiedClientsDir.FullName}\\{clientPath}\\Habbo.swf"); if (e.Response.ResponseUri.Segments.Length > 2) { // TODO: Set uniqueId somewhere. //GameData.UniqueId = // e.Response.ResponseUri.Segments[2].TrimEnd('/'); } string embeddedSwf = responseBody.GetChild("embedSWF(", ','); string nonCachedSwf = $"{embeddedSwf} + \"?{DateTime.Now.Ticks}-Tanji\""; responseBody = responseBody.Replace( "embedSWF(" + embeddedSwf, "embedSWF(" + nonCachedSwf); e.Payload = Encoding.UTF8.GetBytes(responseBody); var resourceKeys = ResourceReplacements.Keys.ToArray(); foreach (string resourceKey in resourceKeys) { string realValue = GameData[resourceKey] .Replace("\\/", "/"); string fakeValue = ResourceReplacements[resourceKey]; ResourceReplacements.Remove(resourceKey); ResourceReplacements[realValue] = fakeValue; } if (gameClientVerifierTask.Result) { SetStatus(TanjiState.InjectingClient); Eavesdropper.RequestIntercepted += InjectClient; } else { SetStatus(TanjiState.InterceptingClient); Eavesdropper.ResponseIntercepted += ReplaceClient; } } catch (Exception ex) { WriteLog(ex); } finally { if (GameData == null) { Eavesdropper.ResponseIntercepted += ExtractGameData; } } } }
public void Synchronize(HGameData gameData) { _module.Node.SendPacketAsync(4, gameData.Source); }
private async Task ReceiveRemoteContractorDataAsync() { try { HMessage packet = await _remoteContractor.ReceivePacketAsync().ConfigureAwait(false); if (packet == null) { Environment.Exit(0); } #region Switch: packet.Header switch (packet.Header) { case 0: { _initStep++; _hotel = (HHotel)packet.ReadShort(); break; } case 1: { _initStep++; _in = new Incoming(); _out = new Outgoing(); string location = packet.ReadString(); if (!string.IsNullOrWhiteSpace(location)) { _game = new HGame(location); _game.Disassemble(); _game.GenerateMessageHashes(); if (packet.Readable > 0) { string hashesPath = packet.ReadString(); _in.Load(_game, hashesPath); _out.Load(_game, hashesPath); } _module.ModifyGame(_game); } break; } case 2: { _initStep++; _gameData = new HGameData(packet.ReadString()); _module.ModifyGameData(_gameData); break; } case 3: { _initStep++; var connection = (ContractorProxy)_connection; connection.Port = packet.ReadShort(); connection.Host = packet.ReadString(); connection.Address = packet.ReadString(); break; } case 4: case 5: { var destination = (HDestination)(packet.Header - 4); string stamp = packet.ReadString(); int step = packet.ReadInteger(); bool isBlocked = packet.ReadBoolean(); int dataLength = packet.ReadInteger(); byte[] data = packet.ReadBytes(dataLength); var interPacket = new HMessage(data, destination); var args = new DataInterceptedEventArgs(interPacket, step, (destination == HDestination.Server)); try { if (destination == HDestination.Server) { _module.HandleOutgoing(args); } else { _module.HandleIncoming(args); } } finally { await SendInterceptedDataResponseAsync( stamp, args).ConfigureAwait(false); } break; } } #endregion if (_initStep == 4) { _initializationSource?.SetResult(true); } } finally { Task receiveRemContDataTask = ReceiveRemoteContractorDataAsync(); } }
public virtual void ModifyGameData(HGameData gameData) { }
void IModule.ModifyGameData(HGameData gameData) { ModifyGameData(gameData); }
public bool Equals(HGameData other) { return(string.Equals(_variables, other._variables) && string.Equals(_texts, other._texts) && string.Equals(_figurePartList, other._figurePartList) && string.Equals(_overrideTexts, other._overrideTexts) && string.Equals(_overrideVariables, other._overrideVariables) && string.Equals(_productDataLoadUrl, other._productDataLoadUrl) && string.Equals(_furniDataLoadUrl, other._furniDataLoadUrl)); }
public virtual void Synchronize(HGameData gameData) { }
private byte[] ProcessResponse(byte[] payload, bool isFlash) { if (UseCustomClient && isFlash && payload.Length > 3000000) { if (!_replaceKeys) { payload = _flash.ToBytes(); } else { _flash = new ShockwaveFlash(payload); ReplaceRsaKeys(_flash); payload = _flash.ToBytes(); string clientPath = Path.Combine("Patched Clients", GameData.FlashClientBuild + ".swf"); Task.Factory.StartNew(() => _flash.Save(clientPath, true)); } FiddlerApplication.Shutdown(); StatusTxt.BeginAnimation("Connecting{0} | Port: " + GameData.Port, "..."); return(payload); } else if (TanjiMode.IsManual) { return(payload); } string response = Encoding.UTF8.GetString(payload); if (response.Contains("connection.info.host") && response.Contains("connection.info.port")) { GameData = HGameData.Parse(response); if (!UseCustomClient) { string patchedClientPath = Path.Combine("Patched Clients", GameData.FlashClientBuild + ".swf"); if (!File.Exists(patchedClientPath)) { UseCustomClient = _replaceKeys = true; } else { LoadGameClient(patchedClientPath); } } if (!UseCustomClient) { FiddlerApplication.Shutdown(); StatusTxt.BeginAnimation("Connecting{0} | Port: " + GameData.Port, "..."); } else if (_replaceKeys) { StatusTxt.BeginAnimation("Modifying Client{0}", "..."); } else { StatusTxt.BeginAnimation("Replacing Client{0}", "..."); } _main.Game.Connect(true, GameData.Host, GameData.Port); response = response.Replace("/Habbo.swf", "/Habbo.swf?" + _numberGenerator.Next()); payload = Encoding.UTF8.GetBytes(response); } return(payload); }