mirror of https://gitlab.com/bashrc2/epicyon
Check user agent domain against calling domain
parent
3f653dc90b
commit
4decc56a37
16
daemon.py
16
daemon.py
|
@ -473,17 +473,19 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return None
|
return None
|
||||||
return agentDomain
|
return agentDomain
|
||||||
|
|
||||||
def _blockedUserAgent(self) -> bool:
|
def _blockedUserAgent(self, callingDomain: str) -> bool:
|
||||||
"""Should a GET or POST be blocked based upon its user agent?
|
"""Should a GET or POST be blocked based upon its user agent?
|
||||||
"""
|
"""
|
||||||
agentDomain = self._userAgentDomain()
|
agentDomain = self._userAgentDomain()
|
||||||
|
blockedUA = False
|
||||||
if not agentDomain:
|
if not agentDomain:
|
||||||
if self.server.userAgentDomainRequired:
|
if self.server.userAgentDomainRequired:
|
||||||
return True
|
return True
|
||||||
return False
|
return blockedUA
|
||||||
blockedUA = isBlockedDomain(self.server.baseDir, agentDomain)
|
if not agentDomain.startswith(callingDomain):
|
||||||
if blockedUA and self.server.debug:
|
blockedUA = isBlockedDomain(self.server.baseDir, agentDomain)
|
||||||
print('Blocked User agent: ' + agentDomain)
|
if blockedUA and self.server.debug:
|
||||||
|
print('Blocked User agent: ' + agentDomain)
|
||||||
return blockedUA
|
return blockedUA
|
||||||
|
|
||||||
def _requestHTTP(self) -> bool:
|
def _requestHTTP(self) -> bool:
|
||||||
|
@ -10628,7 +10630,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._400()
|
self._400()
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._blockedUserAgent():
|
if self._blockedUserAgent(callingDomain):
|
||||||
self._400()
|
self._400()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -14130,7 +14132,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._400()
|
self._400()
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._blockedUserAgent():
|
if self._blockedUserAgent(callingDomain):
|
||||||
self._400()
|
self._400()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue