Search for "compatible" in all requests, not only the first one

This commit is contained in:
Gregory Soutade 2023-02-18 08:48:57 +01:00
parent b29765dda9
commit a5bef4ece6
1 changed files with 5 additions and 3 deletions

View File

@ -76,9 +76,11 @@ class IWLAPreAnalysisRobots(IPlugin):
self.logger.debug('%s is a robot (caller %s:%d)' % (k, info.function, info.lineno))
super_hit['robot'] = 1
super_hit['keep_requests'] = False
robot_name = self.compatible_re.match(super_hit['requests'][0]['http_user_agent'])
if robot_name:
super_hit['robot_name'] = robot_name[1]
for hit in super_hit['requests']:
robot_name = self.compatible_re.match(hit['http_user_agent'])
if robot_name:
super_hit['robot_name'] = robot_name[1]
break
# Basic rule to detect robots
def hook(self):