mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
5254c4f536
commit
126e07df69
74
daemon.py
74
daemon.py
|
@ -11597,6 +11597,45 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
blockerNickname)
|
blockerNickname)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _getRefererDomain(self, uaStr: str) -> str:
|
||||||
|
"""Returns the referer domain
|
||||||
|
Which domain is the GET request coming from?
|
||||||
|
"""
|
||||||
|
refererDomain = None
|
||||||
|
if self.headers.get('referer'):
|
||||||
|
refererDomain, refererPort = \
|
||||||
|
getDomainFromActor(self.headers['referer'])
|
||||||
|
refererDomain = getFullDomain(refererDomain, refererPort)
|
||||||
|
elif self.headers.get('Referer'):
|
||||||
|
refererDomain, refererPort = \
|
||||||
|
getDomainFromActor(self.headers['Referer'])
|
||||||
|
refererDomain = getFullDomain(refererDomain, refererPort)
|
||||||
|
elif self.headers.get('Signature'):
|
||||||
|
if 'keyId="' in self.headers['Signature']:
|
||||||
|
refererDomain = self.headers['Signature'].split('keyId="')[1]
|
||||||
|
if '/' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split('/')[0]
|
||||||
|
elif '#' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split('#')[0]
|
||||||
|
elif '"' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split('"')[0]
|
||||||
|
elif uaStr:
|
||||||
|
if '+https://' in uaStr:
|
||||||
|
refererDomain = \
|
||||||
|
self.headers['User-Agent'].split('+https://')[1]
|
||||||
|
if '/' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split('/')[0]
|
||||||
|
elif ')' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split(')')[0]
|
||||||
|
elif '+http://' in uaStr:
|
||||||
|
refererDomain = \
|
||||||
|
self.headers['User-Agent'].split('+http://')[1]
|
||||||
|
if '/' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split('/')[0]
|
||||||
|
elif ')' in refererDomain:
|
||||||
|
refererDomain = refererDomain.split(')')[0]
|
||||||
|
return refererDomain
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
callingDomain = self.server.domainFull
|
callingDomain = self.server.domainFull
|
||||||
|
|
||||||
|
@ -11640,40 +11679,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._400()
|
self._400()
|
||||||
return
|
return
|
||||||
|
|
||||||
# which domain is the GET request coming from?
|
refererDomain = self._getRefererDomain(uaStr)
|
||||||
refererDomain = None
|
|
||||||
if self.headers.get('referer'):
|
|
||||||
refererDomain, refererPort = \
|
|
||||||
getDomainFromActor(self.headers['referer'])
|
|
||||||
refererDomain = getFullDomain(refererDomain, refererPort)
|
|
||||||
elif self.headers.get('Referer'):
|
|
||||||
refererDomain, refererPort = \
|
|
||||||
getDomainFromActor(self.headers['Referer'])
|
|
||||||
refererDomain = getFullDomain(refererDomain, refererPort)
|
|
||||||
elif self.headers.get('Signature'):
|
|
||||||
if 'keyId="' in self.headers['Signature']:
|
|
||||||
refererDomain = self.headers['Signature'].split('keyId="')[1]
|
|
||||||
if '/' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split('/')[0]
|
|
||||||
elif '#' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split('#')[0]
|
|
||||||
elif '"' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split('"')[0]
|
|
||||||
elif uaStr:
|
|
||||||
if '+https://' in uaStr:
|
|
||||||
refererDomain = \
|
|
||||||
self.headers['User-Agent'].split('+https://')[1]
|
|
||||||
if '/' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split('/')[0]
|
|
||||||
elif ')' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split(')')[0]
|
|
||||||
elif '+http://' in uaStr:
|
|
||||||
refererDomain = \
|
|
||||||
self.headers['User-Agent'].split('+http://')[1]
|
|
||||||
if '/' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split('/')[0]
|
|
||||||
elif ')' in refererDomain:
|
|
||||||
refererDomain = refererDomain.split(')')[0]
|
|
||||||
|
|
||||||
GETstartTime = time.time()
|
GETstartTime = time.time()
|
||||||
GETtimings = {}
|
GETtimings = {}
|
||||||
|
|
Loading…
Reference in New Issue