Ejemplo n.º 1
0
        private void RunVulnerabilityTest(string name, string mode, Action <PhpVHTester> action)
        {
            var phpFiles = Directory.GetFiles("PHP\\" + name);

            using (var tester = new PhpVHTester(name, mode, phpFiles))
            {
                try
                {
                    tester.RunPhpVH();
                    action(tester);
                    var alerts = tester.LoadAlerts();

                    phpFiles
                    .Select(x => "/" + Path.GetFileName(x))
                    .Iter(x => Assert.IsTrue(alerts.Any(y => y.Trace.Request.Contains(x)), _noAlertForTest, x));

                    var anyFalsePositives = alerts.Any(x => x.Trace.Request.Contains("/FalsePositiveCheck.php"));
                    Assert.IsFalse(anyFalsePositives, _falsePositiveMarkerFound);
                }
                catch
                {
                    tester.DumpOutput();

                    throw;
                }
            }
        }
Ejemplo n.º 2
0
 private void ReadTestCore(PhpVHTester tester, string anchor)
 {
     Assert.IsTrue(
         tester
         .LoadAlerts()
         .All(x => x.Trace.Response.Contains(anchor)),
         _falsePositive);
 }
        private void RunVulnerabilityTest(string name, string mode, Action<PhpVHTester> action)
        {
            var phpFiles = Directory.GetFiles("PHP\\" + name);
            using (var tester = new PhpVHTester(name, mode, phpFiles))
            {
                try
                {
                    tester.RunPhpVH();
                    action(tester);
                    var alerts = tester.LoadAlerts();

                    phpFiles
                        .Select(x => "/" + Path.GetFileName(x))
                        .Iter(x => Assert.IsTrue(alerts.Any(y => y.Trace.Request.Contains(x)), _noAlertForTest, x));

                    var anyFalsePositives = alerts.Any(x => x.Trace.Request.Contains("/FalsePositiveCheck.php"));
                    Assert.IsFalse(anyFalsePositives, _falsePositiveMarkerFound);
                }
                catch
                {
                    tester.DumpOutput();

                    throw;
                }
            }
        }
 private void ReadTestCore(PhpVHTester tester, string anchor)
 {
     Assert.IsTrue(
         tester
             .LoadAlerts()
             .All(x => x.Trace.Response.Contains(anchor)),
         _falsePositive);
 }