private static void SetClientRequestHeaders(DownloadRequest downloadRequest, AppSettings appSettings)
 {
     if (downloadRequest.MustAuthenticate)
     {
         var byteArray = Encoding.ASCII.GetBytes(appSettings.Username + ":" + ProtectionService.GetUnprotectedPassword(appSettings.Password));
         Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
     }
 }
        private void BtnDialogOk_Click(object sender, RoutedEventArgs e)
        {
            _appSettings.Password = ProtectionService.CreateProtectedPassword(txtPassword.Password);
            _appSettings.Username = txtUsername.Text;
            ApplicationService.WriteToAppSettingsFile(_appSettings);

            Close();
        }
        public SettingsDialog()
        {
            InitializeComponent();

            AppSettings appSettings = ApplicationService.GetAppSettings();

            txtUsername.Text     = appSettings.Username;
            txtPassword.Password = ProtectionService.GetUnprotectedPassword(appSettings.Password);
            downloadDirectory    = appSettings.DownloadDirectory;
        }
        public SettingsDialog()
        {
            _appSettings = ApplicationService.GetAppSettings();

            InitializeComponent();

            txtUsername.Text            = _appSettings.Username;
            txtPassword.Password        = ProtectionService.GetUnprotectedPassword(_appSettings.Password);
            ConfigFilesList.ItemsSource = ApplicationService.NameConfigFiles();
        }
        private void BtnDialogOk_Click(object sender, RoutedEventArgs e)
        {
            AppSettings appSettings = new AppSettings();

            appSettings.Password          = ProtectionService.CreateProtectedPassword(txtPassword.Password);
            appSettings.Username          = txtUsername.Text;
            appSettings.DownloadDirectory = FolderPickerDialogBox.DirectoryPath;
            ApplicationService.WriteToAppSettingsFile(appSettings);

            this.Close();
        }
        private static void SetClientRequestHeaders(DownloadRequest downloadRequest, AppSettings appSettings)
        {
            if (!Client.DefaultRequestHeaders.Any())
            {
                Client.DefaultRequestHeaders.UserAgent.ParseAdd($"GeonorgeNedlastingsklient/{Assembly.GetExecutingAssembly().GetName().Version.ToString()}");
            }

            if (downloadRequest.MustAuthenticate)
            {
                var byteArray = Encoding.ASCII.GetBytes(appSettings.Username + ":" + ProtectionService.GetUnprotectedPassword(appSettings.Password));
                Client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
            }
        }
Пример #7
0
        public Auth(TcpClient tcpClient)
        {
            try
            {
                _client = tcpClient;

                /* Protection */
                string IPv4 = Convert.ToString(
                    _client.Client.RemoteEndPoint.Serialize()[4] + "." +
                    _client.Client.RemoteEndPoint.Serialize()[5] + "." +
                    _client.Client.RemoteEndPoint.Serialize()[6] + "." +
                    _client.Client.RemoteEndPoint.Serialize()[7]
                    );

                ProtectionService.addAttack(IPv4);

                if (ProtectionService.attackers.ContainsKey(IPv4))
                {
                    if (ProtectionService.attackers[IPv4].Status == true)
                    {
                        if (ProtectionService.attackers[IPv4].Connect == false)
                        {
                            ProtectionService.attackers[IPv4].Connect = true;
                            _client.Close();
                            Logger.Protection("[Protection] Client " + IPv4 + " aborted.");
                        }
                    }
                    else
                    {
                        _stream  = tcpClient.GetStream();
                        _address = tcpClient.Client.RemoteEndPoint;
                        new Thread(init).Start();
                        new Thread(ReadImpl).Start();
                        Logger.Info("[Network] Client " + IPv4 + " connected.");
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error("[Network] Error: {0}", e);
            }
        }
Пример #8
0
        static void Main(string[] args)
        {
            Console.Title = "Point Blank Auth Server";
            Logger.Info("===============================================================================");
            Logger.Info("Point Blank Auth Server");
            Logger.Info("Develop OZ-Network.RU - 2016");
            Logger.Info("===============================================================================");
            ConfigModel.Load();
            Logger.Warn("Load XML=======================================================================");
            TutorialParser.Load();
            GameServersParser.Load();
            Logger.Warn("Load DataBase==================================================================");
            Connector.Connect();
            ClansTable.LoadTable();
            AccountTable.LoadTable();
            ItemsTable.LoadTable();
            PlayersTable.LoadTable();
            QuestsTable.LoadTable();
            PlayersConfigTable.LoadTable();
            PlayersStatsTable.LoadTable();
            TitlesTable.LoadTable();
            PlayerEquipTable.LoadTable();
            PlayersMedalsTable.LoadTable();
            FriendsTable.LoadTable();
            Logger.Warn("Load Protection================================================================");
            ProtectionService.Initialization();
            Logger.Warn("Load Network===================================================================");
            NetworkS.Load();

            int Mask = 0;

            Mask |= 1 << (int)Maps.StageId.TD_PORTAKABA;
            Mask |= 1 << (int)Maps.StageId.TD_REDROCK;

            Console.WriteLine(Mask);
        }