mirror of https://gitlab.com/bashrc2/epicyon
Show full header when using debug scripts
parent
34e9353cb1
commit
58d5fa7ed0
|
|
@ -286,7 +286,8 @@ def daemon_http_get(self) -> None:
|
|||
if is_image_file(self.path):
|
||||
http_404(self, 720)
|
||||
return
|
||||
print('GET HTTP LLM scraper poisoned: ' + str(self.headers))
|
||||
print('GET HTTP LLM scraper poisoned: ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
msg = html_poisoned(self.server.dictionary,
|
||||
self.server.twograms)
|
||||
msg = msg.encode('utf-8')
|
||||
|
|
@ -302,7 +303,8 @@ def daemon_http_get(self) -> None:
|
|||
|
||||
# suspicious headers
|
||||
if contains_suspicious_headers(self.headers):
|
||||
print('GET HTTP suspicious headers 1 ' + str(self.headers))
|
||||
print('GET HTTP suspicious headers 1 ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_403(self)
|
||||
return
|
||||
|
||||
|
|
@ -340,7 +342,7 @@ def daemon_http_get(self) -> None:
|
|||
|
||||
if contains_invalid_chars(str(self.headers)):
|
||||
print('GET HTTP headers contain invalid characters ' +
|
||||
str(self.headers))
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_403(self)
|
||||
return
|
||||
|
||||
|
|
@ -405,7 +407,8 @@ def daemon_http_get(self) -> None:
|
|||
http_402(self)
|
||||
return
|
||||
# if this is an LLM crawler then feed it some trash
|
||||
print('GET HTTP LLM scraper poisoned: ' + str(self.headers))
|
||||
print('GET HTTP LLM scraper poisoned: ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
msg = html_poisoned(self.server.dictionary,
|
||||
self.server.twograms)
|
||||
msg = msg.encode('utf-8')
|
||||
|
|
@ -649,7 +652,7 @@ def daemon_http_get(self) -> None:
|
|||
str(self.server.getreq_busy))
|
||||
|
||||
if self.server.debug:
|
||||
print(str(self.headers))
|
||||
print(str(self.headers).replace('\n', ' '))
|
||||
|
||||
cookie = None
|
||||
if self.headers.get('Cookie'):
|
||||
|
|
@ -708,7 +711,7 @@ def daemon_http_get(self) -> None:
|
|||
print('GET Authorization granted ' + self.path)
|
||||
else:
|
||||
print('GET Not authorized ' + self.path + ' ' +
|
||||
str(self.headers))
|
||||
str(self.headers).replace('\n', ' '))
|
||||
|
||||
fitness_performance(getreq_start_time, self.server.fitness,
|
||||
'_GET', 'isAuthorized',
|
||||
|
|
@ -1484,7 +1487,8 @@ def daemon_http_get(self) -> None:
|
|||
self.headers['Connection'])
|
||||
http_200(self)
|
||||
else:
|
||||
print('WARN: No Accept header ' + str(self.headers))
|
||||
print('WARN: No Accept header ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -178,17 +178,20 @@ def daemon_http_post(self) -> None:
|
|||
|
||||
mitm = detect_mitm(self)
|
||||
if mitm:
|
||||
print('DEBUG: MITM on HTTP POST, ' + str(self.headers))
|
||||
print('DEBUG: MITM on HTTP POST, ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
|
||||
# headers used by LLM scrapers
|
||||
if 'oai-host-hash' in self.headers:
|
||||
print('POST HTTP LLM scraper bounced: ' + str(self.headers))
|
||||
print('POST HTTP LLM scraper bounced: ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_402(self)
|
||||
return
|
||||
|
||||
# suspicious headers
|
||||
if contains_suspicious_headers(self.headers):
|
||||
print('POST HTTP suspicious headers 2 ' + str(self.headers))
|
||||
print('POST HTTP suspicious headers 2 ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_403(self)
|
||||
return
|
||||
|
||||
|
|
@ -261,7 +264,7 @@ def daemon_http_post(self) -> None:
|
|||
|
||||
if contains_invalid_chars(str(self.headers)):
|
||||
print('POST HTTP headers contain invalid characters ' +
|
||||
str(self.headers))
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_403(self)
|
||||
self.server.postreq_busy = False
|
||||
return
|
||||
|
|
@ -342,7 +345,7 @@ def daemon_http_post(self) -> None:
|
|||
authorized = is_authorized(self)
|
||||
if not authorized and self.server.debug:
|
||||
print('POST Not authorized')
|
||||
print(str(self.headers))
|
||||
print(str(self.headers).replace('\n', ' '))
|
||||
|
||||
# if this is a POST to the outbox then check authentication
|
||||
self.outbox_authenticated = False
|
||||
|
|
@ -1140,7 +1143,7 @@ def daemon_http_post(self) -> None:
|
|||
not content_type_str.startswith('application/ld+json'):
|
||||
print("POST is not json: " + self.headers['Content-type'])
|
||||
if self.server.debug:
|
||||
print(str(self.headers))
|
||||
print(str(self.headers).replace('\n', ' '))
|
||||
length = int(self.headers['Content-length'])
|
||||
if length < self.server.max_post_length:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue