Beispiel #1
0
        public void Connect()
        {
            Eavesdropper.ResponseIntercepted += ExtractGameData;
            Eavesdropper.Initiate(ProxyPort);

            SetStatus(TanjiState.ExtractingGameData);
        }
Beispiel #2
0
        private void DoAutomaticConnect()
        {
            Eavesdropper.EavesdropperResponse += ExtractHostPort;
            Eavesdropper.Initiate(8080);

            StatusTxt.SetDotAnimation("Extracting Host/Port");
        }
Beispiel #3
0
        private void Connect_Click(object sender, EventArgs e)
        {
            ushort port;
            string host = GameHostTxt.Text.Trim();
            bool   portConversionSuccess = ushort.TryParse(GamePortTxt.Text.Trim(), out port);

            switch (TanjiMode)
            {
            case TanjiMode.Automatic:
            {
                StartAnimation("Extracting Host/Port");

                if (!string.IsNullOrWhiteSpace(host))
                {
                    _maskHost = host.ToLower();
                }
                if (portConversionSuccess)
                {
                    _maskPort = port;
                }

                Eavesdropper.Initiate(EavesdropperPort);
                break;
            }

            case TanjiMode.Manual:
            {
                if (string.IsNullOrWhiteSpace(host) || !portConversionSuccess)
                {
                    const string message = "You've specified invalid details into the connection input boxes, please correct these issues before you can continue.";
                    MessageBox.Show(message, Main.TanjiError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (UseCustomClient)
                {
                    Eavesdropper.Initiate(EavesdropperPort);
                }

                StartAnimation("Connecting% | Port: " + port);

                Main.Game            = new HConnection(host, port);
                Main.Game.Connected += Game_Connected;
                Main.Game.Connect(true);
                break;
            }
            }

            ProcessBtn.Text   = "Cancel";
            ProcessBtn.Click -= Connect_Click;
            ProcessBtn.Click += Cancel_Click;
        }
Beispiel #4
0
        private void Run()
        {
            Eavesdropper.RequestInterceptedAsync  += RequestInterceptedAsync;
            Eavesdropper.ResponseInterceptedAsync += ResponseInterceptedAsync;
            Eavesdropper.Certifier.CreateTrustedRootCertificate();

            Eavesdropper.Initiate(8282);
            Console.Title = $"Eavesdrop.Sandbox({8282}) - Press any key to exit...";

            Console.ReadLine();
            Eavesdropper.Terminate();
            Console.WriteLine("Eavesdropper has been terminated! | " + DateTime.Now);
        }
Beispiel #5
0
        public static void Main(string[] args)
        {
            if (Eavesdropper.Certifier.CreateTrustedRootCertificate())
            {
                Eavesdropper.RequestInterceptedAsync  += Eavesdropper_RequestInterceptedAsync;
                Eavesdropper.ResponseInterceptedAsync += Eavesdropper_ResponseInterceptedAsync;

                Eavesdropper.Initiate(8686, Interceptors.Default);
                Console.WriteLine("Press any key to terminate the application at any time...");
            }

            Console.ReadKey();
            Eavesdropper.Terminate();
        }
        private void Initialize()
        {
            Connection.DataOutgoing += HandleOutgoing;
            Connection.DataIncoming += HandleIncoming;

            Connection.Connected    += ConnectionOpened;
            Connection.Disconnected += ConnectionClosed;

            if (Eavesdropper.Certifier.CreateTrustedRootCertificate())
            {
                Eavesdropper.ResponseInterceptedAsync += InterceptClientPageAsync;

                Eavesdropper.Initiate(Constants.PROXY_PORT);
                _ui.SetStatusMessage(Constants.INTERCEPTING_CLIENT_PAGE);
            }
        }
Beispiel #7
0
        private void Connect(object obj)
        {
            if (App.Master.Connection.IsConnected)
            {
                if (MessageBox.Show("Are you sure you want to disconnect from the current session?", "Tanji - Alert!",
                                    MessageBoxButton.YesNo,
                                    MessageBoxImage.Asterisk) == MessageBoxResult.Yes)
                {
                    App.Master.Connection.Disconnect();
                }
                else
                {
                    return;
                }
            }

            if (!IsAutomaticServerExtraction && HotelServer == null)
            {
                MessageBoxResult result = MessageBox.Show("Hotel server endpoint must be provided; Would you like to attempt an automatic extraction of the endpoint instead?",
                                                          "Tanji - Alert!", MessageBoxButton.YesNo, MessageBoxImage.Asterisk);

                if (result == MessageBoxResult.Yes)
                {
                    IsAutomaticServerExtraction = true;
                }
                else
                {
                    return;
                }
            }

            if (Eavesdropper.Certifier.CreateTrustedRootCertificate())
            {
                Eavesdropper.ResponseIntercepted += InterceptClientPage;
                Eavesdropper.Initiate(ProxyPort);

                Status = INTERCEPTING_CLIENT_PAGE_DATA;
            }
        }
Beispiel #8
0
        private void ConnectBtn_Click(object sender, EventArgs e)
        {
            bool isCancelling = ConnectBtn.Text == "Cancel";

            ConnectBtn.Text = isCancelling ? "Connect" : "Cancel";

            if (isCancelling)
            {
                ResetSetup();
                _main.Game.Disconnect();
                return;
            }

            _main.Modulus  = ModulusTxt.Text;
            _main.Exponent = int.Parse(string.IsNullOrEmpty(ExponentTxt.Text)
                ? "0" : ExponentTxt.Text);

            int    gamePort           = 0;
            string gameHost           = GameHostTxt.Text.ToLower();
            bool   portConvertSuccess = int.TryParse(GamePortTxt.Text, out gamePort);

            if (TanjiMode.IsManual)
            {
                if (UseCustomClient)
                {
                    Eavesdropper.Initiate();
                }

                _main.Game.Connect(true, gameHost, gamePort);
                StatusTxt.BeginAnimation("Connecting{0} | Port: " + GamePortTxt.Text, "...");
            }
            else
            {
                FiddlerApplication.Startup(8081, FiddlerCoreStartupFlags.Default);
                StatusTxt.BeginAnimation("Extracting Host/Port{0}", "...");
            }
        }
Beispiel #9
0
 public void Connect()
 {
     Eavesdropper.ResponseIntercepted += ExtractGameData;
     Eavesdropper.Initiate(ProxyPort);
     State = EXTRACTING_GAME_DATA;
 }
Beispiel #10
0
        private void DataIncoming(object sender, InterceptedEventArgs e)
        {
            try
            {
                switch (e.Step - _inStepOffset)
                {
                case 1:
                {
                    if (RealExponent == 0)
                    {
                        RealExponent = DEFAULT_REAL_EXPONENT;
                    }

                    if (string.IsNullOrWhiteSpace(RealModulus))
                    {
                        RealModulus = DEFAULT_REAL_MODULUS;
                    }

                    Remote.Exchange = new HKeyExchange(RealExponent, RealModulus);
                    Local.Exchange  = new HKeyExchange(FAKE_EXPONENT, FAKE_MODULUS, FAKE_PRIVATE_EXPONENT);

                    string possibleSignedPrime = e.Packet.ReadString();
                    if (!e.Packet.CanRead <string>())
                    {
                        _bannerToken = possibleSignedPrime;

                        Eavesdropper.EavesdropperResponse += EavesdropperResponse;
                        Eavesdropper.Initiate(8080);
                        return;
                    }
                    string signedGenerator = e.Packet.ReadString();

                    Remote.Exchange.DoHandshake(possibleSignedPrime, signedGenerator);
                    Local.Exchange.Rsa.Padding = Remote.Exchange.Rsa.Padding;

                    e.Replacement = new HMessage(e.Packet.Header,
                                                 Local.Exchange.GetSignedPrime(), Local.Exchange.GetSignedGenerator());
                    break;
                }

                case 2:
                {
                    if (e.Packet.Length < 5)
                    {
                        _inStepOffset++;
                        return;
                    }

                    _remoteKey = Remote.Exchange.GetSharedKey(e.Packet.ReadString());
                    if (_banner == null)
                    {
                        Local.Exchange.Rsa.Padding = Remote.Exchange.Rsa.Padding;
                        e.Replacement.Replace <string>(0, Local.Exchange.GetPublicKey());
                    }
                    else
                    {
                        e.Replacement = new HMessage(e.Packet.Header, "1");
                    }

                    RealExponent = 0;
                    RealModulus  = string.Empty;

                    Local.Exchange.Dispose();
                    Remote.Exchange.Dispose();

                    Local.Decrypter  = new Rc4(_localKey);
                    Remote.Decrypter = new Rc4(_remoteKey);
                    break;
                }

                case 3:
                {
                    if (Remote.IsDecryptionRequired)
                    {
                        Local.Encrypter = new Rc4(_localKey);
                    }

                    MainUI.Connection.DataIncoming -= DataIncoming;
                    break;
                }
                }
            }
            catch
            {
                MainUI.Connection.DataIncoming -= DataIncoming;
                MainUI.Connection.DataOutgoing -= DataOutgoing;
            }
            finally { e.IsBlocked = false; }
        }