コード例 #1
0
        private bool RsaKeyVerifier(HKeyExchange handshakee, string signedPrime, string signedGenerator, Bitmap banner, string token)
        {
            foreach (string[] fakeKeys in RsaKeys)
            {
                try
                {
                    int    exponent        = int.Parse(fakeKeys[0]);
                    string modulus         = fakeKeys[1];
                    string privateExponent = fakeKeys[2];

                    _fakeClient = new HKeyExchange(exponent, modulus);
                    _fakeServer = new HKeyExchange(exponent, modulus, privateExponent);

                    if (banner == null || string.IsNullOrWhiteSpace(token))
                    {
                        _fakeClient.DoHandshake(signedPrime, signedGenerator);
                    }
                    else
                    {
                        _fakeClient.DoHandshake(banner, token);
                    }
                    return(true);
                }
                catch { }
            }
            return(false);
        }
コード例 #2
0
        private void Game_Connected(object sender, EventArgs e)
        {
            BeginInvoke(new MethodInvoker(() => _tanjiConnect.Close()));
            InitializeContractor();

            _fakeClient = new HKeyExchange(Exponent, Modulus);
            _fakeServer = new HKeyExchange(FAKE_EXPONENT, FAKE_MODULUS, FAKE_PRIVATE_EXPONENT);

            _game.Disconnected += Game_Disconnected;
        }
コード例 #3
0
ファイル: Connection.cs プロジェクト: MelSoJelly/Habbo-Bot
        public Connection(string sso, MainFrm main, int id, string server = null, int port = 0)
        {
            _sso         = sso;
            _main        = main;
            Id           = id;
            _keyExchange = new HKeyExchange(Exponent, Modulus);
            _rand        = new Random();
            _tentativas  = 0;

            _proxyServer = server;
            _proxyPort   = port;
        }
コード例 #4
0
        public void HookGameEvents()
        {
            if (Main.Game.Protocol == HProtocol.Modern &&
                (_tanjiConnect.UseCustomClient || _tanjiConnect.TanjiMode == TanjiMode.Automatic))
            {
                _fakeClient = new HKeyExchange(RealExponent, RealModulus);
                _fakeServer = new HKeyExchange(int.Parse(RsaKeys[0][0]), RsaKeys[0][1], RsaKeys[0][2]);

                Game.DataToClient += Handshake_ToClient;
                Game.DataToServer += Handshake_ToServer;
            }
            else
            {
                Game.DataToClient += Game_DataToClient;
                Game.DataToServer += Game_DataToServer;
            }
            Game.Disconnected += Game_Disconnected;
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: proxymoron/HabBit
        static void HandleArguments(string[] args)
        {
            if (args.Length < 1)
            {
                string commands = string.Empty;
                commands += RequestFile();

                if (Ask("Would you like to disable RC4 encryption?"))
                {
                    commands += "\ndisablerc4";
                }

                if (Ask($"Default Exponent(e): {Exponent}\r\nDefault Modulus(n): {KeepEnds(Modulus, 25)}\r\nWould you like to use your own RSA keys?"))
                {
                    if (Ask("Would you like to generate a new pair of RSA keys? | "))
                    {
                        WriteLine("Generating 1024-bit keys...");
                        var exchange = HKeyExchange.Create(1024);

                        string e = exchange.Exponent.ToString("x");
                        Console.WriteLine("Exponenet(e): " + e);
                        commands += "\ne:" + e;

                        string n = exchange.Modulus.ToString("x");
                        Console.WriteLine("Modulus(n): " + KeepEnds(n, 25));
                        commands += "\nn:" + n;

                        PrivateExponent = exchange.PrivateExponent.ToString("x");
                        Console.WriteLine("Private Exponent(d): " + KeepEnds(PrivateExponent, 25));
                    }
                    else
                    {
                        Console.Write("Custom Exponent(e): ");
                        commands += ("\ne:" + Console.ReadLine());

                        Console.Write("Custom Modulus(n): ");
                        commands += ("\nn:" + Console.ReadLine());
                    }
                    Console.WriteLine("---------------");
                }

                if (!Ask("Would you like to compress the file once reconstruction is finished?"))
                {
                    commands += "\nskipcompress";
                }

                if (Ask("Example: Outgoing[XXXX](%HASH%): _-AB(arg1:int, arg2:String, arg3:Boolean)\r\nWould you like to dump a file containing a list of headers paired with their associated type/handler?"))
                {
                    commands += "\ndumpheaders";
                    if (Ask("Example #1: connection.send(new _-AB());\r\nExample #2: addHabboConnectionMessageEvent(new _-CD(this._-EF));\r\nWould to like to include references of the message type in the hashing process?"))
                    {
                        commands += "\nreferencescan";
                    }
                }
                args = commands.Split('\n');
                Console.Clear();
            }

            Client = new HFlash(args[0]);
            for (int i = 1; i < args.Length; i++)
            {
                string[] values = args[i].Split(':');
                switch (values[0].ToLower())
                {
                case "e":
                {
                    int    exponent = 0;
                    string e        = values[1];
                    if (int.TryParse(e, NumberStyles.HexNumber,
                                     CultureInfo.InvariantCulture, out exponent))
                    {
                        IsCustomE = (exponent != Exponent);
                        Exponent  = exponent;
                    }
                    break;
                }

                case "n":
                {
                    string n = values[1];
                    IsCustomN = (n != Modulus);
                    Modulus   = n;
                    break;
                }

                case "disablerc4":
                    DisableRC4 = true;
                    break;

                case "skipcompress":
                    CompressClient = false;
                    break;

                case "dumpheaders":
                    DumpHeaders = true;
                    break;

                case "referencescan":
                    ReferenceScan = true;
                    break;
                }
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: ErrorMaker/HabBit-2
        static string[] GetArguments()
        {
            var argBuilder = new StringBuilder();

            argBuilder.AppendLine(GetFile());
            if (Ask($"Would you like to use custom RSA keys?"))
            {
                argBuilder.AppendLine("-rsa");
                if (Ask("Would you like to generate new RSA keys?"))
                {
                    var exchange = HKeyExchange.Create(1024);

                    string e = exchange.Exponent.ToString("x");
                    Console.WriteLine("Exponent(e): " + e);
                    argBuilder.AppendLine(e);

                    string n = exchange.Modulus.ToString("x");
                    Console.WriteLine("Modulus(n): " + n);
                    argBuilder.AppendLine(n);

                    PrivateExponent = exchange.PrivateExponent.ToString("x");
                    Console.WriteLine("Private Exponent(d): " + PrivateExponent);
                }
                else
                {
                    PrivateExponent = "<Unknown>";

                    Console.Write("Custom Exponent(e): ");
                    argBuilder.AppendLine(Console.ReadLine());

                    Console.Write("Custom Modulus(n): ");
                    argBuilder.AppendLine(Console.ReadLine());
                }
                Console.WriteLine("---------------");
            }

            if (Ask("Would you like to enable compression?"))
            {
                argBuilder.AppendLine("-compress");
            }

            if (Ask("Would you like to update your Outgoing/Incoming header files?"))
            {
                argBuilder.AppendLine("-updateh");
                Console.CursorVisible = true;

                Console.Write("Previous Client: ");
                argBuilder.AppendLine(Console.ReadLine());

                Console.Write("Outgoing Headers File(Relative to client): ");
                argBuilder.AppendLine(Console.ReadLine());

                Console.Write("Incoming Headers File(Relative to client): ");
                argBuilder.AppendLine(Console.ReadLine());

                Console.CursorVisible = false;
                Console.WriteLine("---------------");
            }
            else if (Ask("Would you like to dump header/message information?"))
            {
                argBuilder.AppendLine("-dumph");
            }

            Console.Clear();
            return(argBuilder.ToString().Split(
                       new string[] { "\r\n" },
                       StringSplitOptions.RemoveEmptyEntries));
        }
コード例 #7
0
 private void InitializeKeys()
 {
     _remoteKeys = new HKeyExchange(REAL_EXPONENT, REAL_MODULUS);
     _localKeys  = new HKeyExchange(FAKE_EXPONENT, FAKE_MODULUS, FAKE_PRIVATE_EXPONENT);
 }