Exemplo n.º 1
0
        internal static void AddWhiteListing(HttpContext current)
        {
            string currUrl  = current.Request.Url.ToString();
            string basePath = currUrl.Substring(0, currUrl.IndexOf(current.Request.Url.Host) + current.Request.Url.Host.Length);


            // Set up proxy.
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
            EndpointAddress endpoint = new EndpointAddress(basePath + "/_vti_bin/SharePresence/GateKeeperService.svc");

            GateKeeperService.GateKeeperServiceClient service = new GateKeeperService.GateKeeperServiceClient(binding, endpoint);
            service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
            string Referrer  = current.Request.UrlReferrer == null ? string.Empty : current.Request.UrlReferrer.AbsoluteUri;
            string UserAgent = current.Request.UserAgent == null ? string.Empty : current.Request.UserAgent;

            service.GateKeeper(GateKeeperService.GateKeeperType.White, GateKeeperService.GateKeeperListing.GateKeeper_IPAddress, current.Request.UserHostAddress.ToString());

            if (!string.IsNullOrEmpty(Referrer))
            {
                service.GateKeeper(GateKeeperService.GateKeeperType.White, GateKeeperService.GateKeeperListing.GateKeeper_Url, Referrer);
            }

            if (!string.IsNullOrEmpty(UserAgent))
            {
                service.GateKeeper(GateKeeperService.GateKeeperType.White, GateKeeperService.GateKeeperListing.GateKeeper_Useragent, UserAgent);
            }
        }
Exemplo n.º 2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUrl.Text))
            {
                return;
            }

            string currUrl  = Request.Url.ToString();
            string basePath = currUrl.Substring(0, currUrl.IndexOf(Request.Url.Host) + Request.Url.Host.Length);


            // Set up proxy.
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
            EndpointAddress endpoint = new EndpointAddress(basePath + "/_vti_bin/SharePresence/GateKeeperService.svc");

            GateKeeperService.GateKeeperServiceClient service = new GateKeeperService.GateKeeperServiceClient(binding, endpoint);
            service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

            service.GateKeeper(GateKeeperService.GateKeeperType.White, GateKeeperService.GateKeeperListing.GateKeeper_Url, txtUrl.Text);

            Response.Redirect(Request.RawUrl, true);
        }
Exemplo n.º 3
0
        internal static void AddWhiteListing(HttpContext current, GateKeeperService.GateKeeperListing listing, string value)
        {
            string currUrl  = current.Request.Url.ToString();
            string basePath = currUrl.Substring(0, currUrl.IndexOf(current.Request.Url.Host) + current.Request.Url.Host.Length);


            // Set up proxy.
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
            EndpointAddress endpoint = new EndpointAddress(basePath + "/_vti_bin/SharePresence/GateKeeperService.svc");

            GateKeeperService.GateKeeperServiceClient service = new GateKeeperService.GateKeeperServiceClient(binding, endpoint);
            service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
            service.GateKeeper(GateKeeperService.GateKeeperType.White, listing, value);
        }
Exemplo n.º 4
0
        public static Boolean IsHoney(HttpContext current)
        {
            //GateKeeperModule.log.Debug("Entering isHoneyPotVoilator");

            if (!honeypotUrl.IsMatch(current.Request.Url.AbsolutePath))
            {
                //GateKeeperModule.log.Debug("Honeypot url path was not found in the request path");
                return(false);
            }

            if (GateKeeperModule.config.EnableHoneyPotLogging)
            {
                //GateKeeperModule.log.Debug("Adding violator into HoneyPot log");
                AddHoneyPot(current);
            }

            // Add new entry in the ipaddress deny list
            if (GateKeeperModule.config.PersistHoneyPotDeny)
            {
                string currUrl  = current.Request.Url.ToString();
                string basePath = currUrl.Substring(0, currUrl.IndexOf(current.Request.Url.Host) + current.Request.Url.Host.Length);


                // Set up proxy.
                BasicHttpBinding binding = new BasicHttpBinding();
                binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
                EndpointAddress endpoint = new EndpointAddress(basePath + "/_vti_bin/SharePresence/GateKeeperService.svc");

                GateKeeperService.GateKeeperServiceClient service = new GateKeeperService.GateKeeperServiceClient(binding, endpoint);
                service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
                service.GateKeeper(GateKeeperService.GateKeeperType.Black, GateKeeperService.GateKeeperListing.GateKeeper_IPAddress, current.Request.UserHostAddress.ToString());
            }

            // if NotifyAdmin is enabled then send an email
            if (GateKeeperModule.config.NotifyAdmin)
            {
                Smtp.SendNotification(current);
            }

            onViolation(current);
            //GateKeeperModule.log.Debug("Leaving isHoneyPotVoilator");
            return(true);
        }