Beispiel #1
0
        public void UrlStatsCalc()
        {
            List <Resource> BadSiteList = Repository
                                          .Find <Resource>
                                              (s => s.ItemType == PhishDataType.Negative)
                                          .ToList();

            UrlStatistic BadSites = new UrlStatistic(BadSiteList, StatisticType.BadSites);

            List <Resource> GoodSiteList = Repository
                                           .Find <Resource>(s => s.ItemType == PhishDataType.Positive)
                                           .ToList();

            UrlStatistic GoodSites = new UrlStatistic(GoodSiteList, StatisticType.GoodSites);

            UrlStatistic CombinedStats = OverallStatsCalc(BadSites, GoodSites);

            List <UrlStatistic> ExistingStats = Repository.GetAll <UrlStatistic>().ToList();

            Repository.DeleteMultiple(ExistingStats);

            List <UrlStatistic> NewStats = new List <UrlStatistic>();

            NewStats.Add(BadSites);
            NewStats.Add(GoodSites);
            NewStats.Add(CombinedStats);
            Repository.AddMultiple(NewStats);
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();

            db             = new PhishModel();
            Repository     = new EFRepository(db);
            AlgorithmClass = new Algorithms();

            txtUrl.Text = "www.google.com";

            CombinedStats = Repository.Find <UrlStatistic>(s => s.Type == StatisticType.Overall).FirstOrDefault();
        }
Beispiel #3
0
        public static UrlStatistic OverallStatsCalc(UrlStatistic BadSites, UrlStatistic GoodSites)
        {
            UrlStatistic Stat = new UrlStatistic(StatisticType.Overall);

            Stat.AtSymbolsAverage = BadSites.AtSymbolsAverage - GoodSites.AtSymbolsAverage;
            Stat.AverageBadHttps  = BadSites.AverageBadHttps - GoodSites.AverageBadHttps;

            Stat.AverageIPAddress   = BadSites.AverageIPAddress - GoodSites.AverageIPAddress;
            Stat.AveragePortNumbers = BadSites.AveragePortNumbers - GoodSites.AveragePortNumbers;

            Stat.ForwardSlashAverage = BadSites.ForwardSlashAverage - GoodSites.ForwardSlashAverage;
            Stat.FullStopAverage     = BadSites.FullStopAverage - GoodSites.FullStopAverage;

            Stat.MultipleForwardSlashAverage = BadSites.MultipleForwardSlashAverage - GoodSites.MultipleForwardSlashAverage;


            return(Stat);
        }