示例#1
0
        public void PerformWPADTest_AuthPermutations()
        {
            HttpListener httpListener = WPADServiceFakeHelper.CreateWPADService(String.Format("http://{0}:{1}/", ServerAddress, ServerPort));

            try
            {
                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                SpoofDetectionResult result =
                    WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, null, null, null);
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);

                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                result = WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, "Guest", null, null);
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);

                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                result = WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, "Guest", "test", null);
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);

                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                result = WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, "Guest", "test",
                                                    "test");
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);

                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                result = WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, "Guest", null, "test");
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);

                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                result = WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, null, "test", "test");
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);

                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                result = WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, null, null, "test");
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual("HTTP Code OK", result.Response);
            }
            finally
            {
                httpListener.Close();
            }
        }
示例#2
0
        public void PerformWPADTest()
        {
            HttpListener httpListener = WPADServiceFakeHelper.CreateWPADService(String.Format("http://{0}:{1}/", ServerAddress, ServerPort));

            try
            {
                WPADServiceFakeHelper.PerformSingleWPADServiceListen(httpListener, HttpStatusCode.OK, "");
                SpoofDetectionResult result =
                    WPADTester.PerformWPADTest(IPAddress.Parse(ServerAddress), ServerPort, "test", "test", "test");
                Assert.IsTrue(result.Detected);
                Assert.AreEqual(ConfidenceLevel.Medium, result.Confidence);
                Assert.AreEqual(Protocol.WPAD, result.Protocol);
                Assert.IsNull(result.ErrorMessage);
                Assert.AreEqual("HTTP Code OK", result.Response);
                Assert.AreEqual(ServerAddress, result.Endpoint.Address.ToString());
                Assert.AreEqual(ServerPort, result.Endpoint.Port);
            }
            finally
            {
                httpListener.Close();
            }
        }