Class SpiderDetectorServiceImpl

  • All Implemented Interfaces:
    SpiderDetectorService

    public class SpiderDetectorServiceImpl
    extends Object
    implements SpiderDetectorService
    SpiderDetectorServiceImpl is used to find IP's that are spiders... In future someone may add Host Domains to the detection criteria here.
    Author:
    kevinvandevelde at atmire.com, ben at atmire.com, Mark Diggory (mdiggory at atmire.com), frederic at atmire.com
    • Method Detail

      • isSpider

        public boolean isSpider​(String clientIP,
                                String proxyIPs,
                                String hostname,
                                String agent)
        Service Method for testing spiders against existing spider files.

        In future spiders HashSet may be optimized as byte offset array to improve performance and memory footprint further.

        Specified by:
        isSpider in interface SpiderDetectorService
        Parameters:
        clientIP - address of the client.
        proxyIPs - comma-list of X-Forwarded-For addresses, or null.
        hostname - domain name of host, or null.
        agent - User-Agent header value, or null.
        Returns:
        true if the client matches any spider characteristics list.
      • readPatterns

        public Set<String> readPatterns​(File patternFile)
                                 throws IOException
        Utility method which reads lines from a file & returns them in a Set.
        Specified by:
        readPatterns in interface SpiderDetectorService
        Parameters:
        patternFile - the location of our spider file
        Returns:
        a vector full of patterns
        Throws:
        IOException - could not happen since we check the file be4 we use it
      • isSpider

        public boolean isSpider​(javax.servlet.http.HttpServletRequest request)
        Service Method for testing spiders against existing spider files.
        Specified by:
        isSpider in interface SpiderDetectorService
        Parameters:
        request -
        Returns:
        true|false if the request was detected to be from a spider.
      • isSpider

        public boolean isSpider​(String ip)
        Check individual IP is a spider.
        Specified by:
        isSpider in interface SpiderDetectorService
        Parameters:
        ip -
        Returns:
        if is spider IP