Package org.dspace.statistics.util
Class SpiderDetectorServiceImpl
java.lang.Object
org.dspace.statistics.util.SpiderDetectorServiceImpl
- All Implemented Interfaces:
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
-
Constructor Summary
ConstructorsConstructorDescriptionSpiderDetectorServiceImpl(ConfigurationService configurationService, ClientInfoService clientInfoService) -
Method Summary
Modifier and TypeMethodDescriptiongetTable()booleanService Method for testing spiders against existing spider files.booleanisSpider(jakarta.servlet.http.HttpServletRequest request) Service Method for testing spiders against existing spider files.booleanCheck individual IP is a spider.voidLoader to populate the IP address table from files.readPatterns(File patternFile) Utility method which reads lines from a file & returns them in a Set.
-
Constructor Details
-
SpiderDetectorServiceImpl
@Autowired(required=true) public SpiderDetectorServiceImpl(ConfigurationService configurationService, ClientInfoService clientInfoService)
-
-
Method Details
-
getTable
- Specified by:
getTablein interfaceSpiderDetectorService- Returns:
- the table of IP net blocks.
-
isSpider
public boolean isSpider(@NotNull @NotNull String clientIP, String proxyIPs, String hostname, String agent) Description copied from interface:SpiderDetectorServiceService Method for testing spiders against existing spider files.- Specified by:
isSpiderin interfaceSpiderDetectorService- 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
Description copied from interface:SpiderDetectorServiceUtility method which reads lines from a file & returns them in a Set.- Specified by:
readPatternsin interfaceSpiderDetectorService- 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(jakarta.servlet.http.HttpServletRequest request) Description copied from interface:SpiderDetectorServiceService Method for testing spiders against existing spider files.- Specified by:
isSpiderin interfaceSpiderDetectorService- Parameters:
request- the current HTTP request.- Returns:
- true|false if the request was detected to be from a spider.
-
isSpider
Description copied from interface:SpiderDetectorServiceCheck individual IP is a spider.- Specified by:
isSpiderin interfaceSpiderDetectorService- Parameters:
ip- the IP address to be checked.- Returns:
- if is spider IP
-
loadSpiderIpAddresses
public void loadSpiderIpAddresses()Description copied from interface:SpiderDetectorServiceLoader to populate the IP address table from files.- Specified by:
loadSpiderIpAddressesin interfaceSpiderDetectorService
-