Esempio n. 1
0
        public void Attack()
        {
            Host[] hosts = DataLayer.GetCrawlRunHosts(_crawlId);

            if (UseSimpleXssAttacker)
            {
                Attack attack = new Attack();
                attack.CrawlSettingId = _crawlId;
                DataLayer.Save(attack);

                SimpleXssAttacker simpleXssAttacker = new SimpleXssAttacker(attack, _numberOfThreads,hosts);
                simpleXssAttacker.AttackAnnounced += Attacker_AttackAnnounced;
                simpleXssAttacker.AttackCompleted += Attacker_AttackCompleted;
                simpleXssAttacker.AttackStarted += Attacker_AttackStarted;
                attack.StartTime = DateTime.Now;
                simpleXssAttacker.Attack();

                DataLayer.Save(attack);
            }

            if (UseEncodedXssAttacker)
            {
                Attack attack = new Attack();
                attack.CrawlSettingId = _crawlId;
                attack.StartTime = DateTime.Now;
                DataLayer.Save(attack);

                EncodedXssAttacker encodedXssAttacker = new EncodedXssAttacker(attack, _numberOfThreads, hosts);
                encodedXssAttacker.AttackAnnounced += Attacker_AttackAnnounced;
                encodedXssAttacker.AttackCompleted += Attacker_AttackCompleted;
                encodedXssAttacker.AttackStarted += Attacker_AttackStarted;

                encodedXssAttacker.Attack();
            }
        }