public void RefreshStatus()
        {
            if (FilteringSystem.IsScheduelActive())
            {
                if (FIlterScheduelingSystem.isBlockdAt(DateTime.Now))
                {
                    statusLabel.Text      = "חסימה מתוזמנת";
                    statusLabel.ForeColor = Color.Red;

                    //Block the Internt using the service
                    ServiceAdapter.StartInternetBlocking();
                }
                else
                {
                    statusLabel.Text      = "גלישה מאופשרת";
                    statusLabel.ForeColor = Color.LimeGreen;

                    //release service's internet blocking
                    ServiceAdapter.StopInterntBlocking();
                }
            }
            else
            {
                statusLabel.Text      = "לא פעיל";
                statusLabel.ForeColor = Color.Red;
                ServiceAdapter.StopInterntBlocking();
            }
        }
 private void SaveChangesButton_Click(object sender, RoutedEventArgs e)
 {
     if (InternetBlocker.IsInternetReachable())
     {
         try
         {
             FilteringSystem.GetCurrentFilteringSettings().isSocialNetworksBlocked = _isSocialNetworksBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isGamblingBlocked       = _isGamblingBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isNewsBlocked           = _isNewsBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isSportBlocked          = _isSportBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isVideoPlayersBlocked   = _isVideoPlayersBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isDatingBlocked         = _isDatingBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isGamesBlocked          = _isGamesBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isPhotosStackBlocked    = _isPhotosStackBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isLifeStyleBlocked      = _isLifeStyleBlocked;
             FilteringSystem.GetCurrentFilteringSettings().isViolenceBlocked       = _isViolenceBlocked;
             FilteringSystem.SaveChanges();
             HostsFileAdapter.Write(FilteringSystem.GetCurrentFilteringSettings());
             CustomMessageBox.ShowDialog(Window, "השינויים נשמרו בהצלחה!", "השינויים נשמרו", CustomMessageBox.CustomMessageBoxTypes.Success, "המשך");
         }
         catch (Exception ex)
         {
             CustomMessageBox.ShowDialog(Window, "כתיבת הנתונים לא הצליחה" + Environment.NewLine + ex.Message, "שגיאה", CustomMessageBox.CustomMessageBoxTypes.Success, "המשך");
             ResetToggles();
         }
     }
     else
     {
         CustomMessageBox.ShowDialog(Window, "על מנת לעדכן את הקטגוריות יש צורך בחיבור לאינטרנט.", "יש צורך בחיבור לאינטרנט", CustomMessageBox.CustomMessageBoxTypes.Stop, "הבנתי");
         ResetToggles();
     }
 }
Example #3
0
 public void ResetGUI()
 {
     SafeServer = FilteringSystem.GetCurrentFilteringSettings().isSafeServerOn;
     AdBlock    = FilteringSystem.GetCurrentFilteringSettings().isAdBlockOn;
     filteringLevelComboBox.SelectedIndex = (int)FilteringSystem.GetCurrentFilteringSettings()._youtubeFilteringLevel;
     UpdatePageGUI();
 }
        private void SaveChanges()
        {
            Boolean   savedSuccessfuly = false;
            int       attempts         = 0;
            Exception error            = null;

            while (!savedSuccessfuly)
            {
                if (attempts < 4)
                {
                    try
                    {
                        FilteringSystem.GetCurrentFilteringSettings().SetAdminPassword(passwordTB.Password);
                        FilteringSystem.GetCurrentFilteringSettings().SetAdminName(nameTB.Text);
                        FilteringSystem.GetCurrentFilteringSettings().SetAdminMail(mailTB.Text);
                        FilteringSystem.GetCurrentFilteringSettings().SetComputerName(pcNameTB.Text);
                        FilteringSystem.SaveChanges();
                        Window.SetWelcomeLabel();
                        savedSuccessfuly = true;
                        CustomMessageBox.ShowDialog(Window, "השינויים נשמרו בהצלחה!", "השינויים נשמרו", CustomMessageBox.CustomMessageBoxTypes.Success, "המשך");
                    }
                    catch (Exception e)
                    {
                        error = e;
                        attempts++;
                        System.Threading.Thread.Sleep(200);
                    }
                }
                else
                {
                    CustomMessageBox.ShowDialog(null, error.Message, "שגיאה בשמירת נתונים", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
                    break;
                }
            }
        }
Example #5
0
        internal static void SendPasswordReminderMail()
        {
            string subject, body;

            new Thread(() =>
            {
                subject           = "F4E - תזכורת לסיסמה שנשכחה";
                Boolean sended    = false;
                DateTime Time_Now = DateTime.Now;
                while (!sended)
                {
                    try
                    {
                        body = ReplaceCustomTagsToData(Tools.GetTextFromUri("http://f4e.mmb.org.il/mails-templets/password_reminder"), Time_Now);
                        SendCustomMail(FilteringSystem.GetCurrentFilteringSettings().GetAdminMail(), subject, body);
                        sended = true;
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message);
                        Thread.Sleep(120000);
                    }
                }
            }).Start();
        }
Example #6
0
 private void SetupBlacklist()
 {
     foreach (string url in FilteringSystem.GetCurrentFilteringSettings().GetCustomBlackList())
     {
         AddItemToListBox(url, false);
     }
 }
Example #7
0
 private void SetupExceptionsList()
 {
     foreach (string url in FilteringSystem.GetCurrentFilteringSettings().GetCustomExceptionsList())
     {
         AddItemToListBox(url, true);
     }
 }
        private void Toggle_Click(object sender, EventArgs e)
        {
            PictureBox clicked = sender as PictureBox;

            switch (clicked.Tag.ToString())
            {
            case "safe_server":
                Resources.profile.Default.safe_server = !Resources.profile.Default.safe_server;
                break;

            case "strict_youtube":
                Resources.profile.Default.strict_search = !Resources.profile.Default.strict_search;
                break;

            case "social_block":
                Resources.profile.Default.social_block = !Resources.profile.Default.social_block;
                break;

            case "gambling_block":
                Resources.profile.Default.gambling_block = !Resources.profile.Default.gambling_block;
                break;

            case "news_block":
                Resources.profile.Default.news_block = !Resources.profile.Default.news_block;
                break;

            case "ad_block":
                Resources.profile.Default.ad_block = !Resources.profile.Default.ad_block;
                break;
            }
            UpdateTogglesGUI();
            Resources.profile.Default.Save();
            FilteringSystem.UpdateSettings();
        }
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (FilteringSystem.IsAdminPassword(passTB.Text))
            {
                //Unlock the system
                Program.menuForm.unlockForm();

                //Release the internet blocking
                ServiceAdapter.CustomCommend("GUIAdapter", (int)ServiceAdapter.CustomCommends.releaseScheduelBlocking);
            }
            else
            {
                if (attempts > 1)
                {
                    attempts--;
                    attemptsLable.Text      = attempts.ToString();
                    attemptsLable.ForeColor = attempts == 1 ? System.Drawing.Color.Red : attemptsLable.ForeColor;
                    label4.ForeColor        = attempts == 1 ? System.Drawing.Color.Red : attemptsLable.ForeColor;
                }
                else
                {
                    label4.ForeColor      = System.Drawing.Color.Red;
                    label4.Text           = "התראה על שימוש בסיסמה שגויה נשלחה למנהל המערכת";
                    label5.Text           = "הגלישה ברשת במחשב זה נחסמה.";
                    attemptsLable.Visible = false;
                    label2.Visible        = false;
                    ServiceAdapter.CustomCommend("GUIAdapter", (int)ServiceAdapter.CustomCommends.startScheduelBlocking); //tell the service to bloke the internt
                    MessageBox.Show("התראה על שימוש בסיסמה שגויה נשלחה למנהל המערכת", "סיסמה שגויה!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            passTB.Text = "";
        }
 public void ResetGUI()
 {
     nameTB.Text                  = FilteringSystem.GetCurrentFilteringSettings().GetAdminName();
     passwordTB.Password          = PasswordEncryption.Decrypt(FilteringSystem.GetCurrentFilteringSettings().GetAdminPassword());
     confirmPasswordTB.Password   = passwordTB.Password;
     confirmPasswordTB.Foreground = new SolidColorBrush(Colors.LimeGreen);
     pcNameTB.Text                = FilteringSystem.GetCurrentFilteringSettings().GetComputerName();
     mailTB.Text                  = FilteringSystem.GetCurrentFilteringSettings().GetAdminMail();
 }
Example #11
0
 private void SaveChangesButton_Click(object sender, RoutedEventArgs e)
 {
     FilteringSystem.GetCurrentFilteringSettings().isSafeServerOn         = SafeServer;
     FilteringSystem.GetCurrentFilteringSettings().isAdBlockOn            = AdBlock;
     FilteringSystem.GetCurrentFilteringSettings()._youtubeFilteringLevel = (FilteringSettings.YoutubeFilteringLevels)filteringLevelComboBox.SelectedIndex;
     FilteringSystem.SaveChanges();
     HostsFileAdapter.Write(FilteringSystem.GetCurrentFilteringSettings());
     CustomMessageBox.ShowDialog(Window, "השינויים נשמרו בהצלחה!", "הגדרות סינון", CustomMessageBox.CustomMessageBoxTypes.Success, "המשך");
 }
Example #12
0
 private void UpdateTogglesGUI()
 {
     FilterStatusToggle.Image = FilteringSystem.IsOn() ? Properties.Resources.On : Properties.Resources.Off;
     if (FilteringSystem.IsOn())
     {
         scheduelStatusToggle.Image = FilteringSystem.IsScheduelActive() ? Properties.Resources.On : Properties.Resources.Off;
     }
     else
     {
         scheduelStatusToggle.Image   = Properties.Resources.Off;
         scheduelStatusToggle.Enabled = false;
     }
 }
 private void addUrlButton_Click(object sender, EventArgs e)
 {
     if (!blockedUrlListBox.Items.Contains(urlTB.Text))
     {
         Resources.profile.Default.customBlacklist.Add(urlTB.Text);
         Resources.profile.Default.Save();
         blockedUrlListBox.Items.Add(urlTB.Text);
         FilteringSystem.UpdateSettings();
     }
     else
     {
         MessageBox.Show("אתר זה כבר מופיע ברשימה");
     }
 }
 public void ResetToggles()
 {
     _isSocialNetworksBlocked = FilteringSystem.GetCurrentFilteringSettings().isSocialNetworksBlocked;
     _isGamblingBlocked       = FilteringSystem.GetCurrentFilteringSettings().isGamblingBlocked;
     _isNewsBlocked           = FilteringSystem.GetCurrentFilteringSettings().isNewsBlocked;
     _isSportBlocked          = FilteringSystem.GetCurrentFilteringSettings().isSportBlocked;
     _isVideoPlayersBlocked   = FilteringSystem.GetCurrentFilteringSettings().isVideoPlayersBlocked;
     _isGamesBlocked          = FilteringSystem.GetCurrentFilteringSettings().isGamesBlocked;
     _isDatingBlocked         = FilteringSystem.GetCurrentFilteringSettings().isDatingBlocked;
     _isViolenceBlocked       = FilteringSystem.GetCurrentFilteringSettings().isViolenceBlocked;
     _isLifeStyleBlocked      = FilteringSystem.GetCurrentFilteringSettings().isLifeStyleBlocked;
     _isPhotosStackBlocked    = FilteringSystem.GetCurrentFilteringSettings().isPhotosStackBlocked;
     UpdateToggelsGUI();
 }
 private void deleteUrlButton_Click(object sender, EventArgs e)
 {
     try
     {
         string selectedSite = blockedUrlListBox.Items[blockedUrlListBox.SelectedIndex].ToString();
         Resources.profile.Default.customBlacklist.Remove(selectedSite);
         Resources.profile.Default.Save();
         FilteringSystem.UpdateSettings();
         blockedUrlListBox.Items.Remove(selectedSite);
     }
     catch
     {
         MessageBox.Show("המחיקה נכשלה, נסה שוב במועד מאוחר יותר", "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #16
0
        private void AddToBlacklistButton_Click(object sender, RoutedEventArgs e)
        {
            string url = Tools.FormatToShortDomainUri(url_text_box.Text);

            url_text_box.Text = "";
            string result = FilteringSystem.GetCurrentFilteringSettings().AddSiteToBlackList(url);

            if (result == "")
            {
                AddItemToListBox(url, false);
            }
            else
            {
                ShowErrorMessage(result);
            }
        }
Example #17
0
        private void AddToExceptionListButton_Click(object sender, RoutedEventArgs e)
        {
            string url = url_text_box.Text;

            url_text_box.Text = "";
            string result = FilteringSystem.GetCurrentFilteringSettings().AddSiteToExceptionList(url);

            if (result == "")
            {
                AddItemToListBox(url, true);
            }
            else
            {
                ShowErrorMessage(result);
            }
        }
Example #18
0
 private static string ReplaceCustomTagsToData(string original, DateTime date)
 {
     try
     {
         string formatted;
         formatted = original.Replace("%name%", FilteringSystem.GetCurrentFilteringSettings().GetAdminName());
         formatted = formatted.Replace("%date%", date.ToShortDateString() + " בשעה: " + date.ToShortTimeString());
         formatted = formatted.Replace("%pc_name%", FilteringSystem.GetCurrentFilteringSettings().GetComputerName());
         formatted = formatted.Replace("%password%", PasswordEncryption.Decrypt(FilteringSystem.GetCurrentFilteringSettings().GetAdminPassword()));
         return(formatted);
     }
     catch
     {
         return(null);
     }
 }
Example #19
0
 private void SystemSetup()
 {
     try
     {
         FilteringSystem.FirstSetup();
         FilteringSystem.GetCurrentFilteringSettings().SetAdminName(IntroductionPage.Instance.enteredName);
         FilteringSystem.GetCurrentFilteringSettings().SetAdminPassword(SelectPasswordPage.Instance.enteredPassword);
         FilteringSystem.GetCurrentFilteringSettings().SetAdminMail(SetMailPage.Instance.enteredMail);
         FilteringSystem.GetCurrentFilteringSettings().SetComputerName(SetComputerName.Instance.PCName);
         FilteringSystem.SaveChanges();
         FilteringSystem.Load();
         FilteringSystem.SetSystemStatus(true);
     }
     catch (Exception e)
     {
         CustomMessageBox.ShowDialog(null, e.Message, "שגיאה בשמירת שינויים", CustomMessageBox.CustomMessageBoxTypes.Error, "הבנתי");
     }
 }
Example #20
0
 private Boolean HostCatchingChecker()
 {
     if (HostsFileCatcher.getStatus())
     {
         HostCatchingStatusLabel.Text      = "פעיל";
         HostCatchingStatusLabel.ForeColor = Color.LimeGreen;
         return(true);
     }
     else
     {
         HostCatchingStatusLabel.Text      = "לא פעיל";
         HostCatchingStatusLabel.ForeColor = Color.Red;
         if (FilteringSystem.IsOn())
         {
             HostsFileCatcher.StartCatching();
         }
         return(false);
     }
 }
Example #21
0
 private Boolean ServerChecking()
 {
     if (DnsController.isSafe(false))
     {
         currentServerLabel.Text      = "שרת מסונן";
         currentServerLabel.ForeColor = Color.LimeGreen;
         return(true);
     }
     else
     {
         currentServerLabel.Text      = "שרת פתוח";
         currentServerLabel.ForeColor = Color.Red;
         if (FilteringSystem.IsOn() && FilteringSystem.IsSafeServerOn())
         {
             DnsController.setMode(true);
         }
         return(false);
     }
 }
Example #22
0
        private void Toggle_Click(object sender, EventArgs e)
        {
            PictureBox clicked = sender as PictureBox;

            switch (clicked.Tag.ToString())
            {
            case "status":
                FilteringSystem.ToogleStatus();
                break;

            case "scheduel":
                FilteringSystem.ToggleScheduelStatus();
                Program.menuForm.scheduleUC.RefreshStatus();
                break;
            }
            Resources.profile.Default.Save();
            FilteringSystem.UpdateSettings();
            UpdateTogglesGUI();
        }
Example #23
0
        private void DeleteClick(object sender, RoutedEventArgs e)
        {
            string content = (sender as Button).Tag.ToString();
            UrlRow urlRow  = Urls.FindAll(url => url.Url == content).FirstOrDefault();

            if (CustomMessageBox.ShowDialog(Window, "האם אתה בתוך שברצונך למחוק את האתר " + content + " מהרשימה?", "האם אתה בטוח?", CustomMessageBox.CustomMessageBoxTypes.Question, "מחק", "בטל"))
            {
                myListView.Items.Remove(urlRow);
                Urls.RemoveAll(item => item.Url == content);
                if (urlRow.Color == BLACKLIST_COLOR)
                {
                    FilteringSystem.GetCurrentFilteringSettings().RemoveSiteFromBlackList(content);
                }
                else
                {
                    FilteringSystem.GetCurrentFilteringSettings().RemoveSiteFromExceptionList(content);
                }
            }
        }
Example #24
0
        public static void SendUnusualActivityAlert()
        {
            string subject, body;

            subject = "F4E - התראה על פעילות חשודה";
            new Thread(() =>
            {
                Boolean sended    = false;
                DateTime Time_Now = DateTime.Now;
                while (!sended)
                {
                    try
                    {
                        body = ReplaceCustomTagsToData(Tools.GetTextFromUri("http://f4e.mmb.org.il/mails-templets/unusual_activity"), Time_Now);
                        SendCustomMail(FilteringSystem.GetCurrentFilteringSettings().GetAdminMail(), subject, body);
                        sended = true;
                    }
                    catch
                    {
                        Thread.Sleep(120000);
                    }
                }
            }).Start();
        }
Example #25
0
        public static void SendWrongPasswordAlert()
        {
            string subject, body;

            subject = "F4E - התראה על שימוש בסיסמה שגויה";
            new Thread(() =>
            {
                Boolean sended    = false;
                DateTime Time_Now = DateTime.Now;
                while (!sended)
                {
                    try
                    {
                        body = ReplaceCustomTagsToData(Tools.GetTextFromUri("http://f4e.mmb.org.il/mails-templets/wrong_password"), Time_Now);
                        SendCustomMail(FilteringSystem.GetCurrentFilteringSettings().GetAdminMail(), subject, body);
                        sended = true;
                    }
                    catch
                    {
                        Thread.Sleep(120000);
                    }
                }
            }).Start();
        }